summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-24 09:25:25 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-24 07:49:30 +0000
commit7183d08095f4598fc0f7702608bd726986bf1307 (patch)
tree0511abe7b7ef3f520e60ada656f0dcb9a2650057
parent7a8da57a637f7a0b94199bb0e19f97a53958a8f0 (diff)
Tests: Harmonize code checking on platform name.
Use case insensitive comparison and static invocation of QGuiApplication::platformName(). Change-Id: I8c197c7b4f0669f71c019fbcee09a0f03dfab399 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp4
-rw-r--r--tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp6
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp20
-rw-r--r--tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp2
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp2
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp2
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp2
14 files changed, 26 insertions, 26 deletions
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index eddf3fa826..5fbd3e96f8 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -155,7 +155,7 @@ void tst_QGuiApplication::focusObject()
int argc = 0;
QGuiApplication app(argc, 0);
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
QObject obj1, obj2, obj3;
@@ -326,7 +326,7 @@ void tst_QGuiApplication::changeFocusWindow()
int argc = 0;
QGuiApplication app(argc, 0);
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
diff --git a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
index ab17edecb6..e3b71e40d1 100644
--- a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
+++ b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
@@ -191,7 +191,7 @@ void tst_qinputmethod::cursorRectangle()
{
QCOMPARE(qApp->inputMethod()->cursorRectangle(), QRectF());
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
DummyWindow window;
@@ -289,10 +289,10 @@ void tst_qinputmethod::inputDirection()
void tst_qinputmethod::inputMethodAccepted()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
- if (qApp->platformName().toLower() == QLatin1String("xcb"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive))
QSKIP("XCB: depends on dedicated platform context.");
InputItem disabledItem;
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index ccb8c759c6..2219306b81 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -286,7 +286,7 @@ void tst_QWindow::positioning()
QSKIP("This platform does not support non-fullscreen windows");
}
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
// Some platforms enforce minimum widths for windows, which can cause extra resize
@@ -476,7 +476,7 @@ void tst_QWindow::isExposed()
window.hide();
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This is flaky. Figure out why.");
QCoreApplication::processEvents();
@@ -487,7 +487,7 @@ void tst_QWindow::isExposed()
void tst_QWindow::isActive()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
Window window;
@@ -1134,7 +1134,7 @@ void tst_QWindow::close()
void tst_QWindow::activateAndClose()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
for (int i = 0; i < 10; ++i) {
@@ -1388,7 +1388,7 @@ void tst_QWindow::tabletEvents()
void tst_QWindow::windowModality_QTBUG27039()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
QWindow parent;
@@ -1483,7 +1483,7 @@ void tst_QWindow::mask()
void tst_QWindow::initialSize()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
QSize defaultSize(0,0);
@@ -1524,7 +1524,7 @@ void tst_QWindow::initialSize()
void tst_QWindow::modalDialog()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
QWindow normalWindow;
@@ -1550,7 +1550,7 @@ void tst_QWindow::modalDialog()
void tst_QWindow::modalDialogClosingOneOfTwoModal()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
QWindow normalWindow;
@@ -1588,7 +1588,7 @@ void tst_QWindow::modalDialogClosingOneOfTwoModal()
void tst_QWindow::modalWithChildWindow()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
QWindow normalWindow;
@@ -1622,7 +1622,7 @@ void tst_QWindow::modalWithChildWindow()
void tst_QWindow::modalWindowModallity()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
QWindow normal_window;
diff --git a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp
index 48a15641b2..1cb7972cc6 100644
--- a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp
+++ b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp
@@ -288,7 +288,7 @@ void tst_QOpenGlConfig::testBugList()
void tst_QOpenGlConfig::testDefaultWindowsBlacklist()
{
- if (qGuiApp->platformName() != QStringLiteral("windows"))
+ if (QGuiApplication::platformName().compare(QLatin1String("windows"), Qt::CaseInsensitive))
QSKIP("Only applicable to Windows");
QFile f(QStringLiteral(":/qt-project.org/windows/openglblacklists/default.json"));
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index 84109441b9..93e308b96a 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -149,7 +149,7 @@ void tst_QFont::exactMatch()
#endif
- if (QGuiApplication::platformName() == QLatin1String("xcb")) {
+ if (!QGuiApplication::platformName().compare("xcb", Qt::CaseInsensitive)) {
QVERIFY(QFont("sans").exactMatch());
QVERIFY(QFont("sans-serif").exactMatch());
QVERIFY(QFont("serif").exactMatch());
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index e62ce3ceb5..2982d80477 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -557,7 +557,7 @@ void tst_QDialog::snapToDefaultButton()
#ifdef QT_NO_CURSOR
QSKIP("Test relies on there being a cursor");
#else
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: Wayland does not support setting the cursor position.");
QPoint topLeftPos = QApplication::desktop()->availableGeometry().topLeft();
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index 85f60102a7..7e6e5908ee 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -463,7 +463,7 @@ void tst_QFileDialog2::task180459_lastDirectory_data()
void tst_QFileDialog2::task180459_lastDirectory()
{
- if (qApp->platformName().toLower() == QStringLiteral("cocoa"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("cocoa"), Qt::CaseInsensitive))
QSKIP("Insignificant on OSX"); //QTBUG-39183
//first visit the temp directory and close the dialog
QNonNativeFileDialog *dlg = new QNonNativeFileDialog(0, "", tempDir.path());
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 595f86b688..98473fb5cc 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -145,7 +145,7 @@ class tst_QGraphicsView : public QObject
public:
tst_QGraphicsView()
- : platformName(qApp->platformName().toLower())
+ : platformName(QGuiApplication::platformName().toLower())
{ }
private slots:
void initTestCase();
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 05462fa680..6d5f5a1c60 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -2364,7 +2364,7 @@ void tst_QTreeView::selectionOrderTest()
void tst_QTreeView::selection()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This causes a crash triggered by setVisible(false)");
QTreeView treeView;
diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
index 21c552b2a0..117c53a2bb 100644
--- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
@@ -3413,7 +3413,7 @@ void tst_QTreeWidget::taskQTBUG_34717_collapseAtBottom()
void tst_QTreeWidget::task20345_sortChildren()
{
- if (qApp->platformName().toLower() == QLatin1String("wayland"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This causes a crash triggered by setVisible(false)");
// This test case is considered successful if it is executed (no crash in sorting)
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 34bd575646..f3f4467b80 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -627,7 +627,7 @@ void tst_QWidget::getSetCheck()
}
tst_QWidget::tst_QWidget()
- : m_platform(qApp->platformName().toLower())
+ : m_platform(QGuiApplication::platformName().toLower())
, m_windowsAnimationsEnabled(windowsAnimationsEnabled())
{
if (m_windowsAnimationsEnabled) // Disable animations which can interfere with screen grabbing in moveChild(), showAndMoveChild()
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
index 7d48ab760d..dfc53c9164 100644
--- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
+++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
@@ -212,7 +212,7 @@ void tst_QWindowContainer::testActivation()
// Under KDE (ubuntu 12.10), we experience that doing two activateWindow in a row
// does not work. The second gets ignored by the window manager, even though the
// timestamp in the xcb connection is unique for both.
- if (QGuiApplication::platformName() == "xcb")
+ if (!QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive))
QTest::qWait(100);
window->requestActivate();
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index e7de027b22..e23634c515 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
@@ -518,7 +518,7 @@ void tst_QMdiArea::subWindowActivated2()
#ifdef Q_OS_MAC
QSKIP("QTBUG-25298: This test is unstable on Mac.");
#endif
- if (qApp->platformName().toLower() == QStringLiteral("xcb"))
+ if (!QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive))
QSKIP("QTBUG-25298: Unstable on some X11 window managers");
QTRY_COMPARE(spy.count(), 1);
QVERIFY(!mdiArea.activeSubWindow());
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 843bb3437c..5ae0733965 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -363,7 +363,7 @@ void tst_QMenu::keyboardNavigation_data()
QTest::newRow("data9") << Qt::Key(Qt::Key_Down) << Qt::KeyboardModifiers(Qt::NoModifier) << 3 << 0 << false << false<< true;
QTest::newRow("data10") << Qt::Key(Qt::Key_Return) << Qt::KeyboardModifiers(Qt::NoModifier) << 3 << 0 << false << true << false;
- if (qApp->platformName().toLower() != QStringLiteral("xcb")) {
+ if (QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive)) {
// Test shortcuts.
QTest::newRow("shortcut0") << Qt::Key(Qt::Key_V) << Qt::KeyboardModifiers(Qt::AltModifier) << 5 << 0 << true << true << false;
}