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>
bb10
Friedemann Kleint 2015-09-24 09:25:25 +02:00
parent 7a8da57a63
commit 7183d08095
14 changed files with 26 additions and 26 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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"));

View File

@ -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());

View File

@ -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();

View File

@ -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());

View File

@ -145,7 +145,7 @@ class tst_QGraphicsView : public QObject
public:
tst_QGraphicsView()
: platformName(qApp->platformName().toLower())
: platformName(QGuiApplication::platformName().toLower())
{ }
private slots:
void initTestCase();

View File

@ -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;

View File

@ -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)

View File

@ -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()

View File

@ -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();

View File

@ -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());

View File

@ -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;
}