diff options
Diffstat (limited to 'tests/auto/widgets/styles')
6 files changed, 272 insertions, 104 deletions
diff --git a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp index 51a6fa64d7..fbd1505b30 100644 --- a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp +++ b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index b4546aa760..50445b9a45 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qstyle -TARGET.EPOCHEAPSIZE = 0x200000 0x800000 QT += widgets testlib SOURCES += tst_qstyle.cpp @@ -11,7 +9,7 @@ wince* { DEPLOYMENT += addPixmap } -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index 361a7e7ed4..5c213fea04 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -92,17 +87,15 @@ class tst_QStyle : public QObject Q_OBJECT public: tst_QStyle(); - virtual ~tst_QStyle(); + private: bool testAllFunctions(QStyle *); bool testScrollBarSubControls(QStyle *); void testPainting(QStyle *style, const QString &platform); private slots: void drawItemPixmap(); - void initTestCase(); - void cleanup(); - void cleanupTestCase(); void init(); + void cleanup(); #ifndef QT_NO_STYLE_FUSION void testFusionStyle(); #endif @@ -145,10 +138,6 @@ tst_QStyle::tst_QStyle() testWidget = 0; } -tst_QStyle::~tst_QStyle() -{ -} - class MyWidget : public QWidget { public: @@ -168,14 +157,6 @@ void tst_QStyle::cleanup() testWidget = 0; } -void tst_QStyle::initTestCase() -{ -} - -void tst_QStyle::cleanupTestCase() -{ -} - void tst_QStyle::testStyleFactory() { QStringList keys = QStyleFactory::keys(); diff --git a/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro b/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro index 2ca24c4f43..bf12a6b30f 100644 --- a/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro +++ b/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro @@ -2,7 +2,6 @@ TEMPLATE = app TARGET = tst_qstyleoption CONFIG += testcase -CONFIG += parallel_test QT += widgets testlib SOURCES += tst_qstyleoption.cpp diff --git a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp index 2e26ba609b..883336b28f 100644 --- a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp +++ b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 5da11e38ca..a506bbb114 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -55,6 +50,7 @@ public: ~tst_QStyleSheetStyle(); private slots: + void init(); void repolish(); void numinstances(); void widgetsBeforeAppStyleSheet(); @@ -71,8 +67,12 @@ private slots: void layoutSpacing(); #endif void qproperty(); + void palettePropagation_data(); void palettePropagation(); + void fontPropagation_data(); void fontPropagation(); + void widgetStylePropagation_data(); + void widgetStylePropagation(); void onWidgetDestroyed(); void fontPrecedence(); void focusColors(); @@ -137,6 +137,12 @@ tst_QStyleSheetStyle::~tst_QStyleSheetStyle() { } +void tst_QStyleSheetStyle::init() +{ + qApp->setStyleSheet(QString()); + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, false); +} + void tst_QStyleSheetStyle::numinstances() { QWidget w; @@ -627,31 +633,80 @@ void tst_QStyleSheetStyle::namespaces() QCOMPARE(BACKGROUND(pb2), red); } +void tst_QStyleSheetStyle::palettePropagation_data() +{ + QTest::addColumn<QString>("applicationStyleSheet"); + QTest::addColumn<bool>("widgetStylePropagation"); + QTest::newRow("Widget style propagation") << " " << true; + QTest::newRow("Widget style propagation, no application style sheet") << QString() << true; + QTest::newRow("Default propagation") << " " << false; + QTest::newRow("Default propagation, no application style sheet") << QString() << false; +} + void tst_QStyleSheetStyle::palettePropagation() { - qApp->setStyleSheet(""); + QFETCH(QString, applicationStyleSheet); + QFETCH(bool, widgetStylePropagation); + + qApp->setStyleSheet(applicationStyleSheet); + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, widgetStylePropagation); + QGroupBox gb; - QPushButton *push = new QPushButton(&gb); - QPushButton &pb = *push; - push->setText("AsdF"); + QLabel *label = new QLabel(&gb); + QLabel &lb = *label; + label->setText("AsdF"); gb.setStyleSheet("QGroupBox { color: red }"); - QVERIFY(COLOR(gb) == Qt::red); - QVERIFY(COLOR(pb) == APPCOLOR(pb)); // palette shouldn't propagate - gb.setStyleSheet("QGroupBox * { color: red }"); + QCOMPARE(COLOR(gb), QColor(Qt::red)); - QVERIFY(COLOR(pb) == Qt::red); - QVERIFY(COLOR(gb) == APPCOLOR(gb)); + if (widgetStylePropagation) { + QCOMPARE(COLOR(lb), QColor(Qt::red)); // palette should propagate in standard mode + } else { + QCOMPARE(COLOR(lb), APPCOLOR(lb)); // palette shouldn't propagate + } QWidget window; + lb.setParent(&window); + if (widgetStylePropagation) { + // In standard propagation mode, widgets that are not explicitly + // targeted do not have their propagated palette unset when they are + // unpolished by changing parents. This is consistent with regular Qt + // widgets, who also maintain their propagated palette when changing + // parents + QCOMPARE(COLOR(lb), QColor(Qt::red)); + } else { + QCOMPARE(COLOR(lb), APPCOLOR(lb)); + } + lb.setParent(&gb); + + gb.setStyleSheet("QGroupBox * { color: red }"); + + QCOMPARE(COLOR(lb), QColor(Qt::red)); + QCOMPARE(COLOR(gb), APPCOLOR(gb)); + window.setStyleSheet("* { color: white; }"); - pb.setParent(&window); - QVERIFY(COLOR(pb) == Qt::white); + lb.setParent(&window); + QCOMPARE(COLOR(lb), QColor(Qt::white)); +} + +void tst_QStyleSheetStyle::fontPropagation_data() +{ + QTest::addColumn<QString>("applicationStyleSheet"); + QTest::addColumn<bool>("widgetStylePropagation"); + QTest::newRow("Widget style propagation") << " " << true; + QTest::newRow("Widget style propagation, no application style sheet") << QString() << true; + QTest::newRow("Default propagation") << " " << false; + QTest::newRow("Default propagation, no application style sheet") << QString() << false; } void tst_QStyleSheetStyle::fontPropagation() { - qApp->setStyleSheet(""); + QFETCH(QString, applicationStyleSheet); + QFETCH(bool, widgetStylePropagation); + + qApp->setStyleSheet(applicationStyleSheet); + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, widgetStylePropagation); + QComboBox cb; cb.addItem("item1"); cb.addItem("item2"); @@ -661,7 +716,11 @@ void tst_QStyleSheetStyle::fontPropagation() cb.setStyleSheet("QComboBox { font-size: 20pt; }"); QCOMPARE(FONTSIZE(cb), 20); - QCOMPARE(FONTSIZE(*popup), viewFontSize); + if (widgetStylePropagation) { + QCOMPARE(FONTSIZE(*popup), 20); + } else { + QCOMPARE(FONTSIZE(*popup), viewFontSize); + } QGroupBox gb; QPushButton *push = new QPushButton(&gb); QPushButton &pb = *push; @@ -670,7 +729,11 @@ void tst_QStyleSheetStyle::fontPropagation() gb.setStyleSheet("QGroupBox { font-size: 20pt }"); QCOMPARE(FONTSIZE(gb), 20); - QVERIFY(FONTSIZE(pb) == buttonFontSize); // font does not propagate + if (widgetStylePropagation) { + QCOMPARE(FONTSIZE(pb), 20); + } else { + QCOMPARE(FONTSIZE(pb), buttonFontSize); // font does not propagate + } gb.setStyleSheet("QGroupBox * { font-size: 20pt; }"); QCOMPARE(FONTSIZE(gb), gbFontSize); QCOMPARE(FONTSIZE(pb), 20); @@ -1471,12 +1534,14 @@ void tst_QStyleSheetStyle::embeddedFonts() QCOMPARE(spin.font().pixelSize(), 32); QCOMPARE(embedded->font().pixelSize(), 32); +#ifndef QT_NO_CONTEXTMENU QMenu *menu = embedded->createStandardContextMenu(); menu->show(); QTest::qWait(20); QVERIFY(menu); QVERIFY(menu->font().pixelSize() != 32); QCOMPARE(menu->font().pixelSize(), qApp->font(menu).pixelSize()); +#endif // QT_NO_CONTEXTMENU //task 242556 QComboBox box; @@ -1744,8 +1809,11 @@ void tst_QStyleSheetStyle::QTBUG36933_brokenPseudoClassLookup() QTableWidget widget(rowCount, columnCount); for (int row = 0; row < rowCount; ++row) { - for (int column = 0; column < columnCount; ++column) - widget.setItem(row, column, new QTableWidgetItem(QStringLiteral("row %1 column %2").arg(row + 1).arg(column + 1))); + for (int column = 0; column < columnCount; ++column) { + const QString t = QLatin1String("row ") + QString::number(row + 1) + + QLatin1String(" column ") + QString::number(column + 1); + widget.setItem(row, column, new QTableWidgetItem(t)); + } // put no visible text for the vertical headers, but still put some text or they will collapse widget.setVerticalHeaderItem(row, new QTableWidgetItem(QStringLiteral(" "))); @@ -1794,6 +1862,138 @@ void tst_QStyleSheetStyle::styleSheetChangeBeforePolish() QVERIFY(testForColors(image2, QColor(0x00, 0xFF, 0x00))); } +void tst_QStyleSheetStyle::widgetStylePropagation_data() +{ + QTest::addColumn<QString>("applicationStyleSheet"); + QTest::addColumn<QString>("parentStyleSheet"); + QTest::addColumn<QString>("childStyleSheet"); + QTest::addColumn<QFont>("parentFont"); + QTest::addColumn<QFont>("childFont"); + QTest::addColumn<QPalette>("parentPalette"); + QTest::addColumn<QPalette>("childPalette"); + QTest::addColumn<int>("parentExpectedSize"); + QTest::addColumn<int>("childExpectedSize"); + QTest::addColumn<QColor>("parentExpectedColor"); + QTest::addColumn<QColor>("childExpectedColor"); + + QFont noFont; + QFont font45; font45.setPointSize(45); + QFont font32; font32.setPointSize(32); + + QPalette noPalette; + QPalette redPalette; redPalette.setColor(QPalette::WindowText, QColor("red")); + QPalette greenPalette; greenPalette.setColor(QPalette::WindowText, QColor("green")); + + QLabel defaultLabel; + + int defaultSize = defaultLabel.font().pointSize(); + QColor defaultColor = defaultLabel.palette().color(defaultLabel.foregroundRole()); + QColor redColor("red"); + QColor greenColor("green"); + + // Check regular Qt propagation works as expected, with and without a + // non-interfering application stylesheet + QTest::newRow("defaults") + << QString() << QString() << QString() + << noFont << noFont << noPalette << noPalette + << defaultSize << defaultSize << defaultColor << defaultColor; + QTest::newRow("parent font propagation, no application style sheet") + << QString() << QString() << QString() + << font45 << noFont << noPalette << noPalette + << 45 << 45 << defaultColor << defaultColor; + QTest::newRow("parent font propagation, dummy application style sheet") + << "QGroupBox { font-size: 64pt }" << QString() << QString() + << font45 << noFont << noPalette << noPalette + << 45 << 45 << defaultColor << defaultColor; + QTest::newRow("parent color propagation, no application style sheet") + << QString() << QString() << QString() + << noFont << noFont << redPalette << noPalette + << defaultSize << defaultSize << redColor << redColor; + QTest::newRow("parent color propagation, dummy application style sheet") + << "QGroupBox { color: blue }" << QString() << QString() + << noFont << noFont << redPalette << noPalette + << defaultSize << defaultSize << redColor << redColor; + + // Parent style sheet propagates to child if child has not explicitly + // set a value + QTest::newRow("parent style sheet color propagation") + << "#parentLabel { color: red }" << QString() << QString() + << noFont << noFont << noPalette << noPalette + << defaultSize << defaultSize << redColor << redColor; + QTest::newRow("parent style sheet font propagation") + << "#parentLabel { font-size: 45pt }" << QString() << QString() + << noFont << noFont << noPalette << noPalette + << 45 << 45 << defaultColor << defaultColor; + + // Parent style sheet does not propagate to child if child has explicitly + // set a value + QTest::newRow("parent style sheet color propagation, child explicitly set") + << "#parentLabel { color: red }" << QString() << QString() + << noFont << noFont << noPalette << greenPalette + << defaultSize << defaultSize << redColor << greenColor; + QTest::newRow("parent style sheet font propagation, child explicitly set") + << "#parentLabel { font-size: 45pt }" << QString() << QString() + << noFont << font32 << noPalette << noPalette + << 45 << 32 << defaultColor << defaultColor; + + // Parent does not propagate to child when child is target of style sheet + QTest::newRow("parent style sheet font propagation, child application style sheet") + << "#childLabel { font-size: 32pt }" << QString() << QString() + << font45 << noFont << noPalette << noPalette + << 45 << 32 << defaultColor << defaultColor; + QTest::newRow("parent style sheet color propagation, child application style sheet") + << "#childLabel { color: green }" << QString() << QString() + << noFont << noFont << redPalette << noPalette + << defaultSize << defaultSize << redColor << greenColor; +} + +void tst_QStyleSheetStyle::widgetStylePropagation() +{ + QFETCH(QString, applicationStyleSheet); + QFETCH(QString, parentStyleSheet); + QFETCH(QString, childStyleSheet); + + QFETCH(QFont, parentFont); + QFETCH(QFont, childFont); + QFETCH(QPalette, parentPalette); + QFETCH(QPalette, childPalette); + + QFETCH(int, parentExpectedSize); + QFETCH(int, childExpectedSize); + QFETCH(QColor, parentExpectedColor); + QFETCH(QColor, childExpectedColor); + + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, true); + + qApp->setStyleSheet(applicationStyleSheet); + + QLabel parentLabel; + parentLabel.setObjectName("parentLabel"); + QLabel childLabel(&parentLabel); + childLabel.setObjectName("childLabel"); + + if (parentFont.resolve()) + parentLabel.setFont(parentFont); + if (childFont.resolve()) + childLabel.setFont(childFont); + if (parentPalette.resolve()) + parentLabel.setPalette(parentPalette); + if (childPalette.resolve()) + childLabel.setPalette(childPalette); + if (!parentStyleSheet.isEmpty()) + parentLabel.setStyleSheet(parentStyleSheet); + if (!childStyleSheet.isEmpty()) + childLabel.setStyleSheet(childStyleSheet); + + parentLabel.ensurePolished(); + childLabel.ensurePolished(); + + QCOMPARE(FONTSIZE(parentLabel), parentExpectedSize); + QCOMPARE(FONTSIZE(childLabel), childExpectedSize); + QCOMPARE(COLOR(parentLabel), parentExpectedColor); + QCOMPARE(COLOR(childLabel), childExpectedColor); +} + QTEST_MAIN(tst_QStyleSheetStyle) #include "tst_qstylesheetstyle.moc" |