diff options
author | David Faure <faure@kde.org> | 2012-11-30 19:37:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-14 08:56:02 +0100 |
commit | 92bd9aecfb69ebe525ba88dc78ce85e3ca7ed9c2 (patch) | |
tree | 782443b776a374680e2e4ec87a4409fea027ea4d /tests | |
parent | 1a653225f6c73d7ca32aa6cdcde45ba9462a7b72 (diff) |
Fix empty window title regression, add application display name to window title
This increases consistency a lot: all windows and dialogs from a Qt
application will show the app display name in the caption, on Windows and X11.
This helps identifying which app a dialog belongs to, which is especially
useful when the dialog is very generic and shows up unexpectedly.
For compatibility reasons, the app name is added to the caption only
if setApplicationDisplayName() was called -- or if the caption would be
completely empty. The standard Qt4 case (setWindowTitle + no display name)
is unchanged.
Change-Id: Ib284c62c1f4c0bc923e5bc2d10247d95e9aa76c1
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 230fcebfcb..058831af2e 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -230,28 +230,16 @@ void tst_QWidget_window::tst_windowFilePathAndwindowTitle_data() QString validPath = QApplication::applicationFilePath(); QString fileNameOnly = QFileInfo(validPath).fileName() + QLatin1String("[*]"); - QString fileAndSep = fileNameOnly + QLatin1String(" ") + QChar(0x2014) + QLatin1String(" "); QString windowTitle = QLatin1String("Here is a Window Title"); - - QString defaultPlatString = -#if 0 // was ifdef Q_OS_MAC, but that code is disabled in qwidget.cpp and caption handling should move to QPA anyway - fileNameOnly; -#else - fileAndSep + "tst_qwidget_window"; // default app name in Qt5 -#endif + QString defaultPlatString = fileNameOnly; QTest::newRow("never Set Title nor AppName") << false << false << validPath << QString() << windowTitle << defaultPlatString << defaultPlatString; QTest::newRow("set title after only, but no AppName") << false << true << validPath << QString() << windowTitle << defaultPlatString << windowTitle; QTest::newRow("set title before only, not AppName") << true << false << validPath << QString() << windowTitle << windowTitle << windowTitle; QTest::newRow("always set title, not appName") << true << true << validPath << QString() << windowTitle << windowTitle << windowTitle; - QString appName = QLatin1String("Killer App"); - QString platString = -#if 0 // was ifdef Q_OS_MAC, but that code is disabled in qwidget.cpp and caption handling should move to QPA anyway - fileNameOnly; -#else - fileAndSep + appName; -#endif + QString appName = QLatin1String("Killer App"); // Qt4 used to make it part of windowTitle(), Qt5 doesn't anymore, the QPA plugin takes care of it. + QString platString = fileNameOnly; QTest::newRow("never Set Title, yes AppName") << false << false << validPath << appName << windowTitle << platString << platString; QTest::newRow("set title after only, yes AppName") << false << true << validPath << appName << windowTitle << platString << windowTitle; |