<commit_before>/*
 * This file is part of the kreenshot-editor project.
 *
 * Copyright (C) 2014 by <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 or the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
#ifndef TEST_UI_H
#define TEST_UI_H

#include <QObject>
#include <QDebug>
#include <QString>
#include <QTest>
#include <QFileInfo>
#include "lib/kreenshoteditor/ui/settings/pageoutput.h"
#include "lib/kreenshoteditor/ui/settings/pageoutputimpl.h"

using namespace kreen::ui;
using namespace kreen::ui::settings;

class TestUi : public QObject
{
    Q_OBJECT

private:

public slots:
//     void initTestCase()
//     void cleanupTestCase();

private slots:
    void PageOutputImpl_filenameToFilenamePlusExt_1()
    {
        QString filename, ext;
        PageOutputImplHeader::filenameToFilenamePlusExt("abc.def-ghi.png", &filename, &ext);
        QCOMPARE(filename, QString("abc.def-ghi"));
        QCOMPARE(ext, QString("png"));
    }

    void PageOutputImpl_filenameToFilenamePlusExt_2()
    {
        QString filename, ext;
        PageOutputImplHeader::filenameToFilenamePlusExt("abc.def-ghi_AAA", &filename, &ext);
        QCOMPARE(filename, QString("abc"));
        QCOMPARE(ext, QString("def-ghi_AAA"));
    }

    void PageOutputImpl_filenameToFilenamePlusExt_3()
    {
        QString filename, ext;
        PageOutputImplHeader::filenameToFilenamePlusExt("abc-def-ghi", &filename, &ext);
        QCOMPARE(filename, QString("abc-def-ghi"));
        QCOMPARE(ext, QString(""));
    }

    void PageOutputImpl_filenamePlusExtToFilename()
    {
        QCOMPARE(PageOutputImplHeader::filenamePlusExtToFilename("abc.def-ghi", "png"), QString("abc.def-ghi.png"));
    }
};

#endif

// kate: indent-mode cstyle; replace-tabs on;<commit_msg>test that helped fix the missing theme icons problem<commit_after>/*
 * This file is part of the kreenshot-editor project.
 *
 * Copyright (C) 2014 by <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 or the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
#ifndef TEST_UI_H
#define TEST_UI_H

#include <QObject>
#include <QDebug>
#include <QString>
#include <QTest>
#include <QFileInfo>
#include "lib/kreenshoteditor/ui/settings/pageoutput.h"
#include "lib/kreenshoteditor/ui/settings/pageoutputimpl.h"

using namespace kreen::ui;
using namespace kreen::ui::settings;

class TestUi : public QObject
{
    Q_OBJECT

private:

public slots:
//     void initTestCase()
//     void cleanupTestCase();

private slots:
    void PageOutputImpl_filenameToFilenamePlusExt_1()
    {
        QString filename, ext;
        PageOutputImplHeader::filenameToFilenamePlusExt("abc.def-ghi.png", &filename, &ext);
        QCOMPARE(filename, QString("abc.def-ghi"));
        QCOMPARE(ext, QString("png"));
    }

    void PageOutputImpl_filenameToFilenamePlusExt_2()
    {
        QString filename, ext;
        PageOutputImplHeader::filenameToFilenamePlusExt("abc.def-ghi_AAA", &filename, &ext);
        QCOMPARE(filename, QString("abc"));
        QCOMPARE(ext, QString("def-ghi_AAA"));
    }

    void PageOutputImpl_filenameToFilenamePlusExt_3()
    {
        QString filename, ext;
        PageOutputImplHeader::filenameToFilenamePlusExt("abc-def-ghi", &filename, &ext);
        QCOMPARE(filename, QString("abc-def-ghi"));
        QCOMPARE(ext, QString(""));
    }

    void PageOutputImpl_filenamePlusExtToFilename()
    {
        QCOMPARE(PageOutputImplHeader::filenamePlusExtToFilename("abc.def-ghi", "png"), QString("abc.def-ghi.png"));
    }

    void ThemeIcons()
    {
        qDebug() << "ThemeIcons()";

        qDebug() << "QIcon::themeName(): " << QIcon::themeName();
        // not breeze because there are currently no icons (2014-07-25)
        // The icon theme can be set using the "Icons" KDE Control Module
        QCOMPARE(QIcon::themeName(), QString("oxygen"));

        foreach (QString path, QIcon::themeSearchPaths()) {
            qDebug() << "path: " << path;
        }

        auto icon1 = QIcon::fromTheme("edit-select");
        QCOMPARE(icon1.isNull(), false);

        auto icon2 = QIcon::fromTheme("system");
        QCOMPARE(icon2.isNull(), false);

        auto icon3 = QIcon::fromTheme("document-new");
        QCOMPARE(icon3.isNull(), false);
    }
};

#endif

// kate: indent-mode cstyle; replace-tabs on;
{'fraction_non_alphanumeric': 0.11713705958310275, 'fraction_numerical': 0.005534034311012728, 'mean_word_length': 3.6500857632933106, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3657519', 'n_tokens_mistral': 1632, 'n_tokens_neox': 1599, 'n_words': 459}