****************************************************************************/
#include <QtTest/QtTest>
#include <private/qlistmodelinterface_p.h>
-#include <qsgview.h>
+#include <qquickview.h>
#include <qdeclarativeengine.h>
-#include <private/qsgrectangle_p.h>
-#include <private/qsgpositioners_p.h>
+#include <private/qquickrectangle_p.h>
+#include <private/qquickpositioners_p.h>
#include <private/qdeclarativetransition_p.h>
-#include <private/qsgitem_p.h>
+#include <private/qquickitem_p.h>
#include <qdeclarativeexpression.h>
#include "../shared/util.h"
-class tst_qsgpositioners : public QObject
+class tst_qquickpositioners : public QObject
{
Q_OBJECT
public:
- tst_qsgpositioners();
+ tst_qquickpositioners();
private slots:
void test_horizontal();
void test_attachedproperties_dynamic();
private:
- QSGView *createView(const QString &filename, bool wait=true);
+ QQuickView *createView(const QString &filename, bool wait=true);
};
-tst_qsgpositioners::tst_qsgpositioners()
+tst_qquickpositioners::tst_qquickpositioners()
{
}
-void tst_qsgpositioners::test_horizontal()
+void tst_qquickpositioners::test_horizontal()
{
- QSGView *canvas = createView(TESTDATA("horizontal.qml"));
+ QQuickView *canvas = createView(TESTDATA("horizontal.qml"));
canvas->rootObject()->setProperty("testRightToLeft", false);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(three->x(), 70.0);
QCOMPARE(three->y(), 0.0);
- QSGItem *row = canvas->rootObject()->findChild<QSGItem*>("row");
+ QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
QCOMPARE(row->width(), 110.0);
QCOMPARE(row->height(), 50.0);
delete canvas;
}
-void tst_qsgpositioners::test_horizontal_rtl()
+void tst_qquickpositioners::test_horizontal_rtl()
{
- QSGView *canvas = createView(TESTDATA("horizontal.qml"));
+ QQuickView *canvas = createView(TESTDATA("horizontal.qml"));
canvas->rootObject()->setProperty("testRightToLeft", true);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 60.0);
QCOMPARE(three->x(), 0.0);
QCOMPARE(three->y(), 0.0);
- QSGItem *row = canvas->rootObject()->findChild<QSGItem*>("row");
+ QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
QCOMPARE(row->width(), 110.0);
QCOMPARE(row->height(), 50.0);
delete canvas;
}
-void tst_qsgpositioners::test_horizontal_spacing()
+void tst_qquickpositioners::test_horizontal_spacing()
{
- QSGView *canvas = createView(TESTDATA("horizontal-spacing.qml"));
+ QQuickView *canvas = createView(TESTDATA("horizontal-spacing.qml"));
canvas->rootObject()->setProperty("testRightToLeft", false);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(three->x(), 90.0);
QCOMPARE(three->y(), 0.0);
- QSGItem *row = canvas->rootObject()->findChild<QSGItem*>("row");
+ QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
QCOMPARE(row->width(), 130.0);
QCOMPARE(row->height(), 50.0);
delete canvas;
}
-void tst_qsgpositioners::test_horizontal_spacing_rightToLeft()
+void tst_qquickpositioners::test_horizontal_spacing_rightToLeft()
{
- QSGView *canvas = createView(TESTDATA("horizontal-spacing.qml"));
+ QQuickView *canvas = createView(TESTDATA("horizontal-spacing.qml"));
canvas->rootObject()->setProperty("testRightToLeft", true);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 80.0);
QCOMPARE(three->x(), 00.0);
QCOMPARE(three->y(), 0.0);
- QSGItem *row = canvas->rootObject()->findChild<QSGItem*>("row");
+ QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
QCOMPARE(row->width(), 130.0);
QCOMPARE(row->height(), 50.0);
delete canvas;
}
-void tst_qsgpositioners::test_horizontal_animated()
+void tst_qquickpositioners::test_horizontal_animated()
{
- QSGView *canvas = createView(TESTDATA("horizontal-animated.qml"), false);
+ QQuickView *canvas = createView(TESTDATA("horizontal-animated.qml"), false);
canvas->rootObject()->setProperty("testRightToLeft", false);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
//Note that they animate in
QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
- QSGItem *row = canvas->rootObject()->findChild<QSGItem*>("row");
+ QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
QVERIFY(row);
QCOMPARE(row->width(), 100.0);
QCOMPARE(row->height(), 50.0);
delete canvas;
}
-void tst_qsgpositioners::test_horizontal_animated_rightToLeft()
+void tst_qquickpositioners::test_horizontal_animated_rightToLeft()
{
- QSGView *canvas = createView(TESTDATA("horizontal-animated.qml"), false);
+ QQuickView *canvas = createView(TESTDATA("horizontal-animated.qml"), false);
canvas->rootObject()->setProperty("testRightToLeft", true);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
//Note that they animate in
QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
- QSGItem *row = canvas->rootObject()->findChild<QSGItem*>("row");
+ QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
QVERIFY(row);
QCOMPARE(row->width(), 100.0);
QCOMPARE(row->height(), 50.0);
delete canvas;
}
-void tst_qsgpositioners::test_horizontal_animated_disabled()
+void tst_qquickpositioners::test_horizontal_animated_disabled()
{
- QSGView *canvas = createView(TESTDATA("horizontal-animated-disabled.qml"));
+ QQuickView *canvas = createView(TESTDATA("horizontal-animated-disabled.qml"));
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGItem *row = canvas->rootObject()->findChild<QSGItem*>("row");
+ QQuickItem *row = canvas->rootObject()->findChild<QQuickItem*>("row");
QVERIFY(row);
qApp->processEvents();
delete canvas;
}
-void tst_qsgpositioners::test_vertical()
+void tst_qquickpositioners::test_vertical()
{
- QSGView *canvas = createView(TESTDATA("vertical.qml"));
+ QQuickView *canvas = createView(TESTDATA("vertical.qml"));
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(three->x(), 0.0);
QCOMPARE(three->y(), 60.0);
- QSGItem *column = canvas->rootObject()->findChild<QSGItem*>("column");
+ QQuickItem *column = canvas->rootObject()->findChild<QQuickItem*>("column");
QVERIFY(column);
QCOMPARE(column->height(), 80.0);
QCOMPARE(column->width(), 50.0);
delete canvas;
}
-void tst_qsgpositioners::test_vertical_spacing()
+void tst_qquickpositioners::test_vertical_spacing()
{
- QSGView *canvas = createView(TESTDATA("vertical-spacing.qml"));
+ QQuickView *canvas = createView(TESTDATA("vertical-spacing.qml"));
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(three->x(), 0.0);
QCOMPARE(three->y(), 80.0);
- QSGItem *column = canvas->rootObject()->findChild<QSGItem*>("column");
+ QQuickItem *column = canvas->rootObject()->findChild<QQuickItem*>("column");
QCOMPARE(column->height(), 100.0);
QCOMPARE(column->width(), 50.0);
delete canvas;
}
-void tst_qsgpositioners::test_vertical_animated()
+void tst_qquickpositioners::test_vertical_animated()
{
- QSGView *canvas = createView(TESTDATA("vertical-animated.qml"), false);
+ QQuickView *canvas = createView(TESTDATA("vertical-animated.qml"), false);
//Note that they animate in
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
QCOMPARE(one->y(), -100.0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
QCOMPARE(two->y(), -100.0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(three->y(), -100.0);
QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
- QSGItem *column = canvas->rootObject()->findChild<QSGItem*>("column");
+ QQuickItem *column = canvas->rootObject()->findChild<QQuickItem*>("column");
QVERIFY(column);
QCOMPARE(column->height(), 100.0);
QCOMPARE(column->width(), 50.0);
delete canvas;
}
-void tst_qsgpositioners::test_grid()
+void tst_qquickpositioners::test_grid()
{
- QSGView *canvas = createView(TESTDATA("gridtest.qml"));
+ QQuickView *canvas = createView(TESTDATA("gridtest.qml"));
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(five->x(), 50.0);
QCOMPARE(five->y(), 50.0);
- QSGGrid *grid = canvas->rootObject()->findChild<QSGGrid*>("grid");
- QCOMPARE(grid->flow(), QSGGrid::LeftToRight);
+ QQuickGrid *grid = canvas->rootObject()->findChild<QQuickGrid*>("grid");
+ QCOMPARE(grid->flow(), QQuickGrid::LeftToRight);
QCOMPARE(grid->width(), 100.0);
QCOMPARE(grid->height(), 100.0);
delete canvas;
}
-void tst_qsgpositioners::test_grid_topToBottom()
+void tst_qquickpositioners::test_grid_topToBottom()
{
- QSGView *canvas = createView(TESTDATA("grid-toptobottom.qml"));
+ QQuickView *canvas = createView(TESTDATA("grid-toptobottom.qml"));
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(five->x(), 50.0);
QCOMPARE(five->y(), 50.0);
- QSGGrid *grid = canvas->rootObject()->findChild<QSGGrid*>("grid");
- QCOMPARE(grid->flow(), QSGGrid::TopToBottom);
+ QQuickGrid *grid = canvas->rootObject()->findChild<QQuickGrid*>("grid");
+ QCOMPARE(grid->flow(), QQuickGrid::TopToBottom);
QCOMPARE(grid->width(), 100.0);
QCOMPARE(grid->height(), 120.0);
delete canvas;
}
-void tst_qsgpositioners::test_grid_rightToLeft()
+void tst_qquickpositioners::test_grid_rightToLeft()
{
- QSGView *canvas = createView(TESTDATA("gridtest.qml"));
+ QQuickView *canvas = createView(TESTDATA("gridtest.qml"));
canvas->rootObject()->setProperty("testRightToLeft", true);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 50.0);
QCOMPARE(five->x(), 40.0);
QCOMPARE(five->y(), 50.0);
- QSGGrid *grid = canvas->rootObject()->findChild<QSGGrid*>("grid");
+ QQuickGrid *grid = canvas->rootObject()->findChild<QQuickGrid*>("grid");
QCOMPARE(grid->layoutDirection(), Qt::RightToLeft);
QCOMPARE(grid->width(), 100.0);
QCOMPARE(grid->height(), 100.0);
delete canvas;
}
-void tst_qsgpositioners::test_grid_spacing()
+void tst_qquickpositioners::test_grid_spacing()
{
- QSGView *canvas = createView(TESTDATA("grid-spacing.qml"));
+ QQuickView *canvas = createView(TESTDATA("grid-spacing.qml"));
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(five->x(), 54.0);
QCOMPARE(five->y(), 54.0);
- QSGItem *grid = canvas->rootObject()->findChild<QSGItem*>("grid");
+ QQuickItem *grid = canvas->rootObject()->findChild<QQuickItem*>("grid");
QCOMPARE(grid->width(), 128.0);
QCOMPARE(grid->height(), 104.0);
delete canvas;
}
-void tst_qsgpositioners::test_grid_row_column_spacing()
+void tst_qquickpositioners::test_grid_row_column_spacing()
{
- QSGView *canvas = createView(TESTDATA("grid-row-column-spacing.qml"));
+ QQuickView *canvas = createView(TESTDATA("grid-row-column-spacing.qml"));
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(five->x(), 61.0);
QCOMPARE(five->y(), 57.0);
- QSGItem *grid = canvas->rootObject()->findChild<QSGItem*>("grid");
+ QQuickItem *grid = canvas->rootObject()->findChild<QQuickItem*>("grid");
QCOMPARE(grid->width(), 142.0);
QCOMPARE(grid->height(), 107.0);
delete canvas;
}
-void tst_qsgpositioners::test_grid_animated()
+void tst_qquickpositioners::test_grid_animated()
{
- QSGView *canvas = createView(TESTDATA("grid-animated.qml"), false);
+ QQuickView *canvas = createView(TESTDATA("grid-animated.qml"), false);
canvas->rootObject()->setProperty("testRightToLeft", false);
//Note that all animate in
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
QCOMPARE(one->x(), -100.0);
QCOMPARE(one->y(), -100.0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
QCOMPARE(two->x(), -100.0);
QCOMPARE(two->y(), -100.0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(three->x(), -100.0);
QCOMPARE(three->y(), -100.0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
QCOMPARE(four->x(), -100.0);
QCOMPARE(four->y(), -100.0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(five->x(), -100.0);
QCOMPARE(five->y(), -100.0);
QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
- QSGItem *grid = canvas->rootObject()->findChild<QSGItem*>("grid");
+ QQuickItem *grid = canvas->rootObject()->findChild<QQuickItem*>("grid");
QVERIFY(grid);
QCOMPARE(grid->width(), 150.0);
QCOMPARE(grid->height(), 100.0);
delete canvas;
}
-void tst_qsgpositioners::test_grid_animated_rightToLeft()
+void tst_qquickpositioners::test_grid_animated_rightToLeft()
{
- QSGView *canvas = createView(TESTDATA("grid-animated.qml"), false);
+ QQuickView *canvas = createView(TESTDATA("grid-animated.qml"), false);
canvas->rootObject()->setProperty("testRightToLeft", true);
//Note that all animate in
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
QCOMPARE(one->x(), -100.0);
QCOMPARE(one->y(), -100.0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
QCOMPARE(two->x(), -100.0);
QCOMPARE(two->y(), -100.0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(three->x(), -100.0);
QCOMPARE(three->y(), -100.0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
QCOMPARE(four->x(), -100.0);
QCOMPARE(four->y(), -100.0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(five->x(), -100.0);
QCOMPARE(five->y(), -100.0);
QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn
- QSGItem *grid = canvas->rootObject()->findChild<QSGItem*>("grid");
+ QQuickItem *grid = canvas->rootObject()->findChild<QQuickItem*>("grid");
QVERIFY(grid);
QCOMPARE(grid->width(), 150.0);
QCOMPARE(grid->height(), 100.0);
delete canvas;
}
-void tst_qsgpositioners::test_grid_zero_columns()
+void tst_qquickpositioners::test_grid_zero_columns()
{
- QSGView *canvas = createView(TESTDATA("gridzerocolumns.qml"));
+ QQuickView *canvas = createView(TESTDATA("gridzerocolumns.qml"));
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(five->x(), 0.0);
QCOMPARE(five->y(), 50.0);
- QSGItem *grid = canvas->rootObject()->findChild<QSGItem*>("grid");
+ QQuickItem *grid = canvas->rootObject()->findChild<QQuickItem*>("grid");
QCOMPARE(grid->width(), 170.0);
QCOMPARE(grid->height(), 60.0);
delete canvas;
}
-void tst_qsgpositioners::test_propertychanges()
+void tst_qquickpositioners::test_propertychanges()
{
- QSGView *canvas = createView(TESTDATA("propertychangestest.qml"));
+ QQuickView *canvas = createView(TESTDATA("propertychangestest.qml"));
- QSGGrid *grid = qobject_cast<QSGGrid*>(canvas->rootObject());
+ QQuickGrid *grid = qobject_cast<QQuickGrid*>(canvas->rootObject());
QVERIFY(grid != 0);
QDeclarativeTransition *rowTransition = canvas->rootObject()->findChild<QDeclarativeTransition*>("rowTransition");
QDeclarativeTransition *columnTransition = canvas->rootObject()->findChild<QDeclarativeTransition*>("columnTransition");
delete canvas;
}
-void tst_qsgpositioners::test_repeater()
+void tst_qquickpositioners::test_repeater()
{
- QSGView *canvas = createView(TESTDATA("repeatertest.qml"));
+ QQuickView *canvas = createView(TESTDATA("repeatertest.qml"));
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
delete canvas;
}
-void tst_qsgpositioners::test_flow()
+void tst_qquickpositioners::test_flow()
{
- QSGView *canvas = createView(TESTDATA("flowtest.qml"));
+ QQuickView *canvas = createView(TESTDATA("flowtest.qml"));
canvas->rootObject()->setProperty("testRightToLeft", false);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(five->x(), 50.0);
QCOMPARE(five->y(), 70.0);
- QSGItem *flow = canvas->rootObject()->findChild<QSGItem*>("flow");
+ QQuickItem *flow = canvas->rootObject()->findChild<QQuickItem*>("flow");
QVERIFY(flow);
QCOMPARE(flow->width(), 90.0);
QCOMPARE(flow->height(), 120.0);
delete canvas;
}
-void tst_qsgpositioners::test_flow_rightToLeft()
+void tst_qquickpositioners::test_flow_rightToLeft()
{
- QSGView *canvas = createView(TESTDATA("flowtest.qml"));
+ QQuickView *canvas = createView(TESTDATA("flowtest.qml"));
canvas->rootObject()->setProperty("testRightToLeft", true);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 40.0);
QCOMPARE(five->x(), 30.0);
QCOMPARE(five->y(), 70.0);
- QSGItem *flow = canvas->rootObject()->findChild<QSGItem*>("flow");
+ QQuickItem *flow = canvas->rootObject()->findChild<QQuickItem*>("flow");
QVERIFY(flow);
QCOMPARE(flow->width(), 90.0);
QCOMPARE(flow->height(), 120.0);
delete canvas;
}
-void tst_qsgpositioners::test_flow_topToBottom()
+void tst_qquickpositioners::test_flow_topToBottom()
{
- QSGView *canvas = createView(TESTDATA("flowtest-toptobottom.qml"));
+ QQuickView *canvas = createView(TESTDATA("flowtest-toptobottom.qml"));
canvas->rootObject()->setProperty("testRightToLeft", false);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
QCOMPARE(five->x(), 100.0);
QCOMPARE(five->y(), 50.0);
- QSGItem *flow = canvas->rootObject()->findChild<QSGItem*>("flow");
+ QQuickItem *flow = canvas->rootObject()->findChild<QQuickItem*>("flow");
QVERIFY(flow);
QCOMPARE(flow->height(), 90.0);
QCOMPARE(flow->width(), 150.0);
delete canvas;
}
-void tst_qsgpositioners::test_flow_resize()
+void tst_qquickpositioners::test_flow_resize()
{
- QSGView *canvas = createView(TESTDATA("flowtest.qml"));
+ QQuickView *canvas = createView(TESTDATA("flowtest.qml"));
- QSGItem *root = qobject_cast<QSGItem*>(canvas->rootObject());
+ QQuickItem *root = qobject_cast<QQuickItem*>(canvas->rootObject());
QVERIFY(root);
root->setWidth(125);
root->setProperty("testRightToLeft", false);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QVERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QTRY_COMPARE(one->x(), 0.0);
delete canvas;
}
-void tst_qsgpositioners::test_flow_resize_rightToLeft()
+void tst_qquickpositioners::test_flow_resize_rightToLeft()
{
- QSGView *canvas = createView(TESTDATA("flowtest.qml"));
+ QQuickView *canvas = createView(TESTDATA("flowtest.qml"));
- QSGItem *root = qobject_cast<QSGItem*>(canvas->rootObject());
+ QQuickItem *root = qobject_cast<QQuickItem*>(canvas->rootObject());
QVERIFY(root);
root->setWidth(125);
root->setProperty("testRightToLeft", true);
- QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QQuickRectangle *one = canvas->rootObject()->findChild<QQuickRectangle*>("one");
QTRY_VERIFY(one != 0);
- QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QQuickRectangle *two = canvas->rootObject()->findChild<QQuickRectangle*>("two");
QVERIFY(two != 0);
- QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QQuickRectangle *three = canvas->rootObject()->findChild<QQuickRectangle*>("three");
QVERIFY(three != 0);
- QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QQuickRectangle *four = canvas->rootObject()->findChild<QQuickRectangle*>("four");
QVERIFY(four != 0);
- QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QQuickRectangle *five = canvas->rootObject()->findChild<QQuickRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 75.0);
delete canvas;
}
-void tst_qsgpositioners::test_flow_implicit_resize()
+void tst_qquickpositioners::test_flow_implicit_resize()
{
- QSGView *canvas = createView(TESTDATA("flow-testimplicitsize.qml"));
+ QQuickView *canvas = createView(TESTDATA("flow-testimplicitsize.qml"));
QVERIFY(canvas->rootObject() != 0);
- QSGFlow *flow = canvas->rootObject()->findChild<QSGFlow*>("flow");
+ QQuickFlow *flow = canvas->rootObject()->findChild<QQuickFlow*>("flow");
QVERIFY(flow != 0);
QCOMPARE(flow->width(), 100.0);
QCOMPARE(flow->height(), 120.0);
canvas->rootObject()->setProperty("flowLayout", 0);
- QCOMPARE(flow->flow(), QSGFlow::LeftToRight);
+ QCOMPARE(flow->flow(), QQuickFlow::LeftToRight);
QCOMPARE(flow->width(), 220.0);
QCOMPARE(flow->height(), 50.0);
canvas->rootObject()->setProperty("flowLayout", 1);
- QCOMPARE(flow->flow(), QSGFlow::TopToBottom);
+ QCOMPARE(flow->flow(), QQuickFlow::TopToBottom);
QCOMPARE(flow->width(), 100.0);
QCOMPARE(flow->height(), 120.0);
warningMessage = msg;
}
-void tst_qsgpositioners::test_conflictinganchors()
+void tst_qquickpositioners::test_conflictinganchors()
{
QtMsgHandler oldMsgHandler = qInstallMsgHandler(interceptWarnings);
QDeclarativeEngine engine;
QDeclarativeComponent component(&engine);
component.setData("import QtQuick 2.0\nColumn { Item {} }", QUrl::fromLocalFile(""));
- QSGItem *item = qobject_cast<QSGItem*>(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QVERIFY(warningMessage.isEmpty());
delete item;
component.setData("import QtQuick 2.0\nRow { Item {} }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QVERIFY(warningMessage.isEmpty());
delete item;
component.setData("import QtQuick 2.0\nGrid { Item {} }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QVERIFY(warningMessage.isEmpty());
delete item;
component.setData("import QtQuick 2.0\nFlow { Item {} }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QVERIFY(warningMessage.isEmpty());
delete item;
component.setData("import QtQuick 2.0\nColumn { Item { anchors.top: parent.top } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column"));
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nColumn { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column"));
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nColumn { Item { anchors.left: parent.left } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QVERIFY(warningMessage.isEmpty());
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nRow { Item { anchors.left: parent.left } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row"));
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nRow { Item { anchors.fill: parent } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row"));
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nRow { Item { anchors.top: parent.top } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QVERIFY(warningMessage.isEmpty());
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nGrid { Item { anchors.horizontalCenter: parent.horizontalCenter } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid"));
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nGrid { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid"));
warningMessage.clear();
delete item;
component.setData("import QtQuick 2.0\nFlow { Item { anchors.verticalCenter: parent.verticalCenter } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow"));
delete item;
component.setData("import QtQuick 2.0\nFlow { Item { anchors.fill: parent } }", QUrl::fromLocalFile(""));
- item = qobject_cast<QSGItem*>(component.create());
+ item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow"));
qInstallMsgHandler(oldMsgHandler);
delete item;
}
-void tst_qsgpositioners::test_mirroring()
+void tst_qquickpositioners::test_mirroring()
{
QList<QString> qmlFiles;
qmlFiles << "horizontal.qml" << "gridtest.qml" << "flowtest.qml";
objectNames << "one" << "two" << "three" << "four" << "five";
foreach (const QString qmlFile, qmlFiles) {
- QSGView *canvasA = createView(TESTDATA(qmlFile));
- QSGItem *rootA = qobject_cast<QSGItem*>(canvasA->rootObject());
+ QQuickView *canvasA = createView(TESTDATA(qmlFile));
+ QQuickItem *rootA = qobject_cast<QQuickItem*>(canvasA->rootObject());
- QSGView *canvasB = createView(TESTDATA(qmlFile));
- QSGItem *rootB = qobject_cast<QSGItem*>(canvasB->rootObject());
+ QQuickView *canvasB = createView(TESTDATA(qmlFile));
+ QQuickItem *rootB = qobject_cast<QQuickItem*>(canvasB->rootObject());
rootA->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft
// horizontal.qml only has three items
if (qmlFile == QString("horizontal.qml") && objectName == QString("four"))
break;
- QSGItem *itemA = rootA->findChild<QSGItem*>(objectName);
- QSGItem *itemB = rootB->findChild<QSGItem*>(objectName);
+ QQuickItem *itemA = rootA->findChild<QQuickItem*>(objectName);
+ QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
QTRY_VERIFY(itemA->x() != itemB->x());
}
- QSGItemPrivate* rootPrivateB = QSGItemPrivate::get(rootB);
+ QQuickItemPrivate* rootPrivateB = QQuickItemPrivate::get(rootB);
rootPrivateB->effectiveLayoutMirror = true; // LayoutMirroring.enabled: true
rootPrivateB->isMirrorImplicit = false;
// horizontal.qml only has three items
if (qmlFile == QString("horizontal.qml") && objectName == QString("four"))
break;
- QSGItem *itemA = rootA->findChild<QSGItem*>(objectName);
- QSGItem *itemB = rootB->findChild<QSGItem*>(objectName);
+ QQuickItem *itemA = rootA->findChild<QQuickItem*>(objectName);
+ QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
QTRY_COMPARE(itemA->x(), itemB->x());
}
// horizontal.qml only has three items
if (qmlFile == QString("horizontal.qml") && objectName == QString("four"))
break;
- QSGItem *itemA = rootA->findChild<QSGItem*>(objectName);
- QSGItem *itemB = rootB->findChild<QSGItem*>(objectName);
+ QQuickItem *itemA = rootA->findChild<QQuickItem*>(objectName);
+ QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
QTRY_COMPARE(itemA->x(), itemB->x());
}
delete canvasA;
}
}
-void tst_qsgpositioners::test_allInvisible()
+void tst_qquickpositioners::test_allInvisible()
{
//QTBUG-19361
- QSGView *canvas = createView(TESTDATA("allInvisible.qml"));
+ QQuickView *canvas = createView(TESTDATA("allInvisible.qml"));
- QSGItem *root = qobject_cast<QSGItem*>(canvas->rootObject());
+ QQuickItem *root = qobject_cast<QQuickItem*>(canvas->rootObject());
QVERIFY(root);
- QSGRow *row = canvas->rootObject()->findChild<QSGRow*>("row");
+ QQuickRow *row = canvas->rootObject()->findChild<QQuickRow*>("row");
QVERIFY(row != 0);
QVERIFY(row->width() == 0);
QVERIFY(row->height() == 0);
- QSGColumn *column = canvas->rootObject()->findChild<QSGColumn*>("column");
+ QQuickColumn *column = canvas->rootObject()->findChild<QQuickColumn*>("column");
QVERIFY(column != 0);
QVERIFY(column->width() == 0);
QVERIFY(column->height() == 0);
}
-void tst_qsgpositioners::test_attachedproperties()
+void tst_qquickpositioners::test_attachedproperties()
{
QFETCH(QString, filename);
- QSGView *canvas = createView(filename);
+ QQuickView *canvas = createView(filename);
QVERIFY(canvas->rootObject() != 0);
- QSGRectangle *greenRect = canvas->rootObject()->findChild<QSGRectangle *>("greenRect");
+ QQuickRectangle *greenRect = canvas->rootObject()->findChild<QQuickRectangle *>("greenRect");
QVERIFY(greenRect != 0);
int posIndex = greenRect->property("posIndex").toInt();
bool isLast = greenRect->property("isLastItem").toBool();
QVERIFY(isLast == false);
- QSGRectangle *yellowRect = canvas->rootObject()->findChild<QSGRectangle *>("yellowRect");
+ QQuickRectangle *yellowRect = canvas->rootObject()->findChild<QQuickRectangle *>("yellowRect");
QVERIFY(yellowRect != 0);
posIndex = yellowRect->property("posIndex").toInt();
delete canvas;
}
-void tst_qsgpositioners::test_attachedproperties_data()
+void tst_qquickpositioners::test_attachedproperties_data()
{
QTest::addColumn<QString>("filename");
QTest::newRow("flow") << TESTDATA("attachedproperties-flow.qml");
}
-void tst_qsgpositioners::test_attachedproperties_dynamic()
+void tst_qquickpositioners::test_attachedproperties_dynamic()
{
QSKIP("QTBUG-21995 - Test crashes on exit");
- QSGView *canvas = createView(TESTDATA("attachedproperties-dynamic.qml"));
+ QQuickView *canvas = createView(TESTDATA("attachedproperties-dynamic.qml"));
QVERIFY(canvas->rootObject() != 0);
- QSGRow *row = canvas->rootObject()->findChild<QSGRow *>("pos");
+ QQuickRow *row = canvas->rootObject()->findChild<QQuickRow *>("pos");
QVERIFY(row != 0);
- QSGRectangle *rect0 = canvas->rootObject()->findChild<QSGRectangle *>("rect0");
+ QQuickRectangle *rect0 = canvas->rootObject()->findChild<QQuickRectangle *>("rect0");
QVERIFY(rect0 != 0);
int posIndex = rect0->property("index").toInt();
bool isLast = rect0->property("lastItem").toBool();
QVERIFY(isLast == false);
- QSGRectangle *rect1 = canvas->rootObject()->findChild<QSGRectangle *>("rect1");
+ QQuickRectangle *rect1 = canvas->rootObject()->findChild<QQuickRectangle *>("rect1");
QVERIFY(rect1 != 0);
posIndex = rect1->property("index").toInt();
QTRY_VERIFY(rect1->property("firstItem").toBool() == false);
QTRY_VERIFY(rect1->property("lastItem").toBool() == false);
- QSGRectangle *rect2 = canvas->rootObject()->findChild<QSGRectangle *>("rect2");
+ QQuickRectangle *rect2 = canvas->rootObject()->findChild<QQuickRectangle *>("rect2");
QVERIFY(rect2 != 0);
posIndex = rect2->property("index").toInt();
delete canvas;
}
-QSGView *tst_qsgpositioners::createView(const QString &filename, bool wait)
+QQuickView *tst_qquickpositioners::createView(const QString &filename, bool wait)
{
- QSGView *canvas = new QSGView(0);
+ QQuickView *canvas = new QQuickView(0);
canvas->setSource(QUrl::fromLocalFile(filename));
canvas->show();
}
-QTEST_MAIN(tst_qsgpositioners)
+QTEST_MAIN(tst_qquickpositioners)
-#include "tst_qsgpositioners.moc"
+#include "tst_qquickpositioners.moc"