diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 17:46:16 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 17:46:34 +0200 |
commit | 440286655e0ca271506cf7cc02ad0dbf4baef9ca (patch) | |
tree | 896fa81adb8b14a69355a3a6cf64d06ec8173c9a /tests/auto/widgets/widgets | |
parent | 1e27ad1697187549151657ba187928e439300db7 (diff) | |
parent | e164d61ca8263fc4b46fdd916e1ea77c7dd2b735 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
Diffstat (limited to 'tests/auto/widgets/widgets')
5 files changed, 40 insertions, 4 deletions
diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp index 420ef56106..1b477fbbd0 100644 --- a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp +++ b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp @@ -295,6 +295,12 @@ void tst_QGroupBox::enabledChildPropagation() QVERIFY(!childWidget->isEnabled()); dialog = new QDialog(&testWidget); QVERIFY(dialog->isEnabled()); + + // children that are enabled after adding should still be disabled before + // they are shown + childWidget->setEnabled(true); + testWidget.show(); + QVERIFY(!childWidget->isEnabled()); } void tst_QGroupBox::sizeHint() diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 1c68a5f752..0cfbc651ad 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -4860,6 +4860,7 @@ void tst_QLineEdit::inputRejected() QCOMPARE(spyInputRejected.count(), 0); QTest::keyClicks(testWidget, "fgh"); QCOMPARE(spyInputRejected.count(), 3); +#if QT_CONFIG(clipboard) testWidget->clear(); spyInputRejected.clear(); QApplication::clipboard()->setText("ijklmno"); @@ -4867,6 +4868,7 @@ void tst_QLineEdit::inputRejected() // The first 5 characters are accepted, but // the last 2 are not. QCOMPARE(spyInputRejected.count(), 1); +#endif testWidget->setMaxLength(INT_MAX); testWidget->clear(); @@ -4877,11 +4879,13 @@ void tst_QLineEdit::inputRejected() QCOMPARE(spyInputRejected.count(), 0); QTest::keyClicks(testWidget, "a#"); QCOMPARE(spyInputRejected.count(), 2); +#if QT_CONFIG(clipboard) testWidget->clear(); spyInputRejected.clear(); QApplication::clipboard()->setText("a#"); testWidget->paste(); QCOMPARE(spyInputRejected.count(), 1); +#endif testWidget->clear(); testWidget->setValidator(0); diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp index 3408fc0946..f2f9cfc009 100644 --- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp @@ -171,11 +171,8 @@ void tst_QProgressBar::format() bar.setFormat("%v of %m (%p%)"); qApp->processEvents(); -#ifndef Q_OS_MAC +#if !defined(Q_OS_MACOS) && !defined(Q_OS_WIN) // Animated scroll bars get paint events all the time -#ifdef Q_OS_WIN - if (QOperatingSystemVersion::current() < QOperatingSystemVersion::WindowsVista) -#endif QVERIFY(!bar.repainted); #endif diff --git a/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp b/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp index 91a9c49b00..64e4582366 100644 --- a/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp +++ b/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp @@ -36,6 +36,7 @@ class tst_QSplashScreen : public QObject private slots: void checkCloseTime(); + void checkScreenConstructor(); }; class CloseEventSplash : public QSplashScreen @@ -69,5 +70,16 @@ void tst_QSplashScreen::checkCloseTime() QVERIFY(w.windowHandle()->isExposed()); } +void tst_QSplashScreen::checkScreenConstructor() +{ + for (const auto screen : QGuiApplication::screens()) { + QSplashScreen splash(screen); + splash.show(); + QCOMPARE(splash.screen(), screen); + QVERIFY(splash.windowHandle()); + QCOMPARE(splash.windowHandle()->screen(), screen); + } +} + QTEST_MAIN(tst_QSplashScreen) #include "tst_qsplashscreen.moc" diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index c2cf31bfa4..b31e230893 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -1978,8 +1978,23 @@ void tst_QTextEdit::fullWidthSelection_data() #endif #ifdef QT_BUILD_INTERNAL + +// With the fix for QTBUG-78318 scaling of documentMargin is added. The testing framework +// forces qt_defaultDpi() to always return 96 DPI. For systems where the actual DPI differs +// (typically 72 DPI) this would now cause scaling of the documentMargin when +// drawing QTextEdit into QImage. In order to avoid the need of multiple reference PNGs +// for comparison we disable the Qt::AA_Use96Dpi attribute for these tests. + +struct ForceSystemDpiHelper { + ForceSystemDpiHelper() { QCoreApplication::setAttribute(Qt::AA_Use96Dpi, false); } + ~ForceSystemDpiHelper() { QCoreApplication::setAttribute(Qt::AA_Use96Dpi, old); } + bool old = QCoreApplication::testAttribute(Qt::AA_Use96Dpi); +}; + void tst_QTextEdit::fullWidthSelection() { + ForceSystemDpiHelper useSystemDpi; + QFETCH(int, cursorFrom); QFETCH(int, cursorTo); QFETCH(QString, imageFileName); @@ -2048,6 +2063,8 @@ void tst_QTextEdit::fullWidthSelection() #ifdef QT_BUILD_INTERNAL void tst_QTextEdit::fullWidthSelection2() { + ForceSystemDpiHelper useSystemDpi; + QPalette myPalette; myPalette.setColor(QPalette::All, QPalette::HighlightedText, QColor(0,0,0,0)); myPalette.setColor(QPalette::All, QPalette::Highlight, QColor(239,221,85)); |