diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-22 09:04:29 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-22 09:25:54 +0200 |
commit | aed5a7168354c6ae47687d20b4bd3f0adcc14f8e (patch) | |
tree | d2060479a7c12fdba8c1955e5d363754feffabb8 /tests/auto | |
parent | d3d10cf23d61f4a011f1a7e9abdee1a92717e80f (diff) | |
parent | 628fa13ea4d6ff0e2e2ee76c9adfc78676de3c59 (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
src/corelib/statemachine/qstatemachine.cpp
src/corelib/statemachine/qstatemachine_p.h
src/gui/painting/qdrawhelper.cpp
src/plugins/platforms/xcb/qxcbnativeinterface.cpp
src/plugins/platforms/xcb/qxcbwindow.cpp
src/plugins/platforms/xcb/qxcbwindow.h
src/testlib/qtestblacklist.cpp
src/tools/qdoc/node.cpp
src/tools/qdoc/node.h
tests/auto/gui/painting/qcolor/tst_qcolor.cpp
Change-Id: I6c78b7b162001712d5774293f501b06b4ff32684
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/io/qdir/tst_qdir.cpp | 41 | ||||
-rw-r--r-- | tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 48 | ||||
-rw-r--r-- | tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp | 186 | ||||
-rw-r--r-- | tests/auto/gui/image/qimage/tst_qimage.cpp | 103 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp | 17 | ||||
-rw-r--r-- | tests/auto/gui/painting/qcolor/tst_qcolor.cpp | 19 | ||||
-rw-r--r-- | tests/auto/gui/qopenglconfig/buglist.json | 8 | ||||
-rw-r--r-- | tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp | 38 | ||||
-rw-r--r-- | tests/auto/other/headersclean/headersclean.pro | 3 | ||||
-rw-r--r-- | tests/auto/other/macnativeevents/BLACKLIST | 11 | ||||
-rw-r--r-- | tests/auto/other/macnativeevents/macnativeevents.pro | 1 | ||||
-rw-r--r-- | tests/auto/other/other.pro | 5 | ||||
-rw-r--r-- | tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp | 7 |
13 files changed, 388 insertions, 99 deletions
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index caa22db144..e8a7105f6e 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -90,6 +90,8 @@ private slots: void entryList_data(); void entryList(); + void entryListTimedSort(); + void entryListSimple_data(); void entryListSimple(); @@ -831,6 +833,45 @@ void tst_QDir::entryList() QFile::remove(entrylistPath + "brokenlink"); } +void tst_QDir::entryListTimedSort() +{ +#ifndef QT_NO_PROCESS + const QString touchBinary = "/bin/touch"; + if (!QFile::exists(touchBinary)) + QSKIP("/bin/touch not found"); + + const QString entrylistPath = m_dataPath + "/entrylist/"; + QTemporaryFile aFile(entrylistPath + "A-XXXXXX.qws"); + QTemporaryFile bFile(entrylistPath + "B-XXXXXX.qws"); + + QVERIFY(aFile.open()); + QVERIFY(bFile.open()); + { + QProcess p; + p.start(touchBinary, QStringList() << "-t" << "201306021513" << aFile.fileName()); + QVERIFY(p.waitForFinished(1000)); + } + { + QProcess p; + p.start(touchBinary, QStringList() << "-t" << "201504131513" << bFile.fileName()); + QVERIFY(p.waitForFinished(1000)); + } + + QStringList actual = QDir(entrylistPath).entryList(QStringList() << "*.qws", QDir::NoFilter, + QDir::Time); + + QFileInfo aFileInfo(aFile); + QFileInfo bFileInfo(bFile); + QVERIFY(bFileInfo.lastModified().msecsTo(aFileInfo.lastModified()) < 0); + + QCOMPARE(actual.size(), 2); + QCOMPARE(actual.first(), bFileInfo.fileName()); + QCOMPARE(actual.last(), aFileInfo.fileName()); +#else + QSKIP("This test requires QProcess support."); +#endif // QT_NO_PROCESS +} + void tst_QDir::entryListSimple_data() { QTest::addColumn<QString>("dirName"); diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 88b1bebb29..b3333c6d68 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1254,6 +1254,54 @@ void tst_QMetaType::registerType() QCOMPARE(qRegisterMetaType<MyFoo>("MyFoo"), fooId); QCOMPARE(QMetaType::type("MyFoo"), fooId); + + // cannot unregister built-in types + QVERIFY(!QMetaType::unregisterType(QMetaType::QString)); + QCOMPARE(QMetaType::type("QString"), int(QMetaType::QString)); + QCOMPARE(QMetaType::type("MyString"), int(QMetaType::QString)); + + // cannot unregister declared types + QVERIFY(!QMetaType::unregisterType(fooId)); + QCOMPARE(QMetaType::type("TestSpace::Foo"), fooId); + QCOMPARE(QMetaType::type("MyFoo"), fooId); + + // test unregistration of dynamic types (used by Qml) + int unregId = QMetaType::registerType("UnregisterMe", + 0, + 0, + QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct, + QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, + 0, QMetaType::TypeFlags(), 0); + QCOMPARE(QMetaType::registerTypedef("UnregisterMeTypedef", unregId), unregId); + int unregId2 = QMetaType::registerType("UnregisterMe2", + 0, + 0, + QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct, + QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, + 0, QMetaType::TypeFlags(), 0); + QVERIFY(unregId >= int(QMetaType::User)); + QCOMPARE(unregId2, unregId + 2); + + QVERIFY(QMetaType::unregisterType(unregId)); + QCOMPARE(QMetaType::type("UnregisterMe"), 0); + QCOMPARE(QMetaType::type("UnregisterMeTypedef"), 0); + QCOMPARE(QMetaType::type("UnregisterMe2"), unregId2); + QVERIFY(QMetaType::unregisterType(unregId2)); + QCOMPARE(QMetaType::type("UnregisterMe2"), 0); + + // re-registering should always return the lowest free index + QCOMPARE(QMetaType::registerType("UnregisterMe2", + 0, + 0, + QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct, + QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, + 0, QMetaType::TypeFlags(), 0), unregId); + QCOMPARE(QMetaType::registerType("UnregisterMe", + 0, + 0, + QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct, + QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct, + 0, QMetaType::TypeFlags(), 0), unregId + 1); } class IsRegisteredDummyType { }; diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index 6e51f8f0ed..96d0a62f6b 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -244,6 +244,9 @@ private slots: void signalTransitionSenderInDifferentThread2(); void signalTransitionRegistrationThreadSafety(); void childModeConstructor(); + + void qtbug_44963(); + void qtbug_44783(); }; class TestState : public QState @@ -908,8 +911,11 @@ void tst_QStateMachine::historyStateHasNowhereToGo() QStateMachine machine; QState *initialState = new QState(&machine); + initialState->setObjectName("initialState"); machine.setInitialState(initialState); - machine.setErrorState(new QState(&machine)); // avoid warnings + QState *errorState = new QState(&machine); + errorState->setObjectName("errorState"); + machine.setErrorState(errorState); // avoid warnings QState *brokenState = new QState(&machine); brokenState->setObjectName("brokenState"); @@ -917,7 +923,9 @@ void tst_QStateMachine::historyStateHasNowhereToGo() QHistoryState *historyState = new QHistoryState(brokenState); historyState->setObjectName("historyState"); - initialState->addTransition(new EventTransition(QEvent::User, historyState)); + EventTransition *t = new EventTransition(QEvent::User, historyState); + t->setObjectName("initialState->historyState"); + initialState->addTransition(t); machine.start(); QCoreApplication::processEvents(); @@ -4272,6 +4280,11 @@ void tst_QStateMachine::transitionsFromParallelStateWithNoChildren() void tst_QStateMachine::parallelStateTransition() { + // This test checks if the parallel state is exited and re-entered if one compound state + // is exited and subsequently re-entered. When the parallel state is exited, the other compound + // state in the parallel state has to be exited too. When the parallel state is re-entered, the + // other state also needs to be re-entered. + QStateMachine machine; QState *parallelState = new QState(QState::ParallelStates, &machine); @@ -4300,12 +4313,16 @@ void tst_QStateMachine::parallelStateTransition() s1OtherChild->setObjectName("s1OtherChild"); DEFINE_ACTIVE_SPY(s1OtherChild); + // The following transition will exit s1 (which means that parallelState is also exited), and + // subsequently re-entered (which means that parallelState is also re-entered). EventTransition *et = new EventTransition(QEvent::User, s1OtherChild); et->setObjectName("s1->s1OtherChild"); s1->addTransition(et); machine.start(); QCoreApplication::processEvents(); + + // Initial entrance of the parallel state and its sub-states: TEST_ACTIVE_CHANGED(parallelState, 1); TEST_ACTIVE_CHANGED(s1, 1); TEST_ACTIVE_CHANGED(s1InitialChild, 1); @@ -4323,22 +4340,22 @@ void tst_QStateMachine::parallelStateTransition() machine.postEvent(new QEvent(QEvent::User)); QCoreApplication::processEvents(); - TEST_ACTIVE_CHANGED(parallelState, 1); - TEST_ACTIVE_CHANGED(s1, 3); - TEST_ACTIVE_CHANGED(s1InitialChild, 2); - TEST_ACTIVE_CHANGED(s2, 3); - TEST_ACTIVE_CHANGED(s2InitialChild, 3); - TEST_ACTIVE_CHANGED(s1OtherChild, 1); + TEST_ACTIVE_CHANGED(parallelState, 3); // initial + exit + entry + TEST_ACTIVE_CHANGED(s1, 3); // initial + exit + entry + TEST_ACTIVE_CHANGED(s1InitialChild, 2); // initial + exit + TEST_ACTIVE_CHANGED(s2, 3); // initial + exit due to parent exit + entry due to parent re-entry + TEST_ACTIVE_CHANGED(s2InitialChild, 3); // initial + exit due to parent exit + re-entry due to parent re-entry + TEST_ACTIVE_CHANGED(s1OtherChild, 1); // entry due to transition QVERIFY(machine.isRunning()); + // Check that s1InitialChild is not in the configuration, because although s1 is re-entered, + // another child state (s1OtherChild) is active, so the initial child should not be activated. QVERIFY(machine.configuration().contains(parallelState)); - QVERIFY(machine.configuration().contains(s1)); QVERIFY(machine.configuration().contains(s2)); QVERIFY(machine.configuration().contains(s1OtherChild)); QVERIFY(machine.configuration().contains(s2InitialChild)); QCOMPARE(machine.configuration().size(), 5); - } void tst_QStateMachine::nestedRestoreProperties() @@ -6169,5 +6186,154 @@ void tst_QStateMachine::childModeConstructor() } } +void tst_QStateMachine::qtbug_44963() +{ + SignalEmitter emitter; + + QStateMachine machine; + QState a(QState::ParallelStates, &machine); + QHistoryState ha(QHistoryState::DeepHistory, &a); + QState b(QState::ParallelStates, &a); + QState c(QState::ParallelStates, &b); + QState d(QState::ParallelStates, &c); + QState e(QState::ParallelStates, &d); + QState i(&e); + QState i1(&i); + QState i2(&i); + QState j(&e); + QState h(&d); + QState g(&c); + QState k(&a); + QState l(&machine); + + machine.setInitialState(&a); + ha.setDefaultState(&b); + i.setInitialState(&i1); + i1.addTransition(&emitter, SIGNAL(signalWithIntArg(int)), &i2)->setObjectName("i1->i2"); + i2.addTransition(&emitter, SIGNAL(signalWithDefaultArg(int)), &l)->setObjectName("i2->l"); + l.addTransition(&emitter, SIGNAL(signalWithNoArg()), &ha)->setObjectName("l->ha"); + + a.setObjectName("a"); + ha.setObjectName("ha"); + b.setObjectName("b"); + c.setObjectName("c"); + d.setObjectName("d"); + e.setObjectName("e"); + i.setObjectName("i"); + i1.setObjectName("i1"); + i2.setObjectName("i2"); + j.setObjectName("j"); + h.setObjectName("h"); + g.setObjectName("g"); + k.setObjectName("k"); + l.setObjectName("l"); + + machine.start(); + + QTRY_COMPARE(machine.configuration().contains(&i1), true); + QTRY_COMPARE(machine.configuration().contains(&i2), false); + QTRY_COMPARE(machine.configuration().contains(&j), true); + QTRY_COMPARE(machine.configuration().contains(&h), true); + QTRY_COMPARE(machine.configuration().contains(&g), true); + QTRY_COMPARE(machine.configuration().contains(&k), true); + QTRY_COMPARE(machine.configuration().contains(&l), false); + + emitter.emitSignalWithIntArg(0); + + QTRY_COMPARE(machine.configuration().contains(&i1), false); + QTRY_COMPARE(machine.configuration().contains(&i2), true); + QTRY_COMPARE(machine.configuration().contains(&j), true); + QTRY_COMPARE(machine.configuration().contains(&h), true); + QTRY_COMPARE(machine.configuration().contains(&g), true); + QTRY_COMPARE(machine.configuration().contains(&k), true); + QTRY_COMPARE(machine.configuration().contains(&l), false); + + emitter.emitSignalWithDefaultArg(); + + QTRY_COMPARE(machine.configuration().contains(&i1), false); + QTRY_COMPARE(machine.configuration().contains(&i2), false); + QTRY_COMPARE(machine.configuration().contains(&j), false); + QTRY_COMPARE(machine.configuration().contains(&h), false); + QTRY_COMPARE(machine.configuration().contains(&g), false); + QTRY_COMPARE(machine.configuration().contains(&k), false); + QTRY_COMPARE(machine.configuration().contains(&l), true); + + emitter.emitSignalWithNoArg(); + + QTRY_COMPARE(machine.configuration().contains(&i1), false); + QTRY_COMPARE(machine.configuration().contains(&i2), true); + QTRY_COMPARE(machine.configuration().contains(&j), true); + QTRY_COMPARE(machine.configuration().contains(&h), true); + QTRY_COMPARE(machine.configuration().contains(&g), true); + QTRY_COMPARE(machine.configuration().contains(&k), true); + QTRY_COMPARE(machine.configuration().contains(&l), false); + + QVERIFY(machine.isRunning()); +} + +void tst_QStateMachine::qtbug_44783() +{ + SignalEmitter emitter; + + QStateMachine machine; + QState s(&machine); + QState p(QState::ParallelStates, &s); + QState p1(&p); + QState p1_1(&p1); + QState p1_2(&p1); + QState p2(&p); + QState s1(&machine); + + machine.setInitialState(&s); + s.setInitialState(&p); + p1.setInitialState(&p1_1); + p1_1.addTransition(&emitter, SIGNAL(signalWithNoArg()), &p1_2)->setObjectName("p1_1->p1_2"); + p2.addTransition(&emitter, SIGNAL(signalWithNoArg()), &s1)->setObjectName("p2->s1"); + + s.setObjectName("s"); + p.setObjectName("p"); + p1.setObjectName("p1"); + p1_1.setObjectName("p1_1"); + p1_2.setObjectName("p1_2"); + p2.setObjectName("p2"); + s1.setObjectName("s1"); + + machine.start(); + + QTRY_COMPARE(machine.configuration().contains(&s), true); + QTRY_COMPARE(machine.configuration().contains(&p), true); + QTRY_COMPARE(machine.configuration().contains(&p1), true); + QTRY_COMPARE(machine.configuration().contains(&p1_1), true); + QTRY_COMPARE(machine.configuration().contains(&p1_2), false); + QTRY_COMPARE(machine.configuration().contains(&p2), true); + QTRY_COMPARE(machine.configuration().contains(&s1), false); + + emitter.emitSignalWithNoArg(); + + // Only one of the following two can be true, because the two possible transitions conflict. + if (machine.configuration().contains(&s1)) { + // the transition p2 -> s1 was taken, not p1_1 -> p1_2, so: + // the parallel state exited, so none of the states inside it are active + QTRY_COMPARE(machine.configuration().contains(&s), false); + QTRY_COMPARE(machine.configuration().contains(&p), false); + QTRY_COMPARE(machine.configuration().contains(&p1), false); + QTRY_COMPARE(machine.configuration().contains(&p1_1), false); + QTRY_COMPARE(machine.configuration().contains(&p1_2), false); + QTRY_COMPARE(machine.configuration().contains(&p2), false); + } else { + // the transition p1_1 -> p1_2 was taken, not p2 -> s1, so: + // the parallel state was not exited and the state is the same as the start state with one + // difference: p1_1 inactive and p1_2 active: + QTRY_COMPARE(machine.configuration().contains(&s), true); + QTRY_COMPARE(machine.configuration().contains(&p), true); + QTRY_COMPARE(machine.configuration().contains(&p1), true); + QTRY_COMPARE(machine.configuration().contains(&p1_1), false); + QTRY_COMPARE(machine.configuration().contains(&p1_2), true); + QTRY_COMPARE(machine.configuration().contains(&p2), true); + } + + QVERIFY(machine.isRunning()); +} + QTEST_MAIN(tst_QStateMachine) #include "tst_qstatemachine.moc" diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 660809fb16..525d5b33a0 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -108,6 +108,7 @@ private slots: void cacheKey(); void smoothScale(); + void smoothScale2_data(); void smoothScale2(); void smoothScale3(); @@ -1539,58 +1540,68 @@ void tst_QImage::smoothScale() } // test area sampling -void tst_QImage::smoothScale2() +void tst_QImage::smoothScale2_data() { - int sizes[] = { 2, 4, 8, 10, 16, 20, 32, 40, 64, 100, 101, 128, 0 }; - QImage::Format formats[] = { QImage::Format_ARGB32, QImage::Format_RGB32, QImage::Format_Invalid }; - for (int i = 0; sizes[i] != 0; ++i) { - for (int j = 0; formats[j] != QImage::Format_Invalid; ++j) { - int size = sizes[i]; - - QRgb expected = formats[j] == QImage::Format_ARGB32 ? qRgba(63, 127, 255, 255) : qRgb(63, 127, 255); - - QImage img(size, size, formats[j]); - img.fill(expected); + QTest::addColumn<int>("format"); + QTest::addColumn<int>("size"); + + int sizes[] = { 2, 3, 4, 6, 7, 8, 10, 16, 20, 32, 40, 64, 100, 101, 128, 0 }; + QImage::Format formats[] = { QImage::Format_RGB32, QImage::Format_ARGB32_Premultiplied, QImage::Format_Invalid }; + for (int j = 0; formats[j] != QImage::Format_Invalid; ++j) { + QString formatstr = formats[j] == QImage::Format_RGB32 ? QStringLiteral("rgb32") : QStringLiteral("argb32pm"); + for (int i = 0; sizes[i] != 0; ++i) { + QTest::newRow(QString("%1 %2x%2").arg(formatstr).arg(sizes[i]).toUtf8()) << (int)formats[j] << sizes[i]; + } + } +} - // scale x down, y down - QImage scaled = img.scaled(QSize(1, 1), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - QRgb pixel = scaled.pixel(0, 0); +void tst_QImage::smoothScale2() +{ + QFETCH(int, format); + QFETCH(int, size); + + QRgb expected = format == QImage::Format_RGB32 ? qRgb(63, 127, 255) : qRgba(31, 63, 127, 127); + + QImage img(size, size, (QImage::Format)format); + img.fill(expected); + + // scale x down, y down + QImage scaled = img.scaled(QSize(1, 1), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + QRgb pixel = scaled.pixel(0, 0); + QCOMPARE(qAlpha(pixel), qAlpha(expected)); + QCOMPARE(qRed(pixel), qRed(expected)); + QCOMPARE(qGreen(pixel), qGreen(expected)); + QCOMPARE(qBlue(pixel), qBlue(expected)); + + // scale x down, y up + scaled = img.scaled(QSize(1, size * 2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + for (int y = 0; y < scaled.height(); ++y) { + pixel = scaled.pixel(0, y); + QCOMPARE(qAlpha(pixel), qAlpha(expected)); + QCOMPARE(qRed(pixel), qRed(expected)); + QCOMPARE(qGreen(pixel), qGreen(expected)); + QCOMPARE(qBlue(pixel), qBlue(expected)); + } + + // scale x up, y down + scaled = img.scaled(QSize(size * 2, 1), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + for (int x = 0; x < scaled.width(); ++x) { + pixel = scaled.pixel(x, 0); + QCOMPARE(qAlpha(pixel), qAlpha(expected)); + QCOMPARE(qRed(pixel), qRed(expected)); + QCOMPARE(qGreen(pixel), qGreen(expected)); + QCOMPARE(qBlue(pixel), qBlue(expected)); + } + + // scale x up, y up + scaled = img.scaled(QSize(size * 2, size * 2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + for (int y = 0; y < scaled.height(); ++y) { + for (int x = 0; x < scaled.width(); ++x) { + pixel = scaled.pixel(x, y); QCOMPARE(qAlpha(pixel), qAlpha(expected)); QCOMPARE(qRed(pixel), qRed(expected)); QCOMPARE(qGreen(pixel), qGreen(expected)); QCOMPARE(qBlue(pixel), qBlue(expected)); - - // scale x down, y up - scaled = img.scaled(QSize(1, size * 2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - for (int y = 0; y < scaled.height(); ++y) { - pixel = scaled.pixel(0, y); - QCOMPARE(qAlpha(pixel), qAlpha(expected)); - QCOMPARE(qRed(pixel), qRed(expected)); - QCOMPARE(qGreen(pixel), qGreen(expected)); - QCOMPARE(qBlue(pixel), qBlue(expected)); - } - - // scale x up, y down - scaled = img.scaled(QSize(size * 2, 1), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - for (int x = 0; x < scaled.width(); ++x) { - pixel = scaled.pixel(x, 0); - QCOMPARE(qAlpha(pixel), qAlpha(expected)); - QCOMPARE(qRed(pixel), qRed(expected)); - QCOMPARE(qGreen(pixel), qGreen(expected)); - QCOMPARE(qBlue(pixel), qBlue(expected)); - } - - // scale x up, y up - scaled = img.scaled(QSize(size * 2, size * 2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - for (int y = 0; y < scaled.height(); ++y) { - for (int x = 0; x < scaled.width(); ++x) { - pixel = scaled.pixel(x, y); - QCOMPARE(qAlpha(pixel), qAlpha(expected)); - QCOMPARE(qRed(pixel), qRed(expected)); - QCOMPARE(qGreen(pixel), qGreen(expected)); - QCOMPARE(qBlue(pixel), qBlue(expected)); - } - } } } } diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index b921e1519f..19365bffdd 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -76,6 +76,7 @@ private slots: void genericPluginsAndWindowSystemEvents(); void layoutDirection(); void globalShareContext(); + void testSetPaletteAttribute(); void staticFunctions(); @@ -968,6 +969,22 @@ void tst_QGuiApplication::globalShareContext() #endif } +void tst_QGuiApplication::testSetPaletteAttribute() +{ + QCoreApplication::setAttribute(Qt::AA_SetPalette, false); + int argc = 1; + char *argv[] = { const_cast<char*>("tst_qguiapplication") }; + + QGuiApplication app(argc, argv); + + QVERIFY(!QCoreApplication::testAttribute(Qt::AA_SetPalette)); + QPalette palette; + palette.setColor(QPalette::Foreground, Qt::red); + QGuiApplication::setPalette(palette); + + QVERIFY(QCoreApplication::testAttribute(Qt::AA_SetPalette)); +} + // Test that static functions do not crash if there is no application instance. void tst_QGuiApplication::staticFunctions() { diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 7d17794c0b..ca9f6cb9f4 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -39,7 +39,6 @@ #include <qcolor.h> #include <qdebug.h> #include <qrgba64.h> -#include <private/qdrawingprimitive_sse2_p.h> class tst_QColor : public QObject { @@ -105,7 +104,6 @@ private slots: void achromaticHslHue(); void premultiply(); - void unpremultiply_sse4(); void qrgba64(); void qrgba64Premultiply(); void qrgba64Equivalence(); @@ -1451,23 +1449,6 @@ void tst_QColor::premultiply() } } -void tst_QColor::unpremultiply_sse4() -{ - // Tests that qUnpremultiply_sse4 returns the same as qUnpremultiply. -#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) - if (qCpuHasFeature(SSE4_1)) { - for (uint a = 0; a < 256; a++) { - for (uint c = 0; c <= a; c++) { - QRgb p = qRgba(c, a-c, c, a); - QCOMPARE(qUnpremultiply_sse4(p), qUnpremultiply(p)); - } - } - return; - } -#endif - QSKIP("SSE4 not supported on this CPU."); -} - void tst_QColor::qrgba64() { QRgba64 rgb64 = QRgba64::fromRgba(0x22, 0x33, 0x44, 0xff); diff --git a/tests/auto/gui/qopenglconfig/buglist.json b/tests/auto/gui/qopenglconfig/buglist.json index d2d06645aa..c7b8e61bc8 100644 --- a/tests/auto/gui/qopenglconfig/buglist.json +++ b/tests/auto/gui/qopenglconfig/buglist.json @@ -101,6 +101,14 @@ "features": [ "feature1" ] + }, + { + "id": 128, + "description": "check for matching GL_VENDOR", + "gl_vendor": "The Qt Company", + "features": [ + "cool_feature" + ] } ] } diff --git a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp index bfb2623508..f88cbdc758 100644 --- a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp +++ b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp @@ -217,6 +217,11 @@ void tst_QOpenGlConfig::testGlConfiguration() context.doneCurrent(); qDebug().noquote() << '\n' << result; + + // fromContext either uses the current context or creates a temporary dummy one. + QOpenGLConfig::Gpu gpu = QOpenGLConfig::Gpu::fromContext(); + qDebug().noquote() << '\n' << "GL_VENDOR queried by QOpenGLConfig::Gpu:" << gpu.glVendor; + QVERIFY(!gpu.glVendor.isEmpty()); } static inline QByteArray msgSetMismatch(const QSet<QString> &expected, @@ -235,21 +240,28 @@ void tst_QOpenGlConfig::testBugList() const QString fileName = QFINDTESTDATA("buglist.json"); QVERIFY(!fileName.isEmpty()); - QSet<QString> expectedFeatures; - expectedFeatures << "feature1"; + QSet<QString> expectedFeatures; + expectedFeatures << "feature1"; - QOpenGLConfig::Gpu gpu; - gpu.vendorId = 0x10DE; - gpu.deviceId = 0x0DE9; + QVersionNumber driverVersion(QVector<int>() << 9 << 18 << 13 << 4460); + QOpenGLConfig::Gpu gpu = QOpenGLConfig::Gpu::fromDevice(0x10DE, 0x0DE9, driverVersion); -#ifdef Q_COMPILER_INITIALIZER_LISTS - gpu.driverVersion = QVersionNumber({9, 18, 13, 4460}); -#else - gpu.driverVersion = QVersionNumber(QVector<int>() << 9 << 18 << 13 << 4460); -#endif - const QSet<QString> actualFeatures = - QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("win"), - QVersionNumber(6, 3), fileName); + QSet<QString> actualFeatures = QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("win"), + QVersionNumber(6, 3), fileName); + QVERIFY2(expectedFeatures == actualFeatures, + msgSetMismatch(expectedFeatures, actualFeatures)); + + gpu = QOpenGLConfig::Gpu::fromGLVendor(QByteArrayLiteral("Somebody Else")); + expectedFeatures.clear(); + actualFeatures = QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("linux"), + QVersionNumber(1, 0), fileName); + QVERIFY2(expectedFeatures == actualFeatures, + msgSetMismatch(expectedFeatures, actualFeatures)); + + gpu = QOpenGLConfig::Gpu::fromGLVendor(QByteArrayLiteral("The Qt Company")); + expectedFeatures = QSet<QString>() << "cool_feature"; + actualFeatures = QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("linux"), + QVersionNumber(1, 0), fileName); QVERIFY2(expectedFeatures == actualFeatures, msgSetMismatch(expectedFeatures, actualFeatures)); } diff --git a/tests/auto/other/headersclean/headersclean.pro b/tests/auto/other/headersclean/headersclean.pro deleted file mode 100644 index 73e0c5dd56..0000000000 --- a/tests/auto/other/headersclean/headersclean.pro +++ /dev/null @@ -1,3 +0,0 @@ -QT = core concurrent network dbus xml sql testlib gui opengl widgets printsupport platformsupport-private -load(qt_headersclean) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/macnativeevents/BLACKLIST b/tests/auto/other/macnativeevents/BLACKLIST new file mode 100644 index 0000000000..2820457075 --- /dev/null +++ b/tests/auto/other/macnativeevents/BLACKLIST @@ -0,0 +1,11 @@ +# QTBUG-22775 +[testDragWindow] +osx +[testMouseEnter] +osx-10.9 +[testChildDialogInFrontOfModalParent] +osx +[testChildWindowInFrontOfStaysOnTopParentWindow] +osx +[testModifierCtrlWithDontSwapCtrlAndMeta] +osx diff --git a/tests/auto/other/macnativeevents/macnativeevents.pro b/tests/auto/other/macnativeevents/macnativeevents.pro index e958f414e0..48ad04bbff 100644 --- a/tests/auto/other/macnativeevents/macnativeevents.pro +++ b/tests/auto/other/macnativeevents/macnativeevents.pro @@ -8,5 +8,4 @@ SOURCES += expectedeventlist.cpp nativeeventlist.cpp SOURCES += tst_macnativeevents.cpp requires(mac) -CONFIG += insignificant_test # QTBUG-22775 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index 6e8f1e3c9c..a5ed4c5f31 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -4,7 +4,6 @@ SUBDIRS=\ baselineexample \ compiler \ gestures \ - headersclean \ lancelot \ languagechange \ macgui \ @@ -29,7 +28,6 @@ SUBDIRS=\ !qtHaveModule(widgets): SUBDIRS -= \ baselineexample \ gestures \ - headersclean \ lancelot \ languagechange \ modeltest \ @@ -44,14 +42,11 @@ SUBDIRS=\ !qtHaveModule(network): SUBDIRS -= \ baselineexample \ - headersclean \ lancelot \ networkselftest \ qnetworkaccessmanager_and_qprogressdialog \ qobjectperformance -testcocoon: SUBDIRS -= headersclean - cross_compile: SUBDIRS -= \ atwrapper \ compiler diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index abcd06c628..e677891ce5 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -235,13 +235,16 @@ void tst_QFiledialog::directoryEnteredSignal() { QNonNativeFileDialog fd(0, "", QDir::root().path()); fd.setOptions(QFileDialog::DontUseNativeDialog); + QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar"); + QVERIFY(sidebar); + if (sidebar->model()->rowCount() < 2) + QSKIP("This test requires at least 2 side bar entries."); + fd.show(); QTRY_COMPARE(fd.isVisible(), true); QSignalSpy spyDirectoryEntered(&fd, SIGNAL(directoryEntered(QString))); // sidebar - QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar"); - QVERIFY(sidebar->model()->rowCount() >= 2); QModelIndex secondItem = sidebar->model()->index(1, 0); QVERIFY(secondItem.isValid()); sidebar->setCurrentIndex(secondItem); |