Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1.9 KB
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2016 Dmitry Kazakov <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "kis_brush_hud_properties_config_test.h"

#include <simpletest.h>
#include "kis_brush_hud_properties_config.h"
#include <QDomDocument>

#include "kis_debug.h"


void KisBrushHudPropertiesConfigTest::test()
{
    {
        KisBrushHudPropertiesConfig cfg;

        QList<QString> properties1;
        properties1 << "prop1";
        properties1 << "prop2";
        properties1 << "prop3";
        cfg.setSelectedProperties("brush1", properties1);

        QList<QString> properties2;
        properties2 << "prop4";
        properties2 << "prop5";
        properties2 << "prop6";
        cfg.setSelectedProperties("brush2", properties2);

        // {
        //     qDebug() << "===========================";
        //     QString str = cfg.testingGetDocument()->toString(4);
        //     printf(str.toLatin1());
        // }

        properties1.clear();
        properties1 << "prop7";
        properties1 << "prop8";
        cfg.setSelectedProperties("brush1", properties1);

        // {
        //     qDebug() << "===========================";
        //     QString str = cfg.testingGetDocument()->toString(4);
        //     printf(str.toLatin1());
        // }

        properties1.clear();
        properties1 = cfg.selectedProperties("brush1");

        QCOMPARE(properties1.size(), 2);
        QCOMPARE(properties1[0], QString("prop7"));
        QCOMPARE(properties1[1], QString("prop8"));
    }

    {
        KisBrushHudPropertiesConfig cfg;
        QList<QString> properties1;
        properties1 = cfg.selectedProperties("brush1");

        // qDebug() << "===========================";
        // qDebug() << ppVar(properties1);

        QCOMPARE(properties1.size(), 2);
        QCOMPARE(properties1[0], QString("prop7"));
        QCOMPARE(properties1[1], QString("prop8"));
    }
}

SIMPLE_TEST_MAIN(KisBrushHudPropertiesConfigTest)