summaryrefslogtreecommitdiff
path: root/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-02-27 08:43:10 +0100
committerLiang Qi <liang.qi@qt.io>2018-02-27 08:43:10 +0100
commitbb7a5d0cb6e62fa411e8b66759bf6b798c3f68d9 (patch)
tree06c325dc386afd26281ba0ebdbf4fd3f56f892b0 /tests/auto/quick/qquickitem2/tst_qquickitem.cpp
parent41edb3bd9f373a865d5698ac8c18bf341071eae9 (diff)
parente41d067227eb6225b05df88ab724708588fa5304 (diff)
downloadqtdeclarative-bb7a5d0cb6e62fa411e8b66759bf6b798c3f68d9.tar.gz
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4internalclass.cpp src/qml/parser/qqmljslexer.cpp src/qml/qml/v8/qv8engine.cpp src/qml/util/qqmladaptormodel_p.h src/quick/items/qquickanimatedsprite.cpp tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp Change-Id: I16702b7a0da29c2a332afee47728d6a6ebf4fb3f
Diffstat (limited to 'tests/auto/quick/qquickitem2/tst_qquickitem.cpp')
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
index b66dc1708f..0f4850d4a7 100644
--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -193,7 +193,7 @@ class KeyTestItem : public QQuickItem
{
Q_OBJECT
public:
- KeyTestItem(QQuickItem *parent=0) : QQuickItem(parent), mKey(0) {}
+ KeyTestItem(QQuickItem *parent=nullptr) : QQuickItem(parent), mKey(0) {}
protected:
void keyPressEvent(QKeyEvent *e) {
@@ -240,7 +240,7 @@ class HollowTestItem : public QQuickItem
Q_PROPERTY(qreal holeRadius READ holeRadius WRITE setHoleRadius)
public:
- HollowTestItem(QQuickItem *parent = 0)
+ HollowTestItem(QQuickItem *parent = nullptr)
: QQuickItem(parent),
m_isPressed(false),
m_isHovered(false),
@@ -343,7 +343,7 @@ void tst_QQuickItem::initTestCase()
void tst_QQuickItem::cleanup()
{
QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
- inputMethodPrivate->testContext = 0;
+ inputMethodPrivate->testContext = nullptr;
}
void tst_QQuickItem::activeFocusOnTab()
@@ -351,7 +351,7 @@ void tst_QQuickItem::activeFocusOnTab()
if (!qt_tab_all_widgets())
QSKIP("This function doesn't support NOT iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("activeFocusOnTab.qml"));
@@ -463,7 +463,7 @@ void tst_QQuickItem::activeFocusOnTab2()
if (!qt_tab_all_widgets())
QSKIP("This function doesn't support NOT iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("activeFocusOnTab.qml"));
@@ -503,7 +503,7 @@ void tst_QQuickItem::activeFocusOnTab3()
if (!qt_tab_all_widgets())
QSKIP("This function doesn't support NOT iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("activeFocusOnTab3.qml"));
@@ -685,7 +685,7 @@ void tst_QQuickItem::activeFocusOnTab4()
if (!qt_tab_all_widgets())
QSKIP("This function doesn't support NOT iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("activeFocusOnTab4.qml"));
@@ -717,7 +717,7 @@ void tst_QQuickItem::activeFocusOnTab5()
if (!qt_tab_all_widgets())
QSKIP("This function doesn't support NOT iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("activeFocusOnTab4.qml"));
@@ -751,7 +751,7 @@ void tst_QQuickItem::activeFocusOnTab6()
if (qt_tab_all_widgets())
QSKIP("This function doesn't support iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("activeFocusOnTab6.qml"));
@@ -809,7 +809,7 @@ void tst_QQuickItem::activeFocusOnTab7()
if (qt_tab_all_widgets())
QSKIP("This function doesn't support iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(300,300));
window->setSource(testFileUrl("activeFocusOnTab7.qml"));
@@ -842,7 +842,7 @@ void tst_QQuickItem::activeFocusOnTab7()
void tst_QQuickItem::activeFocusOnTab8()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(300,300));
window->setSource(testFileUrl("activeFocusOnTab8.qml"));
@@ -894,7 +894,7 @@ void tst_QQuickItem::activeFocusOnTab9()
if (qt_tab_all_widgets())
QSKIP("This function doesn't support iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(300,300));
window->setSource(testFileUrl("activeFocusOnTab9.qml"));
@@ -945,7 +945,7 @@ void tst_QQuickItem::activeFocusOnTab10()
if (!qt_tab_all_widgets())
QSKIP("This function doesn't support NOT iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(300,300));
window->setSource(testFileUrl("activeFocusOnTab9.qml"));
@@ -1028,7 +1028,7 @@ void tst_QQuickItem::nextItemInFocusChain()
if (!qt_tab_all_widgets())
QSKIP("This function doesn't support NOT iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("activeFocusOnTab.qml"));
@@ -1104,7 +1104,7 @@ void tst_QQuickItem::nextItemInFocusChain2()
if (qt_tab_all_widgets())
QSKIP("This function doesn't support iterating all.");
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("activeFocusOnTab6.qml"));
@@ -1149,7 +1149,7 @@ void tst_QQuickItem::nextItemInFocusChain2()
void tst_QQuickItem::nextItemInFocusChain3()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("nextItemInFocusChain3.qml"));
@@ -1177,7 +1177,7 @@ void verifyTabFocusChain(QQuickView *window, const char **focusChain, bool forwa
void tst_QQuickItem::tabFence()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("tabFence.qml"));
@@ -1216,7 +1216,7 @@ void tst_QQuickItem::tabFence()
void tst_QQuickItem::qtbug_50516()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl("qtbug_50516.qml"));
@@ -1261,7 +1261,7 @@ void tst_QQuickItem::qtbug_50516_2()
QFETCH(QString, item1);
QFETCH(QString, item2);
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(800,600));
window->setSource(testFileUrl(filename));
@@ -1282,7 +1282,7 @@ void tst_QQuickItem::qtbug_50516_2()
void tst_QQuickItem::keys()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(240,320));
KeysTestObject *testObject = new KeysTestObject;
@@ -1471,7 +1471,7 @@ void tst_QQuickItem::standardKeys()
void tst_QQuickItem::keysProcessingOrder()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(240,320));
KeysTestObject *testObject = new KeysTestObject;
@@ -1532,7 +1532,7 @@ void tst_QQuickItem::keysim()
QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
inputMethodPrivate->testContext = &platformInputContext;
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(240,320));
window->setSource(testFileUrl("keysim.qml"));
@@ -1650,7 +1650,7 @@ bool anchorsMirrored(QQuickItem *rootItem, const char * itemString)
void tst_QQuickItem::layoutMirroring()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setSource(testFileUrl("layoutmirroring.qml"));
window->show();
@@ -1801,7 +1801,7 @@ void tst_QQuickItem::layoutMirroringIllegalParent()
component.setData("import QtQuick 2.0; QtObject { LayoutMirroring.enabled: true; LayoutMirroring.childrenInherit: true }", QUrl::fromLocalFile(""));
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:1:21: QML QtObject: LayoutDirection attached property only works with Items and Windows");
QObject *object = component.create();
- QVERIFY(object != 0);
+ QVERIFY(object != nullptr);
}
void tst_QQuickItem::keyNavigation_data()
@@ -1815,7 +1815,7 @@ void tst_QQuickItem::keyNavigation()
{
QFETCH(QString, source);
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(240,320));
window->setSource(testFileUrl(source));
@@ -1892,7 +1892,7 @@ void tst_QQuickItem::keyNavigation()
void tst_QQuickItem::keyNavigation_RightToLeft()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(240,320));
window->setSource(testFileUrl("keynavigationtest.qml"));
@@ -1947,7 +1947,7 @@ void tst_QQuickItem::keyNavigation_RightToLeft()
void tst_QQuickItem::keyNavigation_skipNotVisible()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(240,320));
window->setSource(testFileUrl("keynavigationtest.qml"));
@@ -2022,7 +2022,7 @@ void tst_QQuickItem::keyNavigation_skipNotVisible()
void tst_QQuickItem::keyNavigation_implicitSetting()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(240,320));
window->setSource(testFileUrl("keynavigationtest_implicit.qml"));
@@ -2149,7 +2149,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
void tst_QQuickItem::keyNavigation_focusReason()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(240,320));
FocusEventFilter focusEventFilter;
@@ -2210,7 +2210,7 @@ void tst_QQuickItem::keyNavigation_focusReason()
void tst_QQuickItem::keyNavigation_loop()
{
// QTBUG-47229
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(240,320));
window->setSource(testFileUrl("keynavigationtest_loop.qml"));
@@ -2325,18 +2325,18 @@ void tst_QQuickItem::mapCoordinates()
QFETCH(int, x);
QFETCH(int, y);
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(300, 300));
window->setSource(testFileUrl("mapCoordinates.qml"));
window->show();
qApp->processEvents();
QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
- QVERIFY(root != 0);
+ QVERIFY(root != nullptr);
QQuickItem *a = findItem<QQuickItem>(window->rootObject(), "itemA");
- QVERIFY(a != 0);
+ QVERIFY(a != nullptr);
QQuickItem *b = findItem<QQuickItem>(window->rootObject(), "itemB");
- QVERIFY(b != 0);
+ QVERIFY(b != nullptr);
QVariant result;
@@ -2396,18 +2396,18 @@ void tst_QQuickItem::mapCoordinatesRect()
QFETCH(int, width);
QFETCH(int, height);
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(300, 300));
window->setSource(testFileUrl("mapCoordinatesRect.qml"));
window->show();
qApp->processEvents();
QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
- QVERIFY(root != 0);
+ QVERIFY(root != nullptr);
QQuickItem *a = findItem<QQuickItem>(window->rootObject(), "itemA");
- QVERIFY(a != 0);
+ QVERIFY(a != nullptr);
QQuickItem *b = findItem<QQuickItem>(window->rootObject(), "itemB");
- QVERIFY(b != 0);
+ QVERIFY(b != nullptr);
QVariant result;
@@ -2478,7 +2478,7 @@ void tst_QQuickItem::transforms()
component.setData("import QtQuick 2.3\nItem { transform: "+qml+"}", QUrl::fromLocalFile(""));
QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(item->itemTransform(0,0), transform);
+ QCOMPARE(item->itemTransform(nullptr,nullptr), transform);
}
void tst_QQuickItem::childrenProperty()
@@ -2486,7 +2486,7 @@ void tst_QQuickItem::childrenProperty()
QQmlComponent component(&engine, testFileUrl("childrenProperty.qml"));
QObject *o = component.create();
- QVERIFY(o != 0);
+ QVERIFY(o != nullptr);
QCOMPARE(o->property("test1").toBool(), true);
QCOMPARE(o->property("test2").toBool(), true);
@@ -2501,7 +2501,7 @@ void tst_QQuickItem::resourcesProperty()
QQmlComponent component(&engine, testFileUrl("resourcesProperty.qml"));
QObject *object = component.create();
- QVERIFY(object != 0);
+ QVERIFY(object != nullptr);
QQmlProperty property(object, "resources", component.creationContext());
@@ -2533,7 +2533,7 @@ void tst_QQuickItem::resourcesProperty()
void tst_QQuickItem::propertyChanges()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setBaseSize(QSize(300, 300));
window->setSource(testFileUrl("propertychanges.qml"));
window->show();
@@ -2624,7 +2624,7 @@ void tst_QQuickItem::nonexistentPropertyConnection()
void tst_QQuickItem::childrenRect()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setSource(testFileUrl("childrenRect.qml"));
window->setBaseSize(QSize(240,320));
window->show();
@@ -2653,7 +2653,7 @@ void tst_QQuickItem::childrenRect()
// QTBUG-11383
void tst_QQuickItem::childrenRectBug()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
QString warning = testFileUrl("childrenRectBug.qml").toString() + ":7:5: QML Item: Binding loop detected for property \"height\"";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
@@ -2674,7 +2674,7 @@ void tst_QQuickItem::childrenRectBug()
// QTBUG-11465
void tst_QQuickItem::childrenRectBug2()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
QString warning1 = testFileUrl("childrenRectBug2.qml").toString() + ":7:5: QML Item: Binding loop detected for property \"width\"";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
@@ -2708,7 +2708,7 @@ void tst_QQuickItem::childrenRectBug2()
// QTBUG-12722
void tst_QQuickItem::childrenRectBug3()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setSource(testFileUrl("childrenRectBug3.qml"));
window->show();
@@ -2719,7 +2719,7 @@ void tst_QQuickItem::childrenRectBug3()
// QTBUG-38732
void tst_QQuickItem::childrenRectBottomRightCorner()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setSource(testFileUrl("childrenRectBottomRightCorner.qml"));
window->show();
@@ -2811,7 +2811,7 @@ void tst_QQuickItem::changeListener()
{
QQuickWindow window;
window.show();
- QTest::qWaitForWindowExposed(&window);
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
QQuickItem *item = new QQuickItem;
TestListener itemListener;
@@ -2994,7 +2994,7 @@ void tst_QQuickItem::changeListener()
// QTBUG-13893
void tst_QQuickItem::transformCrash()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setSource(testFileUrl("transformCrash.qml"));
window->show();
@@ -3003,7 +3003,7 @@ void tst_QQuickItem::transformCrash()
void tst_QQuickItem::implicitSize()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setSource(testFileUrl("implicitsize.qml"));
window->show();
@@ -3076,14 +3076,14 @@ void tst_QQuickItem::qtbug_16871()
{
QQmlComponent component(&engine, testFileUrl("qtbug_16871.qml"));
QObject *o = component.create();
- QVERIFY(o != 0);
+ QVERIFY(o != nullptr);
delete o;
}
void tst_QQuickItem::visibleChildren()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->setSource(testFileUrl("visiblechildren.qml"));
window->show();
@@ -3141,7 +3141,7 @@ void tst_QQuickItem::visibleChildren()
void tst_QQuickItem::parentLoop()
{
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
#if QT_CONFIG(regularexpression)
QRegularExpression msgRegexp = QRegularExpression("QQuickItem::setParentItem: Parent QQuickItem\\(.*\\) is already part of the subtree of QQuickItem\\(.*\\)");
@@ -3231,7 +3231,7 @@ void tst_QQuickItem::contains()
QFETCH(bool, insideTarget);
QFETCH(QList<QPoint>, points);
- QQuickView *window = new QQuickView(0);
+ QQuickView *window = new QQuickView(nullptr);
window->rootContext()->setContextProperty("circleShapeTest", circleTest);
window->setBaseSize(QSize(400, 400));
window->setSource(testFileUrl("hollowTestItem.qml"));
@@ -3253,12 +3253,12 @@ void tst_QQuickItem::contains()
QCOMPARE(hollowItem->isHovered(), insideTarget);
// check mouse press
- QTest::mousePress(window, Qt::LeftButton, 0, point);
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, point);
QTest::qWait(10);
QCOMPARE(hollowItem->isPressed(), insideTarget);
// check mouse release
- QTest::mouseRelease(window, Qt::LeftButton, 0, point);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, point);
QTest::qWait(10);
QCOMPARE(hollowItem->isPressed(), false);
}
@@ -3299,8 +3299,8 @@ void tst_QQuickItem::childAt()
QCOMPARE(parent.childAt(75, 75), &child2);
QCOMPARE(parent.childAt(149, 149), &child2);
QCOMPARE(parent.childAt(25, 200), &child3);
- QCOMPARE(parent.childAt(0, 150), static_cast<QQuickItem *>(0));
- QCOMPARE(parent.childAt(300, 300), static_cast<QQuickItem *>(0));
+ QCOMPARE(parent.childAt(0, 150), static_cast<QQuickItem *>(nullptr));
+ QCOMPARE(parent.childAt(300, 300), static_cast<QQuickItem *>(nullptr));
}
void tst_QQuickItem::grab()
@@ -3312,7 +3312,7 @@ void tst_QQuickItem::grab()
QQuickView view;
view.setSource(testFileUrl("grabToImage.qml"));
view.show();
- QTest::qWaitForWindowExposed(&view);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QQuickItem *root = qobject_cast<QQuickItem *>(view.rootObject());
QVERIFY(root);