Add auto tests for color filter bug
This commit is contained in:
parent
78a9d911ce
commit
c41e5c431d
|
@ -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
|
|
@ -31,6 +31,7 @@ QSK_INSTALL_LIBS = $${QSK_INSTALL_PREFIX}/lib
|
||||||
QSK_INSTALL_BINS = $${QSK_INSTALL_PREFIX}/bin
|
QSK_INSTALL_BINS = $${QSK_INSTALL_PREFIX}/bin
|
||||||
QSK_INSTALL_PLUGINS = $${QSK_INSTALL_PREFIX}/plugins
|
QSK_INSTALL_PLUGINS = $${QSK_INSTALL_PREFIX}/plugins
|
||||||
QSK_INSTALL_EXAMPLES = $${QSK_INSTALL_PREFIX}/examples
|
QSK_INSTALL_EXAMPLES = $${QSK_INSTALL_PREFIX}/examples
|
||||||
|
QSK_INSTALL_AUTOTESTS = $${QSK_INSTALL_PREFIX}/tests
|
||||||
|
|
||||||
CONFIG += no_private_qt_headers_warning
|
CONFIG += no_private_qt_headers_warning
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ SUBDIRS = \
|
||||||
tools \
|
tools \
|
||||||
support \
|
support \
|
||||||
examples \
|
examples \
|
||||||
playground
|
playground \
|
||||||
|
tests
|
||||||
|
|
||||||
OTHER_FILES = \
|
OTHER_FILES = \
|
||||||
doc/Doxyfile \
|
doc/Doxyfile \
|
||||||
|
@ -25,3 +26,4 @@ tools.depends = src
|
||||||
support.depends = src skins
|
support.depends = src skins
|
||||||
examples.depends = tools support skins qmlexport
|
examples.depends = tools support skins qmlexport
|
||||||
playground.depends = tools support skins qmlexport
|
playground.depends = tools support skins qmlexport
|
||||||
|
tests.depends = support
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
TEMPLATE=subdirs
|
||||||
|
SUBDIRS=\
|
||||||
|
qskcolorfilter \
|
|
@ -0,0 +1,4 @@
|
||||||
|
CONFIG += qskautotest
|
||||||
|
|
||||||
|
TARGET = testQskColorFilter
|
||||||
|
SOURCES += testQskColorFilter.cpp
|
|
@ -0,0 +1,33 @@
|
||||||
|
#include <QskColorFilter.h>
|
||||||
|
|
||||||
|
#include <QBrush>
|
||||||
|
#include <QTest>
|
||||||
|
|
||||||
|
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"
|
|
@ -0,0 +1,3 @@
|
||||||
|
TEMPLATE=subdirs
|
||||||
|
SUBDIRS=\
|
||||||
|
graphic \
|
Loading…
Reference in New Issue