fixup tests to build with refactor
authorMatthew Cattell <matthew.cattell@nokia.com>
Fri, 9 Sep 2011 12:50:48 +0000 (14:50 +0200)
committerSamuel Rødal <samuel.rodal@nokia.com>
Fri, 9 Sep 2011 13:02:36 +0000 (15:02 +0200)
Change-Id: Iab4adc9e19fab67402918bb737fff2fce6c292bd
Reviewed-on: http://codereview.qt-project.org/4545
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
20 files changed:
tests/auto/auto.pro
tests/auto/declarative/declarative.pro
tests/auto/declarative/nodes/tst_nodestest.cpp
tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp
tests/auto/declarative/qsgcanvas/tst_qsgcanvas.cpp
tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp
tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp
tests/auto/declarative/qsggridview/tst_qsggridview.cpp
tests/auto/declarative/qsglistview/tst_qsglistview.cpp
tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp
tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp
tests/auto/declarative/qsgrepeater/tst_qsgrepeater.cpp
tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
tests/auto/declarative/runall.sh

index 8f351b7..08f3a4d 100644 (file)
@@ -1,7 +1,7 @@
 TEMPLATE=subdirs
 SUBDIRS=\
-    declarative \
-    qtquick1 \
+    declarative
+
 
 contains(QT_CONFIG, qmltest): SUBDIRS += qmltest
 
index 5c5e76d..8563dc6 100644 (file)
@@ -73,8 +73,8 @@ SGTESTS =  \
     qsgpositioners \
     qsgrepeater \
     qsgtext \
-    qsgtextedit \
-    qsgtextinput \
#   qsgtextedit \
#   qsgtextinput \
     qsgvisualdatamodel \
 
 
index 6b1fa85..d4782f9 100644 (file)
@@ -47,7 +47,7 @@
 #include <private/qsgnodeupdater_p.h>
 
 #include <qsgsimplerectnode.h>
-
+#include <QtOpenGL/QGLWidget>
 class NodesTest : public QObject
 {
     Q_OBJECT
index 264a95d..c8cfd13 100644 (file)
@@ -79,9 +79,9 @@ void tst_qdeclarativeapplication::active()
 
     // active
     view.show();
-    QApplication::setActiveWindow(&view);
-    QTest::qWaitForWindowShown(&view);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+    view.requestActivateWindow();
+    QTest::qWait(50);
+    QTRY_COMPARE(view.status(), QSGView::Ready);
     QCOMPARE(item->property("active").toBool(), QApplication::activeWindow() != 0);
 
     // not active again
index 99291c1..2231334 100644 (file)
@@ -1,5 +1,5 @@
 load(qttest_p4)
-contains(QT_CONFIG,declarative): QT += declarative
+contains(QT_CONFIG,declarative): QT += declarative widgets
 macx:CONFIG -= app_bundle
 
 SOURCES += tst_qdeclarativeproperty.cpp
index 5218093..75c2f7f 100644 (file)
@@ -44,7 +44,7 @@
 #include <QtDeclarative/qdeclarativeproperty.h>
 #include <QtDeclarative/private/qdeclarativeproperty_p.h>
 #include <private/qdeclarativebinding_p.h>
-#include <QtGui/QLineEdit>
+#include <QtWidgets/QLineEdit>
 #include <QtCore/qfileinfo.h>
 #include <QtCore/qdir.h>
 
index 8964057..0c927c2 100644 (file)
@@ -154,9 +154,10 @@ void tst_qsganimatedimage::mirror_running()
     int width = anim->property("width").toInt();
 
     QCOMPARE(anim->currentFrame(), 0);
-    QPixmap frame0 = canvas->renderPixmap();
+    QPixmap frame0 = QPixmap::fromImage(canvas->grabFrameBuffer());
+
     anim->setCurrentFrame(1);
-    QPixmap frame1 = canvas->renderPixmap();
+    QPixmap frame1 = QPixmap::fromImage(canvas->grabFrameBuffer());
 
     anim->setCurrentFrame(0);
 
@@ -167,11 +168,11 @@ void tst_qsganimatedimage::mirror_running()
     anim->setProperty("mirror", true);
 
     QCOMPARE(anim->currentFrame(), 1);
-    QPixmap frame1_flipped = canvas->renderPixmap();
+    QPixmap frame1_flipped = QPixmap::fromImage(canvas->grabFrameBuffer());
 
     QTRY_VERIFY(spy.count() == 1); spy.clear();
     QCOMPARE(anim->currentFrame(), 0);  // animation only has 2 frames, should cycle back to first
-    QPixmap frame0_flipped = canvas->renderPixmap();
+    QPixmap frame0_flipped = QPixmap::fromImage(canvas->grabFrameBuffer());
 
     QSKIP("Skip while QTBUG-19351 and QTBUG-19252 are not resolved", SkipSingle);
 
@@ -198,7 +199,7 @@ void tst_qsganimatedimage::mirror_notRunning()
     QVERIFY(anim);
 
     int width = anim->property("width").toInt();
-    QPixmap screenshot = canvas->renderPixmap();
+    QPixmap screenshot = QPixmap::fromImage(canvas->grabFrameBuffer());
 
     QTransform transform;
     transform.translate(width, 0).scale(-1, 1.0);
@@ -209,7 +210,7 @@ void tst_qsganimatedimage::mirror_notRunning()
     bool paused = anim->isPlaying();
 
     anim->setProperty("mirror", true);
-    screenshot = canvas->renderPixmap();
+    screenshot = QPixmap::fromImage(canvas->grabFrameBuffer());
 
     QSKIP("Skip while QTBUG-19351 and QTBUG-19252 are not resolved", SkipSingle);
     QCOMPARE(screenshot, expected);
index c7d3e28..32271b0 100644 (file)
@@ -231,8 +231,6 @@ void tst_qsgcanvas::touchEvent_basic()
     QTest::touchEvent(canvas).press(0, topItem->mapToScene(pos).toPoint(),canvas);
     QTest::qWait(50);
 
-
-
     QCOMPARE(topItem->lastEvent.touchPoints.count(), 1);
 
     QVERIFY(middleItem->lastEvent.touchPoints.isEmpty());
index 9a54e31..bd2090d 100644 (file)
@@ -81,9 +81,6 @@ tst_qsgflipable::tst_qsgflipable()
 }
 void tst_qsgflipable::initTestCase()
 {
-    QSGView canvas;
-    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
-        QSKIP("Flipable item needs OpenGL 2.0", SkipAll);
 }
 
 void tst_qsgflipable::cleanupTestCase()
index 2c8f59c..83da0ba 100644 (file)
@@ -80,9 +80,6 @@ private slots:
 };
 void tst_qsgfocusscope::initTestCase()
 {
-    QSGView canvas;
-    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
-        QSKIP("FocusScope item needs OpenGL 2.0", SkipAll);
 }
 
 void tst_qsgfocusscope::cleanupTestCase()
@@ -127,7 +124,7 @@ void tst_qsgfocusscope::basic()
     QVERIFY(item3 != 0);
 
     view->show();
-    qApp->setActiveWindow(view);
+    view->requestActivateWindow();
     qApp->processEvents();
 
 #ifdef Q_WS_X11
@@ -135,7 +132,7 @@ void tst_qsgfocusscope::basic()
     qt_x11_wait_for_window_manager(view);
 #endif
 
-    QVERIFY(view->hasFocus());
+    QVERIFY(view->isTopLevel());
     QVERIFY(item0->hasActiveFocus() == true);
     QVERIFY(item1->hasActiveFocus() == true);
     QVERIFY(item2->hasActiveFocus() == false);
@@ -173,7 +170,7 @@ void tst_qsgfocusscope::nested()
     QVERIFY(item5 != 0);
 
     view->show();
-    qApp->setActiveWindow(view);
+    view->requestActivateWindow();
     qApp->processEvents();
 
 #ifdef Q_WS_X11
@@ -181,7 +178,7 @@ void tst_qsgfocusscope::nested()
     qt_x11_wait_for_window_manager(view);
 #endif
 
-    QVERIFY(view->hasFocus());
+    QVERIFY(view->windowState() == Qt::WindowActive);
 
     QVERIFY(item1->hasActiveFocus() == true);
     QVERIFY(item2->hasActiveFocus() == true);
@@ -206,7 +203,7 @@ void tst_qsgfocusscope::noFocus()
     QVERIFY(item3 != 0);
 
     view->show();
-    qApp->setActiveWindow(view);
+    view->requestActivateWindow();
     qApp->processEvents();
 
 #ifdef Q_WS_X11
@@ -214,7 +211,7 @@ void tst_qsgfocusscope::noFocus()
     qt_x11_wait_for_window_manager(view);
 #endif
 
-    QVERIFY(view->hasFocus());
+    QVERIFY(view->windowState() == Qt::WindowActive);
     QVERIFY(item0->hasActiveFocus() == false);
     QVERIFY(item1->hasActiveFocus() == false);
     QVERIFY(item2->hasActiveFocus() == false);
@@ -250,7 +247,7 @@ void tst_qsgfocusscope::textEdit()
     QVERIFY(item3 != 0);
 
     view->show();
-    qApp->setActiveWindow(view);
+    view->requestActivateWindow();
     qApp->processEvents();
 
 #ifdef Q_WS_X11
@@ -258,7 +255,7 @@ void tst_qsgfocusscope::textEdit()
     qt_x11_wait_for_window_manager(view);
 #endif
 
-    QVERIFY(view->hasFocus());
+    QVERIFY(view->windowState() == Qt::WindowActive);
     QVERIFY(item0->hasActiveFocus() == true);
     QVERIFY(item1->hasActiveFocus() == true);
     QVERIFY(item2->hasActiveFocus() == false);
@@ -308,7 +305,7 @@ void tst_qsgfocusscope::forceFocus()
     QVERIFY(item5 != 0);
 
     view->show();
-    qApp->setActiveWindow(view);
+    view->requestActivateWindow();
     qApp->processEvents();
 
 #ifdef Q_WS_X11
@@ -316,7 +313,7 @@ void tst_qsgfocusscope::forceFocus()
     qt_x11_wait_for_window_manager(view);
 #endif
 
-    QVERIFY(view->hasFocus());
+    QVERIFY(view->windowState() == Qt::WindowActive);
     QVERIFY(item0->hasActiveFocus() == true);
     QVERIFY(item1->hasActiveFocus() == true);
     QVERIFY(item2->hasActiveFocus() == false);
@@ -350,7 +347,7 @@ void tst_qsgfocusscope::noParentFocus()
     QVERIFY(view->rootObject());
 
     view->show();
-    qApp->setActiveWindow(view);
+    view->requestActivateWindow();
     qApp->processEvents();
 
 #ifdef Q_WS_X11
@@ -382,7 +379,7 @@ void tst_qsgfocusscope::signalEmission()
     QVERIFY(item4 != 0);
 
     view->show();
-    qApp->setActiveWindow(view);
+    view->requestActivateWindow();
     qApp->processEvents();
 
 #ifdef Q_WS_X11
@@ -393,7 +390,7 @@ void tst_qsgfocusscope::signalEmission()
     QVariant blue(QColor("blue"));
     QVariant red(QColor("red"));
 
-    QVERIFY(view->hasFocus());
+    QVERIFY(view->windowState() == Qt::WindowActive);
     item1->setFocus(true);
     QCOMPARE(item1->property("color"), red);
     QCOMPARE(item2->property("color"), blue);
@@ -434,7 +431,7 @@ void tst_qsgfocusscope::qtBug13380()
 
     view->show();
     QVERIFY(view->rootObject());
-    qApp->setActiveWindow(view);
+    view->requestActivateWindow();
     qApp->processEvents();
 
 #ifdef Q_WS_X11
@@ -442,7 +439,7 @@ void tst_qsgfocusscope::qtBug13380()
     qt_x11_wait_for_window_manager(view);
 #endif
 
-    QVERIFY(view->hasFocus());
+    QVERIFY(view->windowState() == Qt::WindowActive);
     QVERIFY(view->rootObject()->property("noFocus").toBool());
 
     view->rootObject()->setProperty("showRect", true);
@@ -457,7 +454,7 @@ void tst_qsgfocusscope::forceActiveFocus()
     view->setSource(QUrl::fromLocalFile(SRCDIR "/data/forceActiveFocus.qml"));
 
     view->show();
-    qApp->setActiveWindow(view);
+    view->requestActivateWindow();
     qApp->processEvents();
 
 #ifdef Q_WS_X11
@@ -600,7 +597,7 @@ void tst_qsgfocusscope::canvasFocus()
     QSignalSpy item2ActiveFocusSpy(item2, SIGNAL(activeFocusChanged(bool)));
 
     // until the canvas widget has gained focus, no one should have active focus
-    QCOMPARE(view->hasFocus(), false);
+    QCOMPARE((view->windowState() == Qt::WindowActive), false);
     QCOMPARE(rootItem->hasFocus(), false);
     QCOMPARE(rootItem->hasActiveFocus(), false);
     QCOMPARE(scope1->hasFocus(), true);
@@ -613,7 +610,7 @@ void tst_qsgfocusscope::canvasFocus()
     QCOMPARE(item2->hasActiveFocus(), false);
 
     view->show();
-    qApp->setActiveWindow(view);
+    view->requestActivateWindow();
     qApp->processEvents();
 
 #ifdef Q_WS_X11
@@ -622,7 +619,7 @@ void tst_qsgfocusscope::canvasFocus()
 #endif
 
     // Now the canvas has focus, active focus given to item1
-    QTRY_COMPARE(view->hasFocus(), true);
+    QTRY_COMPARE((view->windowState() == Qt::WindowActive), true);
     QCOMPARE(rootItem->hasFocus(), true);
     QCOMPARE(rootItem->hasActiveFocus(), true);
     QCOMPARE(scope1->hasFocus(), true);
@@ -640,7 +637,8 @@ void tst_qsgfocusscope::canvasFocus()
     QCOMPARE(item1FocusSpy.count(), 0);
     QCOMPARE(item1ActiveFocusSpy.count(), 1);
 
-    view->clearFocus();
+
+    view->setWindowState(Qt::WindowNoState);
     QCOMPARE(rootItem->hasFocus(), false);
     QCOMPARE(rootItem->hasActiveFocus(), false);
     QCOMPARE(scope1->hasFocus(), true);
@@ -680,7 +678,7 @@ void tst_qsgfocusscope::canvasFocus()
     QCOMPARE(item2ActiveFocusSpy.count(), 0);
 
     // give the canvas focus, and item2 will get active focus
-    view->setFocus();
+    view->setWindowState(Qt::WindowActive);
 
     QCOMPARE(rootItem->hasFocus(), true);
     QCOMPARE(rootItem->hasActiveFocus(), true);
index 49c3080..5933ee1 100644 (file)
@@ -40,7 +40,7 @@
 ****************************************************************************/
 
 #include <QtTest/QtTest>
-#include <QtGui/qstringlistmodel.h>
+#include <QtWidgets/qstringlistmodel.h>
 #include <QtDeclarative/qsgview.h>
 #include <QtDeclarative/qdeclarativeengine.h>
 #include <QtDeclarative/qdeclarativecomponent.h>
@@ -141,9 +141,6 @@ void tst_qsggridview_move(int from, int to, int n, T *items)
 
 void tst_QSGGridView::initTestCase()
 {
-    QSGView canvas;
-    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
-        QSKIP("QSGGridView needs OpenGL 2.0", SkipAll);
 }
 
 void tst_QSGGridView::cleanupTestCase()
@@ -810,7 +807,7 @@ void tst_QSGGridView::currentIndex()
         model.addItem("Item" + QString::number(i), QString::number(i));
 
     QSGView *canvas = new QSGView(0);
-    canvas->setFixedSize(240,320);
+    canvas->setGeometry(0,0,240,320);
     canvas->show();
 
     QDeclarativeContext *ctxt = canvas->rootContext();
@@ -901,12 +898,12 @@ void tst_QSGGridView::currentIndex()
 
 
     // Test keys
-    qApp->setActiveWindow(canvas);
+    canvas->requestActivateWindow();
 #ifdef Q_WS_X11
     // to be safe and avoid failing setFocus with window managers
     qt_x11_wait_for_window_manager(canvas);
 #endif
-    QTRY_VERIFY(canvas->hasFocus());
+    QTRY_VERIFY(canvas->windowState() == Qt::WindowActive);
     qApp->processEvents();
 
     gridview->setCurrentIndex(0);
@@ -938,12 +935,12 @@ void tst_QSGGridView::currentIndex()
 
     gridview->setFlow(QSGGridView::TopToBottom);
 
-    qApp->setActiveWindow(canvas);
+    canvas->requestActivateWindow();
 #ifdef Q_WS_X11
     // to be safe and avoid failing setFocus with window managers
     qt_x11_wait_for_window_manager(canvas);
 #endif
-    QTRY_VERIFY(canvas->hasFocus());
+    QTRY_VERIFY((canvas->windowState() == Qt::WindowActive));
     qApp->processEvents();
 
     QTest::keyClick(canvas, Qt::Key_Right);
@@ -1005,12 +1002,12 @@ void tst_QSGGridView::currentIndex()
     gridview->setFlow(QSGGridView::LeftToRight);
     gridview->setLayoutDirection(Qt::RightToLeft);
 
-    qApp->setActiveWindow(canvas);
+    canvas->requestActivateWindow();
 #ifdef Q_WS_X11
     // to be safe and avoid failing setFocus with window managers
     qt_x11_wait_for_window_manager(canvas);
 #endif
-    QTRY_VERIFY(canvas->hasFocus());
+    QTRY_VERIFY(canvas->windowState() == Qt::WindowActive);
     qApp->processEvents();
 
     gridview->setCurrentIndex(35);
@@ -1061,7 +1058,7 @@ void tst_QSGGridView::noCurrentIndex()
         model.addItem("Item" + QString::number(i), QString::number(i));
 
     QSGView *canvas = new QSGView(0);
-    canvas->setFixedSize(240,320);
+    canvas->setGeometry(0,0,240,320);
 
     QDeclarativeContext *ctxt = canvas->rootContext();
     ctxt->setContextProperty("testModel", &model);
@@ -2353,7 +2350,7 @@ void tst_QSGGridView::onAdd()
     const int delegateHeight = 100;
     TestModel model;
     QSGView *canvas = createView();
-    canvas->setFixedSize(5 * delegateWidth, 5 * delegateHeight); // just ensure all items fit
+    canvas->setGeometry(0,0,5 * delegateWidth, 5 * delegateHeight); // just ensure all items fit
 
     // these initial items should not trigger GridView.onAdd
     for (int i=0; i<initialItemCount; i++)
@@ -2497,7 +2494,7 @@ void tst_QSGGridView::testQtQuick11Attributes_data()
 QSGView *tst_QSGGridView::createView()
 {
     QSGView *canvas = new QSGView(0);
-    canvas->setFixedSize(240,320);
+    canvas->setGeometry(0,0,240,320);
 
     return canvas;
 }
index 1eecd58..2b81f7c 100644 (file)
@@ -151,9 +151,6 @@ private:
 
 void tst_QSGListView::initTestCase()
 {
-    QSGView canvas;
-    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
-        QSKIP("QSGListView needs OpenGL 2.0", SkipAll);
 }
 
 void tst_QSGListView::cleanupTestCase()
@@ -1430,7 +1427,7 @@ void tst_QSGListView::currentIndex()
         model.addItem("Item" + QString::number(i), QString::number(i));
 
     QSGView *canvas = new QSGView(0);
-    canvas->setFixedSize(240,320);
+    canvas->setGeometry(0,0,240,320);
 
     QDeclarativeContext *ctxt = canvas->rootContext();
     ctxt->setContextProperty("testModel", &model);
@@ -1504,12 +1501,12 @@ void tst_QSGListView::currentIndex()
 
     // Test keys
     canvas->show();
-    qApp->setActiveWindow(canvas);
+    canvas->requestActivateWindow();
 #ifdef Q_WS_X11
     // to be safe and avoid failing setFocus with window managers
     qt_x11_wait_for_window_manager(canvas);
 #endif
-    QTRY_VERIFY(canvas->hasFocus());
+    QTRY_VERIFY(canvas->windowState() == Qt::WindowActive);
     qApp->processEvents();
 
     listview->setCurrentIndex(0);
@@ -1571,7 +1568,7 @@ void tst_QSGListView::noCurrentIndex()
         model.addItem("Item" + QString::number(i), QString::number(i));
 
     QSGView *canvas = new QSGView(0);
-    canvas->setFixedSize(240,320);
+    canvas->setGeometry(0,0,240,320);
 
     QDeclarativeContext *ctxt = canvas->rootContext();
     ctxt->setContextProperty("testModel", &model);
@@ -2088,7 +2085,7 @@ void tst_QSGListView::QTBUG_9791()
 void tst_QSGListView::manualHighlight()
 {
     QSGView *canvas = new QSGView(0);
-    canvas->setFixedSize(240,320);
+    canvas->setGeometry(0,0,240,320);
 
     QString filename(SRCDIR "/data/manual-highlight.qml");
     canvas->setSource(QUrl::fromLocalFile(filename));
@@ -2890,7 +2887,7 @@ void tst_QSGListView::onAdd()
         model.addItem("dummy value", "dummy value");
 
     QSGView *canvas = createView();
-    canvas->setFixedSize(200, delegateHeight * (initialItemCount + itemsToAdd));
+    canvas->setGeometry(0,0,200, delegateHeight * (initialItemCount + itemsToAdd));
     QDeclarativeContext *ctxt = canvas->rootContext();
     ctxt->setContextProperty("testModel", &model);
     ctxt->setContextProperty("delegateHeight", delegateHeight);
@@ -2987,7 +2984,7 @@ void tst_QSGListView::onRemove_data()
 void tst_QSGListView::rightToLeft()
 {
     QSGView *canvas = createView();
-    canvas->setFixedSize(640,320);
+    canvas->setGeometry(0,0,640,320);
     canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml"));
     qApp->processEvents();
 
@@ -3171,7 +3168,7 @@ void tst_QSGListView::qAbstractItemModel_clear()
 QSGView *tst_QSGListView::createView()
 {
     QSGView *canvas = new QSGView(0);
-    canvas->setFixedSize(240,320);
+    canvas->setGeometry(0,0,240,320);
 
     return canvas;
 }
index 96a591f..a5f1278 100644 (file)
@@ -127,9 +127,6 @@ private:
 
 void tst_QSGPathView::initTestCase()
 {
-    QSGView canvas;
-    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
-        QSKIP("PathView needs OpenGL 2.0", SkipAll);
 }
 
 void tst_QSGPathView::cleanupTestCase()
@@ -979,9 +976,9 @@ void tst_QSGPathView::mouseDrag()
     QSGView *canvas = createView();
     canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragpath.qml"));
     canvas->show();
-    QApplication::setActiveWindow(canvas);
+    canvas->requestActivateWindow();
     QTest::qWaitForWindowShown(canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+    QTRY_COMPARE(canvas->windowState(), Qt::WindowActive);
 
     QSGPathView *pathview = qobject_cast<QSGPathView*>(canvas->rootObject());
     QVERIFY(pathview != 0);
@@ -1037,12 +1034,12 @@ void tst_QSGPathView::treeModel()
 void tst_QSGPathView::changePreferredHighlight()
 {
     QSGView *canvas = createView();
-    canvas->setFixedSize(400,200);
+    canvas->setGeometry(0,0,400,200);
     canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragpath.qml"));
     canvas->show();
-    QApplication::setActiveWindow(canvas);
+    canvas->requestActivateWindow();
     QTest::qWaitForWindowShown(canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+    QTRY_COMPARE(canvas->windowState(), Qt::WindowActive);
 
     QSGPathView *pathview = qobject_cast<QSGPathView*>(canvas->rootObject());
     QVERIFY(pathview != 0);
@@ -1076,7 +1073,7 @@ void tst_QSGPathView::changePreferredHighlight()
 QSGView *tst_QSGPathView::createView()
 {
     QSGView *canvas = new QSGView(0);
-    canvas->setFixedSize(240,320);
+    canvas->setGeometry(0,0,240,320);
 
     return canvas;
 }
index 2e93f71..d71c999 100644 (file)
@@ -68,9 +68,6 @@ private:
 };
 void tst_QSGPinchArea::initTestCase()
 {
-    QSGView canvas;
-    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
-        QSKIP("PinchArea needs OpenGL 2.0", SkipAll);
 }
 
 void tst_QSGPinchArea::cleanupTestCase()
@@ -82,7 +79,7 @@ void tst_QSGPinchArea::pinchProperties()
     QSGView *canvas = createView();
     canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml"));
     canvas->show();
-    canvas->setFocus();
+    canvas->requestActivateWindow();
     QVERIFY(canvas->rootObject() != 0);
 
     QSGPinchArea *pinchArea = canvas->rootObject()->findChild<QSGPinchArea*>("pincharea");
@@ -208,7 +205,7 @@ void tst_QSGPinchArea::scale()
     QSGView *canvas = createView();
     canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml"));
     canvas->show();
-    canvas->setFocus();
+    canvas->requestActivateWindow();
     QTest::qWaitForWindowShown(canvas);
     QVERIFY(canvas->rootObject() != 0);
     qApp->processEvents();
@@ -228,17 +225,17 @@ void tst_QSGPinchArea::scale()
     QPoint p1(80, 80);
     QPoint p2(100, 100);
 
-    QTest::touchEvent(canvas).press(0, p1);
-    QTest::touchEvent(canvas).stationary(0).press(1, p2);
+    QTest::touchEvent(canvas).press(0, p1, canvas);
+    QTest::touchEvent(canvas).stationary(0).press(1, p2, canvas);
     p1 -= QPoint(10,10);
     p2 += QPoint(10,10);
-    QTest::touchEvent(canvas).move(0, p1).move(1, p2);
+    QTest::touchEvent(canvas).move(0, p1,canvas).move(1, p2,canvas);
 
     QCOMPARE(root->property("scale").toReal(), 1.0);
 
     p1 -= QPoint(10,10);
     p2 += QPoint(10,10);
-    QTest::touchEvent(canvas).move(0, p1).move(1, p2);
+    QTest::touchEvent(canvas).move(0, p1,canvas).move(1, p2,canvas);
 
     QCOMPARE(root->property("scale").toReal(), 1.5);
     QCOMPARE(root->property("center").toPointF(), QPointF(40, 40)); // blackrect is at 50,50
@@ -247,11 +244,11 @@ void tst_QSGPinchArea::scale()
     // scale beyond bound
     p1 -= QPoint(50,50);
     p2 += QPoint(50,50);
-    QTest::touchEvent(canvas).move(0, p1).move(1, p2);
+    QTest::touchEvent(canvas).move(0, p1, canvas).move(1, p2, canvas);
 
     QCOMPARE(blackRect->scale(), 2.0);
 
-    QTest::touchEvent(canvas).release(0, p1).release(1, p2);
+    QTest::touchEvent(canvas).release(0, p1, canvas).release(1, p2, canvas);
 
     delete canvas;
 }
@@ -261,7 +258,7 @@ void tst_QSGPinchArea::pan()
     QSGView *canvas = createView();
     canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml"));
     canvas->show();
-    canvas->setFocus();
+    canvas->requestActivateWindow();
     QTest::qWaitForWindowShown(canvas);
     QVERIFY(canvas->rootObject() != 0);
     qApp->processEvents();
@@ -281,17 +278,17 @@ void tst_QSGPinchArea::pan()
     QPoint p1(80, 80);
     QPoint p2(100, 100);
 
-    QTest::touchEvent(canvas).press(0, p1);
-    QTest::touchEvent(canvas).stationary(0).press(1, p2);
+    QTest::touchEvent(canvas).press(0, p1, canvas);
+    QTest::touchEvent(canvas).stationary(0).press(1, p2, canvas);
     p1 += QPoint(10,10);
     p2 += QPoint(10,10);
-    QTest::touchEvent(canvas).move(0, p1).move(1, p2);
+    QTest::touchEvent(canvas).move(0, p1, canvas).move(1, p2, canvas);
 
     QCOMPARE(root->property("scale").toReal(), 1.0);
 
     p1 += QPoint(10,10);
     p2 += QPoint(10,10);
-    QTest::touchEvent(canvas).move(0, p1).move(1, p2);
+    QTest::touchEvent(canvas).move(0, p1, canvas).move(1, p2, canvas);
 
     QCOMPARE(root->property("center").toPointF(), QPointF(60, 60)); // blackrect is at 50,50
 
@@ -301,12 +298,12 @@ void tst_QSGPinchArea::pan()
     // pan x beyond bound
     p1 += QPoint(100,100);
     p2 += QPoint(100,100);
-    QTest::touchEvent(canvas).move(0, p1).move(1, p2);
+    QTest::touchEvent(canvas).move(0, p1, canvas).move(1, p2, canvas);
 
     QCOMPARE(blackRect->x(), 140.0);
     QCOMPARE(blackRect->y(), 160.0);
 
-    QTest::touchEvent(canvas).release(0, p1).release(1, p2);
+    QTest::touchEvent(canvas).release(0, p1, canvas).release(1, p2, canvas);
 
     delete canvas;
 }
@@ -317,7 +314,7 @@ void tst_QSGPinchArea::retouch()
     QSGView *canvas = createView();
     canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml"));
     canvas->show();
-    canvas->setFocus();
+    canvas->requestActivateWindow();
     QTest::qWaitForWindowShown(canvas);
     QVERIFY(canvas->rootObject() != 0);
     qApp->processEvents();
@@ -340,17 +337,17 @@ void tst_QSGPinchArea::retouch()
     QPoint p1(80, 80);
     QPoint p2(100, 100);
 
-    QTest::touchEvent(canvas).press(0, p1);
-    QTest::touchEvent(canvas).stationary(0).press(1, p2);
+    QTest::touchEvent(canvas).press(0, p1, canvas);
+    QTest::touchEvent(canvas).stationary(0).press(1, p2, canvas);
     p1 -= QPoint(10,10);
     p2 += QPoint(10,10);
-    QTest::touchEvent(canvas).move(0, p1).move(1, p2);
+    QTest::touchEvent(canvas).move(0, p1, canvas).move(1, p2, canvas);
 
     QCOMPARE(root->property("scale").toReal(), 1.0);
 
     p1 -= QPoint(10,10);
     p2 += QPoint(10,10);
-    QTest::touchEvent(canvas).move(0, p1).move(1, p2);
+    QTest::touchEvent(canvas).move(0, p1, canvas).move(1, p2, canvas);
 
     QCOMPARE(startedSpy.count(), 1);
 
@@ -363,17 +360,17 @@ void tst_QSGPinchArea::retouch()
     QCOMPARE(startedSpy.count(), 1);
     QCOMPARE(finishedSpy.count(), 0);
 
-    QTest::touchEvent(canvas).stationary(0).release(1, p2);
+    QTest::touchEvent(canvas).stationary(0).release(1, p2, canvas);
 
     QCOMPARE(startedSpy.count(), 1);
     QCOMPARE(finishedSpy.count(), 0);
 
     QCOMPARE(canvas->rootObject()->property("pointCount").toInt(), 1);
 
-    QTest::touchEvent(canvas).stationary(0).press(1, p2);
+    QTest::touchEvent(canvas).stationary(0).press(1, p2, canvas);
     p1 -= QPoint(10,10);
     p2 += QPoint(10,10);
-    QTest::touchEvent(canvas).move(0, p1).move(1, p2);
+    QTest::touchEvent(canvas).move(0, p1, canvas).move(1, p2, canvas);
 
     // Lifting and retouching results in onPinchStarted being called again
     QCOMPARE(startedSpy.count(), 2);
@@ -381,7 +378,7 @@ void tst_QSGPinchArea::retouch()
 
     QCOMPARE(canvas->rootObject()->property("pointCount").toInt(), 2);
 
-    QTest::touchEvent(canvas).release(0, p1).release(1, p2);
+    QTest::touchEvent(canvas).release(0, p1, canvas).release(1, p2, canvas);
 
     QCOMPARE(startedSpy.count(), 2);
     QCOMPARE(finishedSpy.count(), 1);
@@ -393,8 +390,7 @@ void tst_QSGPinchArea::retouch()
 QSGView *tst_QSGPinchArea::createView()
 {
     QSGView *canvas = new QSGView(0);
-    canvas->setAttribute(Qt::WA_AcceptTouchEvents);
-    canvas->setFixedSize(240,320);
+    canvas->setGeometry(0,0,240,320);
 
     return canvas;
 }
index 0a1c4df..e425e33 100644 (file)
@@ -47,7 +47,7 @@
 #include <private/qdeclarativetransition_p.h>
 #include <private/qsgitem_p.h>
 #include <qdeclarativeexpression.h>
-#include <QtGui/qgraphicswidget.h>
+#include <QtWidgets/qgraphicswidget.h>
 #include "../../../shared/util.h"
 
 #ifdef Q_OS_SYMBIAN
index 012d905..9eb8813 100644 (file)
@@ -642,7 +642,7 @@ void tst_QSGRepeater::properties()
 QSGView *tst_QSGRepeater::createView()
 {
     QSGView *canvas = new QSGView(0);
-    canvas->setFixedSize(240,320);
+    canvas->setGeometry(0,0,240,320);
 
     return canvas;
 }
index 2a94e20..79ff8ea 100644 (file)
@@ -59,7 +59,7 @@
 #include <QInputContext>
 #include <QClipboard>
 #include <QMimeData>
-#include <private/qapplication_p.h>
+#include <QtWidgets/5.0.0/QtWidgets/private/qapplication_p.h>
 #include <private/qtextcontrol_p.h>
 #include <QtOpenGL/QGLShaderProgram>
 
@@ -177,9 +177,6 @@ private:
 };
 void tst_qsgtextedit::initTestCase()
 {
-    QSGView canvas;
-    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
-        QSKIP("TextEdit item needs OpenGL 2.0", SkipAll);
 }
 
 void tst_qsgtextedit::cleanupTestCase()
@@ -431,9 +428,9 @@ void tst_qsgtextedit::alignments()
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/alignments.qml"));
 
     canvas.show();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&canvas));
+    QTRY_COMPARE(canvas.windowState(), Qt::WindowActive);
 
     QObject *ob = canvas.rootObject();
     QVERIFY(ob != 0);
@@ -956,10 +953,10 @@ void tst_qsgtextedit::keySelection()
 {
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
     canvas.show();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&canvas));
-    canvas.setFocus();
+    QTRY_COMPARE(canvas.windowState(), Qt::WindowActive);
+    canvas.requestActivateWindow();
 
     QVERIFY(canvas.rootObject() != 0);
 
@@ -1357,9 +1354,9 @@ void tst_qsgtextedit::mouseSelection()
     QSGView canvas(QUrl::fromLocalFile(qmlfile));
 
     canvas.show();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&canvas));
+    QTRY_COMPARE(canvas.windowState(), Qt::WindowActive);
 
     QVERIFY(canvas.rootObject() != 0);
     QSGTextEdit *textEditObject = qobject_cast<QSGTextEdit *>(canvas.rootObject());
@@ -1388,9 +1385,9 @@ void tst_qsgtextedit::dragMouseSelection()
     QSGView canvas(QUrl::fromLocalFile(qmlfile));
 
     canvas.show();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&canvas));
+    QTRY_COMPARE(canvas.windowState(), Qt::WindowActive);
 
     QVERIFY(canvas.rootObject() != 0);
     QSGTextEdit *textEditObject = qobject_cast<QSGTextEdit *>(canvas.rootObject());
@@ -1445,9 +1442,9 @@ void tst_qsgtextedit::mouseSelectionMode()
     QSGView canvas(QUrl::fromLocalFile(qmlfile));
 
     canvas.show();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&canvas));
+    QTRY_COMPARE(canvas.windowState(), Qt::WindowActive);
 
     QVERIFY(canvas.rootObject() != 0);
     QSGTextEdit *textEditObject = qobject_cast<QSGTextEdit *>(canvas.rootObject());
@@ -1475,7 +1472,7 @@ void tst_qsgtextedit::inputMethodHints()
 {
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/inputmethodhints.qml"));
     canvas.show();
-    canvas.setFocus();
+    canvas.requestActivateWindow();
 
     QVERIFY(canvas.rootObject() != 0);
     QSGTextEdit *textEditObject = qobject_cast<QSGTextEdit *>(canvas.rootObject());
@@ -1490,8 +1487,8 @@ void tst_qsgtextedit::positionAt()
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/positionAt.qml"));
     QVERIFY(canvas.rootObject() != 0);
     canvas.show();
-    canvas.setFocus();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
 
     QSGTextEdit *texteditObject = qobject_cast<QSGTextEdit *>(canvas.rootObject());
@@ -1558,7 +1555,7 @@ void tst_qsgtextedit::cursorDelegate()
 {
     QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorTest.qml"));
     view.show();
-    view.setFocus();
+    view.requestActivateWindow();
     QSGTextEdit *textEditObject = view.rootObject()->findChild<QSGTextEdit*>("textEditObject");
     QVERIFY(textEditObject != 0);
     QVERIFY(textEditObject->findChild<QSGItem*>("cursorInstance"));
@@ -1584,10 +1581,10 @@ void tst_qsgtextedit::cursorVisible()
 {
     QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorVisible.qml"));
     view.show();
-    QApplication::setActiveWindow(&view);
+    view.requestActivateWindow();
     QTest::qWaitForWindowShown(&view);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
-    view.setFocus();
+    QTRY_COMPARE(view.windowState(), Qt::WindowActive);
+    view.requestActivateWindow();
 
     QSGTextEdit edit;
     QSignalSpy spy(&edit, SIGNAL(cursorVisibleChanged(bool)));
@@ -1618,11 +1615,11 @@ void tst_qsgtextedit::cursorVisible()
     QCOMPARE(edit.isCursorVisible(), true);
     QCOMPARE(spy.count(), 5);
 
-    view.clearFocus();
+    view.setWindowState(Qt::WindowNoState);
     QCOMPARE(edit.isCursorVisible(), false);
     QCOMPARE(spy.count(), 6);
 
-    view.setFocus();
+    view.requestActivateWindow();
     QCOMPARE(edit.isCursorVisible(), true);
     QCOMPARE(spy.count(), 7);
 
@@ -1634,8 +1631,9 @@ void tst_qsgtextedit::cursorVisible()
     QCOMPARE(edit.isCursorVisible(), false);
     QCOMPARE(spy.count(), 8);
 
-    QApplication::setActiveWindow(&view);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+    view.requestActivateWindow();
+    QTest::qWaitForWindowShown(&view);
+    QTRY_COMPARE(view.windowState(), Qt::WindowActive);
     QCOMPARE(edit.isCursorVisible(), true);
     QCOMPARE(spy.count(), 9);
 #endif
@@ -1664,7 +1662,7 @@ void tst_qsgtextedit::delegateLoading()
 
     QSGView view(QUrl(QLatin1String("http://localhost:42332/") + qmlfile));
     view.show();
-    view.setFocus();
+    view.requestActivateWindow();
 
     if (!error.isEmpty()) {
         QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
@@ -1701,7 +1699,7 @@ void tst_qsgtextedit::navigation()
 {
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
     canvas.show();
-    canvas.setFocus();
+    canvas.requestActivateWindow();
 
     QVERIFY(canvas.rootObject() != 0);
 
@@ -1821,7 +1819,7 @@ void tst_qsgtextedit::readOnly()
 {
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/readOnly.qml"));
     canvas.show();
-    canvas.setFocus();
+    canvas.requestActivateWindow();
 
     QVERIFY(canvas.rootObject() != 0);
 
@@ -1914,9 +1912,9 @@ void tst_qsgtextedit::textInput()
 {
     QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputMethodEvent.qml"));
     view.show();
-    QApplication::setActiveWindow(&view);
+    view.requestActivateWindow();
     QTest::qWaitForWindowShown(&view);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+    QTRY_COMPARE(view.windowState(), Qt::WindowActive);
     QSGTextEdit *edit = qobject_cast<QSGTextEdit *>(view.rootObject());
     QVERIFY(edit);
     QVERIFY(edit->hasActiveFocus() == true);
index 32e59c2..7da6ee2 100644 (file)
@@ -50,7 +50,7 @@
 #include <QDir>
 #include <QStyle>
 #include <QInputContext>
-#include <private/qapplication_p.h>
+#include <QtWidgets/5.0.0/QtWidgets/private/qapplication_p.h>
 #include <private/qsgdistancefieldglyphcache_p.h>
 #include <QtOpenGL/QGLShaderProgram>
 #include <math.h>
@@ -151,9 +151,6 @@ private:
 };
 void tst_qsgtextinput::initTestCase()
 {
-    QSGView canvas;
-    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
-        QSKIP("TextInput item needs OpenGL 2.0", SkipAll);
 }
 
 void tst_qsgtextinput::cleanupTestCase()
@@ -959,9 +956,10 @@ void tst_qsgtextinput::dragMouseSelection()
     QSGView canvas(QUrl::fromLocalFile(qmlfile));
 
     canvas.show();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&canvas));
+
+    QTRY_COMPARE(canvas.windowState(), Qt::WindowActive);
 
     QVERIFY(canvas.rootObject() != 0);
     QSGTextInput *textInputObject = qobject_cast<QSGTextInput *>(canvas.rootObject());
@@ -1017,9 +1015,9 @@ void tst_qsgtextinput::mouseSelectionMode()
     QSGView canvas(QUrl::fromLocalFile(qmlfile));
 
     canvas.show();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&canvas));
+    QTRY_COMPARE(canvas.windowState(), Qt::WindowActive);
 
     QVERIFY(canvas.rootObject() != 0);
     QSGTextInput *textInputObject = qobject_cast<QSGTextInput *>(canvas.rootObject());
@@ -1061,9 +1059,9 @@ void tst_qsgtextinput::horizontalAlignment()
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment.qml"));
 
     canvas.show();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&canvas));
+    QTRY_COMPARE(canvas.windowState(), Qt::WindowActive);
     QObject *ob = canvas.rootObject();
     QVERIFY(ob != 0);
     ob->setProperty("horizontalAlignment",hAlign);
@@ -1179,8 +1177,7 @@ void tst_qsgtextinput::positionAt()
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/positionAt.qml"));
     QVERIFY(canvas.rootObject() != 0);
     canvas.show();
-    canvas.setFocus();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
 
     QSGTextInput *textinputObject = qobject_cast<QSGTextInput *>(canvas.rootObject());
@@ -1311,8 +1308,7 @@ void tst_qsgtextinput::maxLength()
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/maxLength.qml"));
     QVERIFY(canvas.rootObject() != 0);
     canvas.show();
-    canvas.setFocus();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
 
     QSGTextInput *textinputObject = qobject_cast<QSGTextInput *>(canvas.rootObject());
@@ -1341,7 +1337,7 @@ void tst_qsgtextinput::masks()
     //QString componentStr = "import QtQuick 2.0\nTextInput {  inputMask: 'HHHHhhhh'; }";
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/masks.qml"));
     canvas.show();
-    canvas.setFocus();
+    canvas.requestActivateWindow();
     QVERIFY(canvas.rootObject() != 0);
     QSGTextInput *textinputObject = qobject_cast<QSGTextInput *>(canvas.rootObject());
     QVERIFY(textinputObject != 0);
@@ -1365,7 +1361,7 @@ void tst_qsgtextinput::validators()
 
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/validators.qml"));
     canvas.show();
-    canvas.setFocus();
+    canvas.requestActivateWindow();
 
     QVERIFY(canvas.rootObject() != 0);
 
@@ -1453,8 +1449,7 @@ void tst_qsgtextinput::inputMethods()
 {
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/inputmethods.qml"));
     canvas.show();
-    canvas.setFocus();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
 
     // test input method hints
@@ -1501,7 +1496,7 @@ void tst_qsgtextinput::navigation()
 {
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
     canvas.show();
-    canvas.setFocus();
+    canvas.requestActivateWindow();
 
     QVERIFY(canvas.rootObject() != 0);
 
@@ -1540,7 +1535,7 @@ void tst_qsgtextinput::navigation_RTL()
 {
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
     canvas.show();
-    canvas.setFocus();
+    canvas.requestActivateWindow();
 
     QVERIFY(canvas.rootObject() != 0);
 
@@ -1712,7 +1707,7 @@ void tst_qsgtextinput::cursorDelegate()
 {
     QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorTest.qml"));
     view.show();
-    view.setFocus();
+    view.requestActivateWindow();
     QSGTextInput *textInputObject = view.rootObject()->findChild<QSGTextInput*>("textInputObject");
     QVERIFY(textInputObject != 0);
     QVERIFY(textInputObject->findChild<QSGItem*>("cursorInstance"));
@@ -1738,10 +1733,9 @@ void tst_qsgtextinput::cursorVisible()
 {
     QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorVisible.qml"));
     view.show();
-    QApplication::setActiveWindow(&view);
+    view.requestActivateWindow();
     QTest::qWaitForWindowShown(&view);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
-    view.setFocus();
+    QTRY_COMPARE(view.windowState(), Qt::WindowActive);
 
     QSGTextInput input;
     QSignalSpy spy(&input, SIGNAL(cursorVisibleChanged(bool)));
@@ -1772,11 +1766,11 @@ void tst_qsgtextinput::cursorVisible()
     QCOMPARE(input.isCursorVisible(), true);
     QCOMPARE(spy.count(), 5);
 
-    view.clearFocus();
+    view.setWindowState(Qt::WindowNoState);
     QCOMPARE(input.isCursorVisible(), false);
     QCOMPARE(spy.count(), 6);
 
-    view.setFocus();
+    view.requestActivateWindow();
     QCOMPARE(input.isCursorVisible(), true);
     QCOMPARE(spy.count(), 7);
 
@@ -1788,8 +1782,8 @@ void tst_qsgtextinput::cursorVisible()
     QCOMPARE(input.isCursorVisible(), false);
     QCOMPARE(spy.count(), 8);
 
-    QApplication::setActiveWindow(&view);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+    view.requestActivateWindow();
+    QTRY_COMPARE(view.windowState(), Qt::WindowActive);
     QCOMPARE(input.isCursorVisible(), true);
     QCOMPARE(spy.count(), 9);
 #endif
@@ -1852,7 +1846,7 @@ void tst_qsgtextinput::readOnly()
 {
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/readOnly.qml"));
     canvas.show();
-    canvas.setFocus();
+    canvas.requestActivateWindow();
 
     QVERIFY(canvas.rootObject() != 0);
 
@@ -1879,10 +1873,9 @@ void tst_qsgtextinput::echoMode()
 {
     QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/echoMode.qml"));
     canvas.show();
-    canvas.setFocus();
-    QApplication::setActiveWindow(&canvas);
+    canvas.requestActivateWindow();
     QTest::qWaitForWindowShown(&canvas);
-    QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&canvas));
+    QTRY_COMPARE(canvas.windowState(), Qt::WindowActive);
 
     QVERIFY(canvas.rootObject() != 0);
 
index 40fddef..17405ac 100644 (file)
@@ -140,9 +140,6 @@ private:
 };
 void tst_qsgvisualdatamodel::initTestCase()
 {
-    QSGView canvas;
-    if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
-        QSKIP("VisualDatamodel item needs OpenGL 2.0", SkipAll);
 }
 
 void tst_qsgvisualdatamodel::cleanupTestCase()
index c2e99c0..6c106d7 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 #############################################################################
 ##