diff options
author | David Faure <david.faure@kdab.com> | 2014-04-05 10:11:02 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-12 13:23:38 +0200 |
commit | 3712ecc7295b91176f51763a048a83a9c7b98d01 (patch) | |
tree | 50033216a09f29f6da72b1bc55e2c9404f2f62fb /tests | |
parent | 437c68fbff0f5b92272acd3fd6ef6ff7a1ad8e8e (diff) | |
download | qtx11extras-3712ecc7295b91176f51763a048a83a9c7b98d01.tar.gz |
QX11Info: add nextStartupId/setNextStartupId - for startup-notification
This controls what the next window to be shown will send as startup-notification
message.
http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt
Change-Id: Ia1b5e6ba004d61ca6fdfd6683d2e22dfcd0c42fb
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qx11info/tst_qx11info.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qx11info/tst_qx11info.cpp b/tests/auto/qx11info/tst_qx11info.cpp index 602de1d..8334690 100644 --- a/tests/auto/qx11info/tst_qx11info.cpp +++ b/tests/auto/qx11info/tst_qx11info.cpp @@ -52,6 +52,7 @@ class tst_QX11Info : public QObject private slots: void staticFunctionsBeforeQApplication(); + void startupId(); void isPlatformX11(); void appTime(); }; @@ -110,6 +111,34 @@ void tst_QX11Info::staticFunctionsBeforeQApplication() QCOMPARE(appTime, 0ul); } +static const char idFromEnv[] = "startupid_TIME123456"; +void initialize() +{ + qputenv("DESKTOP_STARTUP_ID", idFromEnv); +} +Q_CONSTRUCTOR_FUNCTION(initialize) + +void tst_QX11Info::startupId() +{ + int argc = 0; + QApplication app(argc, 0); + + // This relies on the fact that no widget was shown yet, + // so please make sure this method is always the first test. + QCOMPARE(QString(QX11Info::nextStartupId()), QString(idFromEnv)); + QWidget w; + w.show(); + QVERIFY(QX11Info::nextStartupId().isEmpty()); + + QByteArray idSecondWindow = "startupid2_TIME234567"; + QX11Info::setNextStartupId(idSecondWindow); + QCOMPARE(QX11Info::nextStartupId(), idSecondWindow); + + QWidget w2; + w2.show(); + QVERIFY(QX11Info::nextStartupId().isEmpty()); +} + void tst_QX11Info::isPlatformX11() { int argc = 0; |