aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-12-21 09:06:26 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-21 15:35:22 +0100
commit8249c72213bc7d212c05aa086b3145a5742706a3 (patch)
tree4a34b97b0d57a05707c65b7328d5ab1bf4254920 /tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
parent3c211558f6b571555558bd1fc59774e36a6da710 (diff)
QDeclarative tests: Introduce base class for data tests.
In tests/auto/shared/util.* replace macros/find functions by a base class QDeclarativeDataTest with accessors for the data directory helper functions to create URLs from it. The class relies on QFINDTESTDATA, which is the standard way of locating test data. Using the class should reduce the number of calls to QFileInfo.exists(), etc significantly. In addition, provide utility functions for messages. Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Change-Id: Id2beacb157922ee9412f9e45cf9695cec1f8379a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp')
-rw-r--r--tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp51
1 files changed, 19 insertions, 32 deletions
diff --git a/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp b/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
index fd7433b64e..688f5e5024 100644
--- a/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
@@ -103,16 +103,12 @@ protected:
virtual void focusOutEvent(QFocusEvent *) { Q_ASSERT(focused); focused = false; }
};
-class tst_qquickitem : public QObject
+class tst_qquickitem : public QDeclarativeDataTest
{
Q_OBJECT
public:
- tst_qquickitem();
private slots:
- void initTestCase();
- void cleanupTestCase();
-
void noCanvas();
void simpleFocus();
void scopedFocus();
@@ -150,18 +146,6 @@ private:
}
};
-tst_qquickitem::tst_qquickitem()
-{
-}
-
-void tst_qquickitem::initTestCase()
-{
-}
-
-void tst_qquickitem::cleanupTestCase()
-{
-}
-
// Focus has no effect when outside a canvas
void tst_qquickitem::noCanvas()
{
@@ -1075,56 +1059,59 @@ void tst_qquickitem::hoverEventInParent()
void tst_qquickitem::paintOrder_data()
{
+ const QUrl order1Url = testFileUrl("order.1.qml");
+ const QUrl order2Url = testFileUrl("order.2.qml");
+
QTest::addColumn<QUrl>("source");
QTest::addColumn<int>("op");
QTest::addColumn<QVariant>("param1");
QTest::addColumn<QVariant>("param2");
QTest::addColumn<QStringList>("expected");
- QTest::newRow("test 1 noop") << QUrl::fromLocalFile(TESTDATA("order.1.qml"))
+ QTest::newRow("test 1 noop") << order1Url
<< int(NoOp) << QVariant() << QVariant()
<< (QStringList() << "1" << "2" << "3");
- QTest::newRow("test 1 add") << QUrl::fromLocalFile(TESTDATA("order.1.qml"))
+ QTest::newRow("test 1 add") << order1Url
<< int(Append) << QVariant("new") << QVariant()
<< (QStringList() << "1" << "2" << "3" << "new");
- QTest::newRow("test 1 remove") << QUrl::fromLocalFile(TESTDATA("order.1.qml"))
+ QTest::newRow("test 1 remove") << order1Url
<< int(Remove) << QVariant(1) << QVariant()
<< (QStringList() << "1" << "3");
- QTest::newRow("test 1 stack before") << QUrl::fromLocalFile(TESTDATA("order.1.qml"))
+ QTest::newRow("test 1 stack before") << order1Url
<< int(StackBefore) << QVariant(2) << QVariant(1)
<< (QStringList() << "1" << "3" << "2");
- QTest::newRow("test 1 stack after") << QUrl::fromLocalFile(TESTDATA("order.1.qml"))
+ QTest::newRow("test 1 stack after") << order1Url
<< int(StackAfter) << QVariant(0) << QVariant(1)
<< (QStringList() << "2" << "1" << "3");
- QTest::newRow("test 1 set z") << QUrl::fromLocalFile(TESTDATA("order.1.qml"))
+ QTest::newRow("test 1 set z") << order1Url
<< int(SetZ) << QVariant(1) << QVariant(qreal(1.))
<< (QStringList() << "1" << "3" << "2");
- QTest::newRow("test 2 noop") << QUrl::fromLocalFile(TESTDATA("order.2.qml"))
+ QTest::newRow("test 2 noop") << order2Url
<< int(NoOp) << QVariant() << QVariant()
<< (QStringList() << "1" << "3" << "2");
- QTest::newRow("test 2 add") << QUrl::fromLocalFile(TESTDATA("order.2.qml"))
+ QTest::newRow("test 2 add") << order2Url
<< int(Append) << QVariant("new") << QVariant()
<< (QStringList() << "1" << "3" << "new" << "2");
- QTest::newRow("test 2 remove 1") << QUrl::fromLocalFile(TESTDATA("order.2.qml"))
+ QTest::newRow("test 2 remove 1") << order2Url
<< int(Remove) << QVariant(1) << QVariant()
<< (QStringList() << "1" << "3");
- QTest::newRow("test 2 remove 2") << QUrl::fromLocalFile(TESTDATA("order.2.qml"))
+ QTest::newRow("test 2 remove 2") << order2Url
<< int(Remove) << QVariant(2) << QVariant()
<< (QStringList() << "1" << "2");
- QTest::newRow("test 2 stack before 1") << QUrl::fromLocalFile(TESTDATA("order.2.qml"))
+ QTest::newRow("test 2 stack before 1") << order2Url
<< int(StackBefore) << QVariant(1) << QVariant(0)
<< (QStringList() << "1" << "3" << "2");
- QTest::newRow("test 2 stack before 2") << QUrl::fromLocalFile(TESTDATA("order.2.qml"))
+ QTest::newRow("test 2 stack before 2") << order2Url
<< int(StackBefore) << QVariant(2) << QVariant(0)
<< (QStringList() << "3" << "1" << "2");
- QTest::newRow("test 2 stack after 1") << QUrl::fromLocalFile(TESTDATA("order.2.qml"))
+ QTest::newRow("test 2 stack after 1") << order2Url
<< int(StackAfter) << QVariant(0) << QVariant(1)
<< (QStringList() << "1" << "3" << "2");
- QTest::newRow("test 2 stack after 2") << QUrl::fromLocalFile(TESTDATA("order.2.qml"))
+ QTest::newRow("test 2 stack after 2") << order2Url
<< int(StackAfter) << QVariant(0) << QVariant(2)
<< (QStringList() << "3" << "1" << "2");
- QTest::newRow("test 1 set z") << QUrl::fromLocalFile(TESTDATA("order.1.qml"))
+ QTest::newRow("test 1 set z") << order1Url
<< int(SetZ) << QVariant(2) << QVariant(qreal(2.))
<< (QStringList() << "1" << "2" << "3");
}