winrt: make widgets/kernel auto tests pass

Task-number: QTBUG-68297
Change-Id: I96839927fd98e2c6e533a2a3587ae66e599ec8fc
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This commit is contained in:
Oliver Wolff 2018-05-17 15:51:36 +02:00
parent 70884b4d2d
commit ea4a038bb7
6 changed files with 125 additions and 6 deletions

View File

@ -279,6 +279,9 @@ public:
void tst_QApplication::alert()
{
#ifdef Q_OS_WINRT
QSKIP("WinRT does not support more than 1 native widget at the same time");
#endif
int argc = 0;
QApplication app(argc, 0);
app.alert(0, 0);
@ -822,6 +825,9 @@ public:
void tst_QApplication::closeAllWindows()
{
#ifdef Q_OS_WINRT
QSKIP("PromptOnCloseWidget does not work on WinRT - QTBUG-68297");
#endif
int argc = 0;
QApplication app(argc, 0);
@ -927,6 +933,9 @@ void tst_QApplication::libraryPaths()
QStringList expected = QSet<QString>::fromList((QStringList() << installPathPlugins << appDirPath)).toList();
expected.sort();
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "On WinRT PluginsPath is outside of sandbox. QTBUG-68297", Abort);
#endif
QVERIFY2(isPathListIncluded(actual, expected),
qPrintable("actual:\n - " + actual.join("\n - ") +
"\nexpected:\n - " + expected.join("\n - ")));
@ -1046,6 +1055,9 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2()
<< QDir(app.applicationDirPath()).canonicalPath()
<< QDir(QDir::fromNativeSeparators(QString::fromLatin1(validPath))).canonicalPath();
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "On WinRT PluginsPath is outside of sandbox. QTBUG-68297", Abort);
#endif
QVERIFY2(isPathListIncluded(app.libraryPaths(), expected),
qPrintable("actual:\n - " + app.libraryPaths().join("\n - ") +
"\nexpected:\n - " + expected.join("\n - ")));
@ -1750,6 +1762,9 @@ void tst_QApplication::focusMouseClick()
QSpontaneKeyEvent::setSpontaneous(&ev);
QVERIFY(ev.spontaneous());
qApp->notify(&w2, &ev);
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
#endif
QTRY_COMPARE(QApplication::focusWidget(), &w2);
// now back to tab focus and click again (it already had focus) -> focus should stay

View File

@ -273,6 +273,9 @@ void tst_QFormLayout::wrapping()
w.setWindowTitle(QTest::currentTestFunction());
w.show();
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "setFixedWidth does not work on WinRT", Abort);
#endif
QCOMPARE(le->geometry().y() > lbl->geometry().y(), true);
//TODO: additional tests covering different wrapping cases

View File

@ -337,7 +337,7 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated()
void tst_QLayout::testRetainSizeWhenHidden()
{
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
#if (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)) || defined(Q_OS_WINRT)
QSKIP("Test does not work on platforms which default to showMaximized()");
#endif

View File

@ -188,7 +188,7 @@ private slots:
void reverseTabOrder();
void tabOrderWithProxy();
void tabOrderWithCompoundWidgets();
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void activation();
#endif
void reparent();
@ -1425,7 +1425,7 @@ void tst_QWidget::mapFromAndTo()
subWindow2->setGeometry(75, 75, 100, 100);
subSubWindow->setGeometry(10, 10, 10, 10);
#if !defined(Q_OS_QNX)
#if !defined(Q_OS_QNX) && !defined(Q_OS_WINRT)
//update visibility
if (windowMinimized) {
if (!windowHidden) {
@ -1930,7 +1930,7 @@ void tst_QWidget::tabOrderWithCompoundWidgets()
QVERIFY(lastEdit->hasFocus());
}
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void tst_QWidget::activation()
{
Q_CHECK_PAINTEVENTS
@ -1975,7 +1975,8 @@ void tst_QWidget::windowState()
QPoint pos;
QSize size = m_testWidgetSize;
if (QGuiApplicationPrivate::platformIntegration()->defaultWindowState(Qt::Widget)
== Qt::WindowFullScreen) {
== Qt::WindowFullScreen
|| m_platform == QStringLiteral("winrt")) {
size = QGuiApplication::primaryScreen()->size();
} else {
pos = QPoint(10, 10);
@ -2180,6 +2181,8 @@ void tst_QWidget::showFullScreen()
QSKIP("QTBUG-52974");
#endif
if (m_platform == QStringLiteral("winrt"))
QSKIP("WinRT: This fails. QTBUG-68297");
QWidget plain;
QHBoxLayout *layout;
QWidget layouted;
@ -2301,6 +2304,8 @@ void tst_QWidget::resizeEvent()
wTopLevel.resize(200, 200);
wTopLevel.show();
QVERIFY(QTest::qWaitForWindowExposed(&wTopLevel));
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT does not support resize", Abort);
QCOMPARE (wTopLevel.m_resizeEventCount, 1); // initial resize event before paint for toplevels
wTopLevel.hide();
QSize safeSize(640,480);
@ -2324,6 +2329,9 @@ void tst_QWidget::showMinimized()
plain.showMinimized();
QVERIFY(plain.isMinimized());
QVERIFY(plain.isVisible());
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "Winrt does not support move and resize", Abort);
#endif
QCOMPARE(plain.pos(), pos);
plain.showNormal();
@ -2475,11 +2483,15 @@ void tst_QWidget::showMinimizedKeepsFocus()
#ifdef Q_OS_OSX
if (!macHasAccessToWindowsServer())
QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue);
#elif defined(Q_OS_WINRT)
QEXPECT_FAIL("", "Winrt fails here - QTBUG-68297", Continue);
#endif
QTRY_COMPARE(window.focusWidget(), firstchild);
#ifdef Q_OS_OSX
if (!macHasAccessToWindowsServer())
QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue);
#elif defined(Q_OS_WINRT)
QEXPECT_FAIL("", "Winrt fails here - QTBUG-68297", Continue);
#endif
QTRY_COMPARE(qApp->focusWidget(), firstchild);
}
@ -2510,6 +2522,9 @@ void tst_QWidget::reparent()
parent.show();
childTLW.show();
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "WinRT does not support more than 1 top level widget", Abort);
#endif
QVERIFY(QTest::qWaitForWindowExposed(&parent));
parent.move(parentPosition);
@ -2607,6 +2622,8 @@ void tst_QWidget::normalGeometry()
if (m_platform == QStringLiteral("wayland"))
QSKIP("Wayland: This fails. Figure out why.");
else if (m_platform == QStringLiteral("winrt"))
QSKIP("WinRT: This fails. Figure out why - QTBUG-68297.");
QWidget parent;
parent.setWindowTitle("NormalGeometry parent");
QWidget *child = new QWidget(&parent);
@ -2716,6 +2733,8 @@ void tst_QWidget::setGeometry()
tlw.setGeometry(tr);
child.setGeometry(cr);
tlw.showNormal();
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT does not support setGeometry", Abort);
QTRY_COMPARE(tlw.geometry().size(), tr.size());
QCOMPARE(child.geometry(), cr);
@ -3195,6 +3214,8 @@ void tst_QWidget::saveRestoreGeometry()
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QApplication::processEvents();
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT does not support move/resize", Abort);
QTRY_COMPARE(widget.pos(), position);
QCOMPARE(widget.size(), size);
savedGeometry = widget.saveGeometry();
@ -3361,6 +3382,9 @@ void tst_QWidget::restoreVersion1Geometry()
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QTest::qWait(100);
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT does not support restoreGeometry", Abort);
if (expectedWindowState == Qt::WindowNoState) {
QTRY_COMPARE(widget.pos(), expectedPosition);
QTRY_COMPARE(widget.size(), expectedSize);
@ -3410,6 +3434,8 @@ void tst_QWidget::widgetAt()
QSKIP("Wayland: This fails. Figure out why.");
if (m_platform == QStringLiteral("offscreen"))
QSKIP("Platform offscreen does not support lower()/raise() or WindowMasks");
if (m_platform == QStringLiteral("winrt"))
QSKIP("WinRT does not support more than 1 top level widget");
Q_CHECK_PAINTEVENTS
@ -3711,6 +3737,8 @@ void tst_QWidget::optimizedResizeMove()
staticWidget.gotPaintEvent = false;
staticWidget.move(staticWidget.pos() + QPoint(10, 10));
QTest::qWait(20);
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT does not support move/resize", Abort);
QCOMPARE(staticWidget.gotPaintEvent, false);
staticWidget.gotPaintEvent = false;
@ -3810,6 +3838,8 @@ void tst_QWidget::optimizedResize_topLevel()
QTRY_VERIFY(topLevel.gotPaintEvent);
if (m_platform == QStringLiteral("xcb") || m_platform == QStringLiteral("offscreen"))
QSKIP("QTBUG-26424");
else if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT does not support move/resize", Abort);
QCOMPARE(topLevel.partial, true);
QCOMPARE(topLevel.paintedRegion, expectedUpdateRegion);
}
@ -3910,9 +3940,11 @@ void tst_QWidget::setFixedSize()
w.setFixedSize(defaultSize + QSize(150, 150));
w.showNormal();
QVERIFY(QTest::qWaitForWindowExposed(&w));
QVERIFY(QTest::qWaitForWindowActive(&w));
if (m_platform == QStringLiteral("xcb"))
QSKIP("QTBUG-26424");
else if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT does not support move/resize", Abort);
QCOMPARE(w.size(), defaultSize + QSize(150,150));
}
@ -4113,6 +4145,8 @@ void tst_QWidget::transientParent()
void tst_QWidget::showNativeChild()
{
if (m_platform == QStringLiteral("winrt"))
QSKIP("WinRT does not support setGeometry");
QWidget topLevel;
topLevel.setGeometry(QRect(m_availableTopLeft + QPoint(100, 100), m_testWidgetSize));
topLevel.setWindowTitle(__FUNCTION__);
@ -4295,6 +4329,8 @@ void tst_QWidget::update()
// widgets are transparent by default, so both should get repaints
{
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT does not support setGeometry", Abort);
QApplication::processEvents();
QApplication::processEvents();
QCOMPARE(child.numPaintEvents, 1);
@ -4535,6 +4571,8 @@ void tst_QWidget::scroll()
qApp->processEvents();
QRegion dirty(QRect(0, 0, w, 10));
dirty += QRegion(QRect(0, 10, 10, h - 10));
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT does not support move/resize", Abort);
QTRY_COMPARE(updateWidget.paintedRegion, dirty);
}
@ -4710,6 +4748,8 @@ void tst_QWidget::setWindowGeometry()
{
if (m_platform == QStringLiteral("xcb"))
QSKIP("X11: Skip this test due to Window manager positioning issues.");
else if (m_platform == QStringLiteral("winrt"))
QSKIP("WinRT does not support setWindowGeometry");
QFETCH(QList<QRect>, rects);
QFETCH(int, windowFlags);
@ -4876,6 +4916,8 @@ void tst_QWidget::windowMoveResize()
QSKIP("X11: Skip this test due to Window manager positioning issues.");
if (m_platform == QStringLiteral("wayland"))
QSKIP("Wayland: This fails. Figure out why.");
if (m_platform == QStringLiteral("winrt"))
QSKIP("WinRT does not support move/resize");
QFETCH(QList<QRect>, rects);
QFETCH(int, windowFlags);
@ -5196,6 +5238,9 @@ void tst_QWidget::moveChild()
QTRY_COMPARE(parent.r, QRegion(parent.rect()) - child.geometry());
QTRY_COMPARE(child.r, QRegion(child.rect()));
if (m_platform == QStringLiteral("winrt"))
QSKIP("WinRT does not support setGeometry (and we cannot use QEXPECT_FAIL because of VERIFY_COLOR)");
VERIFY_COLOR(child, child.rect(),
child.color);
VERIFY_COLOR(parent, QRegion(parent.rect()) - child.geometry(), parent.color);
@ -5252,6 +5297,8 @@ void tst_QWidget::showAndMoveChild()
child.move(desktopDimensions.width()/2, desktopDimensions.height()/2);
qApp->processEvents();
if (m_platform == QStringLiteral("winrt"))
QSKIP("WinRT does not support setGeometry (and we cannot use QEXPECT_FAIL because of VERIFY_COLOR)");
VERIFY_COLOR(child, child.rect(), Qt::blue);
VERIFY_COLOR(parent, QRegion(parent.rect()) - child.geometry(), Qt::red);
}
@ -5340,6 +5387,8 @@ void tst_QWidget::multipleToplevelFocusCheck()
if (m_platform == QStringLiteral("wayland"))
QSKIP("Wayland: This fails. Figure out why.");
else if (m_platform == QStringLiteral("winrt"))
QSKIP("Winrt: Sometimes crashes in QTextLayout. - QTBUG-68297");
TopLevelFocusCheck w1;
TopLevelFocusCheck w2;
@ -5498,6 +5547,8 @@ void tst_QWidget::setFocus()
testWidget->clearFocus();
child1.setFocus();
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT fails here - QTBUG-68297", Abort);
QVERIFY(!child1.hasFocus());
QCOMPARE(window.focusWidget(), &child1);
QCOMPARE(QApplication::focusWidget(), nullptr);
@ -6184,6 +6235,8 @@ QByteArray EventRecorder::msgEventListMismatch(const EventList &expected, const
void tst_QWidget::childEvents()
{
if (m_platform == QStringLiteral("winrt"))
QSKIP("WinRT: This fails. QTBUG-68297.");
EventRecorder::EventList expected;
// Move away the cursor; otherwise it might result in an enter event if it's
@ -6579,6 +6632,8 @@ void tst_QWidget::renderInvisible()
{
if (m_platform == QStringLiteral("xcb"))
QSKIP("QTBUG-26424");
if (m_platform == QStringLiteral("winrt"))
QSKIP("WinRT: This fails. QTBUG-68297.");
QScopedPointer<QCalendarWidget> calendar(new QCalendarWidget);
calendar->move(m_availableTopLeft + QPoint(100, 100));
@ -7522,6 +7577,8 @@ void tst_QWidget::hideOpaqueChildWhileHidden()
child.hide();
child2.hide();
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
QTRY_COMPARE(w.r, QRegion(child.geometry()));
child.show();
@ -7559,6 +7616,8 @@ void tst_QWidget::updateWhileMinimized()
// Make sure update requests are discarded until the widget is shown again.
widget.update(0, 0, 50, 50);
QTest::qWait(10);
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
QCOMPARE(widget.numPaintEvents, 0);
// Restore window.
@ -8086,6 +8145,8 @@ void tst_QWidget::doubleRepaint()
#if defined(Q_OS_QNX)
QEXPECT_FAIL("", "Platform does not support showMinimized()", Continue);
#endif
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
QCOMPARE(widget.numPaintEvents, 0);
widget.numPaintEvents = 0;
@ -8215,6 +8276,8 @@ void tst_QWidget::setMaskInResizeEvent()
QRegion expectedParentUpdate(0, 0, 100, 10); // Old testWidget area.
expectedParentUpdate += testWidget.geometry(); // New testWidget area.
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
QTRY_COMPARE(w.paintedRegion, expectedParentUpdate);
QTRY_COMPARE(testWidget.paintedRegion, testWidget.mask());
@ -8659,6 +8722,8 @@ void tst_QWidget::translucentWidget()
widgetSnapshot = label.grab(QRect(QPoint(0, 0), label.size()));
const QImage actual = widgetSnapshot.toImage().convertToFormat(QImage::Format_RGB32);
const QImage expected = pm.toImage().scaled(label.devicePixelRatioF() * pm.size());
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
QCOMPARE(actual.size(),expected.size());
QCOMPARE(actual,expected);
}
@ -9056,6 +9121,8 @@ void tst_QWidget::syntheticEnterLeave()
QCOMPARE(child1->numLeaveEvents, 0);
// This event arrives asynchronously
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
QTRY_COMPARE(window.numEnterEvents, 1);
QCOMPARE(child2->numEnterEvents, 1);
QCOMPARE(grandChild->numEnterEvents, 1);
@ -9140,6 +9207,8 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
QCursor::setPos(child.mapToGlobal(QPoint(100, 100)));
// Make sure the cursor has entered the child.
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
QTRY_VERIFY(child.numEnterEvents > 0);
child.hide();
@ -9359,6 +9428,8 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779()
correct.fill(Qt::green);
const QPixmap mainPixmap = grabFromWidget(&main, QRect(QPoint(0, 0), QSize(-1, -1)));
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
QTRY_COMPARE(mainPixmap.toImage().convertToFormat(QImage::Format_RGB32),
correct.toImage().convertToFormat(QImage::Format_RGB32));
#ifndef QT_NO_CURSOR
@ -9450,6 +9521,8 @@ void tst_QWidget::activateWindow()
qApp->processEvents();
QTRY_VERIFY(mainwindow->isActiveWindow());
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
QTRY_VERIFY(!mainwindow2->isActiveWindow());
}
@ -10610,6 +10683,8 @@ void tst_QWidget::resizeStaticContentsChildWidget_QTBUG35282()
widget.showNormal();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
if (m_platform == QStringLiteral("winrt"))
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
QCOMPARE(childWidget.numPaintEvents, 0);
childWidget.reset();

View File

@ -156,6 +156,9 @@ void tst_QWidget_window::tst_move_show()
QWidget w;
w.move(100, 100);
w.show();
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "Winrt does not support move", Abort);
#endif
QCOMPARE(w.pos(), QPoint(100, 100));
// QCoreApplication::processEvents(QEventLoop::AllEvents, 3000);
}
@ -185,6 +188,9 @@ void tst_QWidget_window::tst_resize_show()
QWidget w;
w.resize(200, 200);
w.show();
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "Winrt does not support resize", Abort);
#endif
QCOMPARE(w.size(), QSize(200, 200));
// QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
}
@ -704,6 +710,9 @@ void tst_QWidget_window::tst_resize_count()
ResizeWidget resize;
resize.show();
QVERIFY(QTest::qWaitForWindowExposed(&resize));
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "Winrt does not support resize", Abort);
#endif
QCOMPARE(resize.resizeCount, 1);
resize.resizeCount = 0;
QSize size = resize.size();
@ -901,6 +910,11 @@ void tst_QWidget_window::setWindowState()
w.setWindowState(state);
QCOMPARE(w.windowState(), state);
w.show();
#ifdef Q_OS_WINRT
QEXPECT_FAIL("0", "Winrt windows are maximized by default", Abort);
QEXPECT_FAIL("Qt::WindowMinimized", "Winrt windows are maximized by default", Abort);
QEXPECT_FAIL("Qt::WindowFullScreen", "Winrt windows are maximized by default", Abort);
#endif
QCOMPARE(w.windowState(), state);
QCOMPARE(w.windowHandle()->windowStates(), state);
if (!(state & Qt::WindowMinimized))

View File

@ -104,6 +104,9 @@ void tst_QWindowContainer::testShow()
root.show();
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
#endif
QVERIFY(QTest::qWaitForWindowExposed(window));
}
@ -140,6 +143,9 @@ void tst_QWindowContainer::testExposeObscure()
container->show();
QVERIFY(QTest::qWaitForWindowExposed(container.data()));
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
#endif
QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->numberOfExposes > 0);
@ -255,6 +261,9 @@ void tst_QWindowContainer::testUnparentReparent()
QTRY_VERIFY(!window->isVisible());
container->show();
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
#endif
QVERIFY(QTest::qWaitForWindowExposed(window));
QTRY_VERIFY(window->isVisible());
@ -359,6 +368,9 @@ void tst_QWindowContainer::testNativeContainerParent()
root.show();
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
#endif
QVERIFY(QTest::qWaitForWindowExposed(window));
QTRY_COMPARE(window->parent(), container->windowHandle());
}