diff --git a/features/qskautotest.prf b/features/qskautotest.prf new file mode 100644 index 00000000..5e7a2e87 --- /dev/null +++ b/features/qskautotest.prf @@ -0,0 +1,10 @@ +TEMPLATE = app +CONFIG += qskinny qsktestsupport testcase + +QT += testlib + +DEFINES += QSK_DLL +DESTDIR = $$clean_path( $${OUT_PWD}/../bin ) + +target.path = $${QSK_INSTALL_AUTOTESTS}/bin +INSTALLS = target diff --git a/features/qskconfig.pri b/features/qskconfig.pri index 1b3f20fb..df8d0479 100644 --- a/features/qskconfig.pri +++ b/features/qskconfig.pri @@ -31,6 +31,7 @@ QSK_INSTALL_LIBS = $${QSK_INSTALL_PREFIX}/lib QSK_INSTALL_BINS = $${QSK_INSTALL_PREFIX}/bin QSK_INSTALL_PLUGINS = $${QSK_INSTALL_PREFIX}/plugins QSK_INSTALL_EXAMPLES = $${QSK_INSTALL_PREFIX}/examples +QSK_INSTALL_AUTOTESTS = $${QSK_INSTALL_PREFIX}/tests CONFIG += no_private_qt_headers_warning diff --git a/qskinny.pro b/qskinny.pro index 7a41eef1..f1cca581 100644 --- a/qskinny.pro +++ b/qskinny.pro @@ -8,7 +8,8 @@ SUBDIRS = \ tools \ support \ examples \ - playground + playground \ + tests OTHER_FILES = \ doc/Doxyfile \ @@ -25,3 +26,4 @@ tools.depends = src support.depends = src skins examples.depends = tools support skins qmlexport playground.depends = tools support skins qmlexport +tests.depends = support diff --git a/tests/graphic/graphic.pro b/tests/graphic/graphic.pro new file mode 100644 index 00000000..11cbf9fd --- /dev/null +++ b/tests/graphic/graphic.pro @@ -0,0 +1,3 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qskcolorfilter \ diff --git a/tests/graphic/qskcolorfilter/qskcolorfilter.pro b/tests/graphic/qskcolorfilter/qskcolorfilter.pro new file mode 100644 index 00000000..faff39aa --- /dev/null +++ b/tests/graphic/qskcolorfilter/qskcolorfilter.pro @@ -0,0 +1,4 @@ +CONFIG += qskautotest + +TARGET = testQskColorFilter +SOURCES += testQskColorFilter.cpp diff --git a/tests/graphic/qskcolorfilter/testQskColorFilter.cpp b/tests/graphic/qskcolorfilter/testQskColorFilter.cpp new file mode 100644 index 00000000..308a8175 --- /dev/null +++ b/tests/graphic/qskcolorfilter/testQskColorFilter.cpp @@ -0,0 +1,33 @@ +#include + +#include +#include + +class TestQskColorFilter : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void substituteBrush(); +}; + +void TestQskColorFilter::substituteBrush() +{ + QskColorFilter filter; + filter.addColorSubstitution( Qt::white, Qt::black ); + + QLinearGradient gradient; + QGradientStops originalStops( { { 0.0, Qt::white }, { 1.0, Qt::blue } } ); + gradient.setStops( originalStops ); + + QBrush originalBrush( gradient ); + + auto newBrush = filter.substituted( originalBrush ); + QGradientStops newStops( { { 0.0, Qt::black }, { 1.0, Qt::blue } } ); + + QVERIFY( originalBrush.gradient()->stops() == originalStops ); + QVERIFY( newBrush.gradient()->stops() == newStops ); +} + +QTEST_GUILESS_MAIN( TestQskColorFilter ) +#include "testQskColorFilter.moc" diff --git a/tests/tests.pro b/tests/tests.pro new file mode 100644 index 00000000..fdca9e1c --- /dev/null +++ b/tests/tests.pro @@ -0,0 +1,3 @@ +TEMPLATE=subdirs +SUBDIRS=\ + graphic \