diff options
Diffstat (limited to 'tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp')
-rw-r--r-- | tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index a935258fb8..4f27aeb899 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -68,6 +68,7 @@ private slots: void changeFocusWindow(); void keyboardModifiers(); void palette(); + void font(); void modalWindow(); void quitOnLastWindowClosed(); void quitOnLastWindowClosedMulti(); @@ -227,7 +228,7 @@ void tst_QGuiApplication::focusObject() QOpenGLContext context; context.create(); context.makeCurrent(&window1); - QTest::qWaitForWindowExposed(&window1); // Buffer swap only succeeds with exposed window + QVERIFY(QTest::qWaitForWindowExposed(&window1)); // Buffer swap only succeeds with exposed window context.swapBuffers(&window1); #endif @@ -392,7 +393,7 @@ void tst_QGuiApplication::changeFocusWindow() QOpenGLContext context; context.create(); context.makeCurrent(&window1); - QTest::qWaitForWindowExposed(&window1); // Buffer swap only succeeds with exposed window + QVERIFY(QTest::qWaitForWindowExposed(&window1)); // Buffer swap only succeeds with exposed window context.swapBuffers(&window1); #endif FocusChangeWindow window2; @@ -406,7 +407,7 @@ void tst_QGuiApplication::changeFocusWindow() #if defined(Q_OS_QNX) // We either need to create a eglSurface or a create a backing store // and then post the window in order for screen to show the window context.makeCurrent(&window2); - QTest::qWaitForWindowExposed(&window2); // Buffer swap only succeeds with exposed window + QVERIFY(QTest::qWaitForWindowExposed(&window2)); // Buffer swap only succeeds with exposed window context.swapBuffers(&window2); #endif QVERIFY(QTest::qWaitForWindowExposed(&window1)); @@ -524,6 +525,31 @@ void tst_QGuiApplication::palette() QCOMPARE(signalSpy.count(), 2); } +void tst_QGuiApplication::font() +{ + int argc = 1; + char *argv[] = { const_cast<char*>("tst_qguiapplication") }; + QGuiApplication app(argc, argv); + QSignalSpy signalSpy(&app, SIGNAL(fontChanged(QFont))); + + QFont oldFont = QGuiApplication::font(); + QFont newFont = QFont("BogusFont", 33); + + QGuiApplication::setFont(newFont); + QCOMPARE(QGuiApplication::font(), newFont); + QCOMPARE(signalSpy.count(), 1); + QCOMPARE(signalSpy.at(0).at(0), QVariant(newFont)); + + QGuiApplication::setFont(oldFont); + QCOMPARE(QGuiApplication::font(), oldFont); + QCOMPARE(signalSpy.count(), 2); + QCOMPARE(signalSpy.at(1).at(0), QVariant(oldFont)); + + QGuiApplication::setFont(oldFont); + QCOMPARE(QGuiApplication::font(), oldFont); + QCOMPARE(signalSpy.count(), 2); +} + class BlockableWindow : public QWindow { Q_OBJECT |