TEMPLATE=subdirs
SUBDIRS=\
- declarative \
- qtquick1 \
+ declarative
+
contains(QT_CONFIG, qmltest): SUBDIRS += qmltest
qsgpositioners \
qsgrepeater \
qsgtext \
- qsgtextedit \
- qsgtextinput \
+ # qsgtextedit \
+ # qsgtextinput \
qsgvisualdatamodel \
#include <private/qsgnodeupdater_p.h>
#include <qsgsimplerectnode.h>
-
+#include <QtOpenGL/QGLWidget>
class NodesTest : public QObject
{
Q_OBJECT
// 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
load(qttest_p4)
-contains(QT_CONFIG,declarative): QT += declarative
+contains(QT_CONFIG,declarative): QT += declarative widgets
macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeproperty.cpp
#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>
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);
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);
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);
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);
QTest::touchEvent(canvas).press(0, topItem->mapToScene(pos).toPoint(),canvas);
QTest::qWait(50);
-
-
QCOMPARE(topItem->lastEvent.touchPoints.count(), 1);
QVERIFY(middleItem->lastEvent.touchPoints.isEmpty());
}
void tst_qsgflipable::initTestCase()
{
- QSGView canvas;
- if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
- QSKIP("Flipable item needs OpenGL 2.0", SkipAll);
}
void tst_qsgflipable::cleanupTestCase()
};
void tst_qsgfocusscope::initTestCase()
{
- QSGView canvas;
- if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
- QSKIP("FocusScope item needs OpenGL 2.0", SkipAll);
}
void tst_qsgfocusscope::cleanupTestCase()
QVERIFY(item3 != 0);
view->show();
- qApp->setActiveWindow(view);
+ view->requestActivateWindow();
qApp->processEvents();
#ifdef Q_WS_X11
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);
QVERIFY(item5 != 0);
view->show();
- qApp->setActiveWindow(view);
+ view->requestActivateWindow();
qApp->processEvents();
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(view);
#endif
- QVERIFY(view->hasFocus());
+ QVERIFY(view->windowState() == Qt::WindowActive);
QVERIFY(item1->hasActiveFocus() == true);
QVERIFY(item2->hasActiveFocus() == true);
QVERIFY(item3 != 0);
view->show();
- qApp->setActiveWindow(view);
+ view->requestActivateWindow();
qApp->processEvents();
#ifdef Q_WS_X11
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);
QVERIFY(item3 != 0);
view->show();
- qApp->setActiveWindow(view);
+ view->requestActivateWindow();
qApp->processEvents();
#ifdef Q_WS_X11
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);
QVERIFY(item5 != 0);
view->show();
- qApp->setActiveWindow(view);
+ view->requestActivateWindow();
qApp->processEvents();
#ifdef Q_WS_X11
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);
QVERIFY(view->rootObject());
view->show();
- qApp->setActiveWindow(view);
+ view->requestActivateWindow();
qApp->processEvents();
#ifdef Q_WS_X11
QVERIFY(item4 != 0);
view->show();
- qApp->setActiveWindow(view);
+ view->requestActivateWindow();
qApp->processEvents();
#ifdef Q_WS_X11
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);
view->show();
QVERIFY(view->rootObject());
- qApp->setActiveWindow(view);
+ view->requestActivateWindow();
qApp->processEvents();
#ifdef Q_WS_X11
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);
view->setSource(QUrl::fromLocalFile(SRCDIR "/data/forceActiveFocus.qml"));
view->show();
- qApp->setActiveWindow(view);
+ view->requestActivateWindow();
qApp->processEvents();
#ifdef Q_WS_X11
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);
QCOMPARE(item2->hasActiveFocus(), false);
view->show();
- qApp->setActiveWindow(view);
+ view->requestActivateWindow();
qApp->processEvents();
#ifdef Q_WS_X11
#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);
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);
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);
****************************************************************************/
#include <QtTest/QtTest>
-#include <QtGui/qstringlistmodel.h>
+#include <QtWidgets/qstringlistmodel.h>
#include <QtDeclarative/qsgview.h>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
void tst_QSGGridView::initTestCase()
{
- QSGView canvas;
- if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
- QSKIP("QSGGridView needs OpenGL 2.0", SkipAll);
}
void tst_QSGGridView::cleanupTestCase()
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();
// 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);
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);
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);
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);
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++)
QSGView *tst_QSGGridView::createView()
{
QSGView *canvas = new QSGView(0);
- canvas->setFixedSize(240,320);
+ canvas->setGeometry(0,0,240,320);
return canvas;
}
void tst_QSGListView::initTestCase()
{
- QSGView canvas;
- if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
- QSKIP("QSGListView needs OpenGL 2.0", SkipAll);
}
void tst_QSGListView::cleanupTestCase()
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);
// 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);
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);
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));
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);
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();
QSGView *tst_QSGListView::createView()
{
QSGView *canvas = new QSGView(0);
- canvas->setFixedSize(240,320);
+ canvas->setGeometry(0,0,240,320);
return canvas;
}
void tst_QSGPathView::initTestCase()
{
- QSGView canvas;
- if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
- QSKIP("PathView needs OpenGL 2.0", SkipAll);
}
void tst_QSGPathView::cleanupTestCase()
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);
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);
QSGView *tst_QSGPathView::createView()
{
QSGView *canvas = new QSGView(0);
- canvas->setFixedSize(240,320);
+ canvas->setGeometry(0,0,240,320);
return canvas;
}
};
void tst_QSGPinchArea::initTestCase()
{
- QSGView canvas;
- if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
- QSKIP("PinchArea needs OpenGL 2.0", SkipAll);
}
void tst_QSGPinchArea::cleanupTestCase()
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");
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();
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
// 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;
}
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();
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
// 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;
}
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();
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);
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);
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);
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;
}
#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
QSGView *tst_QSGRepeater::createView()
{
QSGView *canvas = new QSGView(0);
- canvas->setFixedSize(240,320);
+ canvas->setGeometry(0,0,240,320);
return canvas;
}
#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>
};
void tst_qsgtextedit::initTestCase()
{
- QSGView canvas;
- if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
- QSKIP("TextEdit item needs OpenGL 2.0", SkipAll);
}
void tst_qsgtextedit::cleanupTestCase()
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);
{
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);
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());
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());
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());
{
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());
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());
{
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"));
{
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)));
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);
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
QSGView view(QUrl(QLatin1String("http://localhost:42332/") + qmlfile));
view.show();
- view.setFocus();
+ view.requestActivateWindow();
if (!error.isEmpty()) {
QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
{
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
canvas.show();
- canvas.setFocus();
+ canvas.requestActivateWindow();
QVERIFY(canvas.rootObject() != 0);
{
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/readOnly.qml"));
canvas.show();
- canvas.setFocus();
+ canvas.requestActivateWindow();
QVERIFY(canvas.rootObject() != 0);
{
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);
#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>
};
void tst_qsgtextinput::initTestCase()
{
- QSGView canvas;
- if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
- QSKIP("TextInput item needs OpenGL 2.0", SkipAll);
}
void tst_qsgtextinput::cleanupTestCase()
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());
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());
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);
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());
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());
//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);
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/validators.qml"));
canvas.show();
- canvas.setFocus();
+ canvas.requestActivateWindow();
QVERIFY(canvas.rootObject() != 0);
{
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/inputmethods.qml"));
canvas.show();
- canvas.setFocus();
- QApplication::setActiveWindow(&canvas);
+ canvas.requestActivateWindow();
QTest::qWaitForWindowShown(&canvas);
// test input method hints
{
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
canvas.show();
- canvas.setFocus();
+ canvas.requestActivateWindow();
QVERIFY(canvas.rootObject() != 0);
{
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
canvas.show();
- canvas.setFocus();
+ canvas.requestActivateWindow();
QVERIFY(canvas.rootObject() != 0);
{
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"));
{
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)));
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);
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
{
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/readOnly.qml"));
canvas.show();
- canvas.setFocus();
+ canvas.requestActivateWindow();
QVERIFY(canvas.rootObject() != 0);
{
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);
};
void tst_qsgvisualdatamodel::initTestCase()
{
- QSGView canvas;
- if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
- QSKIP("VisualDatamodel item needs OpenGL 2.0", SkipAll);
}
void tst_qsgvisualdatamodel::cleanupTestCase()
-#!/bin/sh
+#!/bin/bash
#
#############################################################################
##