Includes a few other minor cleanups as well.
Task-number: QTBUG-21721
Change-Id: I5b1c2c116e63748c6b4199183212de8a00037af1
Reviewed-on: http://codereview.qt-project.org/6473
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
SOURCES += tst_qdeclarativeanimations.cpp
macx:CONFIG -= app_bundle
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <limits.h>
#include <math.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
class tst_qdeclarativeanimations : public QObject
{
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathAnimation.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimation.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathAnimation2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimation2.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
void tst_qdeclarativeanimations::pathInterpolator()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathInterpolator.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathInterpolator.qml")));
QDeclarativePathInterpolator *interpolator = qobject_cast<QDeclarativePathInterpolator*>(c.create());
QVERIFY(interpolator);
void tst_qdeclarativeanimations::pathInterpolatorBackwardJump()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathInterpolatorBack.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathInterpolatorBack.qml")));
QDeclarativePathInterpolator *interpolator = qobject_cast<QDeclarativePathInterpolator*>(c.create());
QVERIFY(interpolator);
void tst_qdeclarativeanimations::pathWithNoStart()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathAnimationNoStart.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimationNoStart.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
//don't crash
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/badtype1.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("badtype1.qml")));
qApp->processEvents();
//make sure we get a compiler error
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype2.qml")));
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
c.create();
//make sure we get a compiler error
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype3.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype3.qml")));
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
c.create();
//don't crash
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype4.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype4.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c1(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml"));
- QByteArray message = QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml").toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate non-existent property \"border.colr\"";
+ QDeclarativeComponent c1(&engine, QUrl::fromLocalFile(TESTDATA("badproperty1.qml")));
+ QByteArray message = QUrl::fromLocalFile(TESTDATA("badproperty1.qml")).toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate non-existent property \"border.colr\"";
QTest::ignoreMessage(QtWarningMsg, message);
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c1.create());
QVERIFY(rect);
- QDeclarativeComponent c2(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml"));
- message = QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml").toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate read-only property \"border\"";
+ QDeclarativeComponent c2(&engine, QUrl::fromLocalFile(TESTDATA("badproperty2.qml")));
+ message = QUrl::fromLocalFile(TESTDATA("badproperty2.qml")).toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate read-only property \"border\"";
QTest::ignoreMessage(QtWarningMsg, message);
rect = qobject_cast<QSGRectangle*>(c2.create());
QVERIFY(rect);
//assumes border.width stays a real -- not real robust
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype1.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("mixedtype1.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("mixedtype2.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
const int waitDuration = 300;
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties2.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties3.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties3.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties4.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties4.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties5.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties5.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
const int waitDuration = 300;
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition2.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition3.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition3.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition4.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition4.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition5.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition5.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
/*{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition6.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition6.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition7.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition7.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
void tst_qdeclarativeanimations::pathTransition()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathTransition.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathTransition.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
void tst_qdeclarativeanimations::disabledTransition()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabledTransition.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("disabledTransition.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/attached.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("attached.qml")));
QTest::ignoreMessage(QtDebugMsg, "off");
QTest::ignoreMessage(QtDebugMsg, "on");
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/valuesource.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("valuesource.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/valuesource2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("valuesource2.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontAutoStart.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontAutoStart.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontStart.qml")));
QString warning = c.url().toString() + ":14:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontStart2.qml")));
QString warning = c.url().toString() + ":15:17: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
void tst_qdeclarativeanimations::rotation()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/rotation.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("rotation.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
//ensure we start correctly when "running: true" is explicitly set
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/runningTrueBug.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("runningTrueBug.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
//in the case where an animation in the transition doesn't match anything (but previously did)
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/nonTransitionBug.qml");
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("nonTransitionBug.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/registrationBug.qml");
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("registrationBug.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
QTRY_COMPARE(rect->property("value"), QVariant(int(100)));
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/doubleRegistrationBug.qml");
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("doubleRegistrationBug.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/transitionAssignmentBug.qml");
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("transitionAssignmentBug.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/pauseBindingBug.qml");
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pauseBindingBug.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
QDeclarativeAbstractAnimation *anim = rect->findChild<QDeclarativeAbstractAnimation*>("animation");
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/pauseBug.qml");
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pauseBug.qml")));
QDeclarativeAbstractAnimation *anim = qobject_cast<QDeclarativeAbstractAnimation*>(c.create());
QVERIFY(anim != 0);
QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimation::Paused);
SOURCES += tst_qdeclarativebehaviors.cpp
macx:CONFIG -= app_bundle
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <private/qdeclarativebehavior_p.h>
#include <private/qdeclarativeanimation_p.h>
#include <private/qsgitem_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
class tst_qdeclarativebehaviors : public QObject
void tst_qdeclarativebehaviors::simpleBehavior()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/simple.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("simple.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QTRY_VERIFY(rect);
QTRY_VERIFY(qobject_cast<QDeclarativeBehavior*>(rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation());
void tst_qdeclarativebehaviors::scriptTriggered()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/scripttrigger.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("scripttrigger.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QTRY_VERIFY(rect);
void tst_qdeclarativebehaviors::cppTriggered()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/cpptrigger.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("cpptrigger.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QTRY_VERIFY(rect);
void tst_qdeclarativebehaviors::loop()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/loop.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("loop.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QTRY_VERIFY(rect);
void tst_qdeclarativebehaviors::colorBehavior()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/color.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("color.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QTRY_VERIFY(rect);
void tst_qdeclarativebehaviors::parentBehavior()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/parent.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("parent.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QTRY_VERIFY(rect);
void tst_qdeclarativebehaviors::replaceBinding()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/binding.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("binding.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QTRY_VERIFY(rect);
/* XXX TODO Create a test element for this case.
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("groupProperty.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
qDebug() << c.errorString();
QTRY_VERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("groupProperty2.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QTRY_VERIFY(rect);
void tst_qdeclarativebehaviors::emptyBehavior()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/empty.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("empty.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
void tst_qdeclarativebehaviors::explicitSelection()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/explicit.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("explicit.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
void tst_qdeclarativebehaviors::nonSelectingBehavior()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("nonSelecting2.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
void tst_qdeclarativebehaviors::reassignedAnimation()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml"));
- QString warning = QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:9: QML Behavior: Cannot change the animation assigned to a Behavior.";
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("reassignedAnimation.qml")));
+ QString warning = QUrl::fromLocalFile(TESTDATA("reassignedAnimation.qml")).toString() + ":9:9: QML Behavior: Cannot change the animation assigned to a Behavior.";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
void tst_qdeclarativebehaviors::disabled()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabled.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("disabled.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
QCOMPARE(rect->findChild<QDeclarativeBehavior*>("MyBehavior")->enabled(), false);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontStart.qml")));
QString warning = c.url().toString() + ":13:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
{
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("startup.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("startup2.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
void tst_qdeclarativebehaviors::groupedPropertyCrash()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupedPropertyCrash.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("groupedPropertyCrash.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect); //don't crash
}
void tst_qdeclarativebehaviors::runningTrue()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/runningTrue.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("runningTrue.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
void tst_qdeclarativebehaviors::sameValue()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/qtbug12295.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("qtbug12295.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/delayedRegistration.qml");
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("delayedRegistration.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
SOURCES += tst_qdeclarativebinding.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativecomponent.h>
#include <private/qdeclarativebind_p.h>
#include <private/qsgrectangle_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
class tst_qdeclarativebinding : public QObject
void tst_qdeclarativebinding::binding()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-binding.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
void tst_qdeclarativebinding::whenAfterValue()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-binding2.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
void tst_qdeclarativebinding::restoreBinding()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/restoreBinding.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("restoreBinding.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
void tst_qdeclarativebinding::restoreBindingWithLoop()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/restoreBindingWithLoop.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("restoreBindingWithLoop.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
void tst_qdeclarativebinding::deletedObject()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/deletedObject.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("deletedObject.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
SOURCES += tst_qdeclarativechangeset.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private testlib
SOURCES += tst_qdeclarativecomponent.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativeproperty.h>
#include <QtDeclarative/qdeclarativeincubator.h>
#include <qcolor.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
-#ifdef Q_OS_SYMBIAN
-// In Symbian OS test data is located in applications private dir
-#define SRCDIR "."
-#endif
-
class MyIC : public QObject, public QDeclarativeIncubationController
{
Q_OBJECT
void tst_qdeclarativecomponent::qmlIncubateObject()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/incubateObject.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("incubateObject.qml")));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("test1").toBool(), true);
void tst_qdeclarativecomponent::qmlCreateObject()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/createObject.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("createObject.qml")));
QObject *object = component.create();
QVERIFY(object != 0);
void tst_qdeclarativecomponent::qmlCreateObjectWithProperties()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/createObjectWithScript.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("createObjectWithScript.qml")));
QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
QObject *object = component.create();
QVERIFY(object != 0);
SOURCES += tst_qdeclarativeconnection.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativecomponent.h>
#include <private/qdeclarativeconnections_p.h>
#include <private/qsgitem_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
#include <QtDeclarative/qdeclarativescriptstring.h>
void tst_qdeclarativeconnection::defaultValues()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection3.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-connection3.qml")));
QDeclarativeConnections *item = qobject_cast<QDeclarativeConnections*>(c.create());
QVERIFY(item != 0);
void tst_qdeclarativeconnection::properties()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-connection2.qml")));
QDeclarativeConnections *item = qobject_cast<QDeclarativeConnections*>(c.create());
QVERIFY(item != 0);
void tst_qdeclarativeconnection::connection()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-connection.qml")));
QSGItem *item = qobject_cast<QSGItem*>(c.create());
QVERIFY(item != 0);
void tst_qdeclarativeconnection::trimming()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/trimming.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("trimming.qml")));
QSGItem *item = qobject_cast<QSGItem*>(c.create());
QVERIFY(item != 0);
void tst_qdeclarativeconnection::targetChanged()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/connection-targetchange.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("connection-targetchange.qml")));
QSGItem *item = qobject_cast<QSGItem*>(c.create());
QVERIFY(item != 0);
QFETCH(QString, file);
QFETCH(QString, error);
- QUrl url = QUrl::fromLocalFile(SRCDIR "/data/" + file);
+ QUrl url = QUrl::fromLocalFile(TESTDATA(file));
if (!error.isEmpty()) {
QTest::ignoreMessage(QtWarningMsg, (url.toString() + error).toLatin1());
} else {
QFETCH(QString, file);
QFETCH(QString, error);
- QUrl url = QUrl::fromLocalFile(SRCDIR "/data/" + file);
+ QUrl url = QUrl::fromLocalFile(TESTDATA(file));
QDeclarativeEngine engine;
QDeclarativeComponent c(&engine, url);
void tst_qdeclarativeconnection::moduleApiTarget()
{
qmlRegisterModuleApi("MyTestModuleApi", 1, 0, module_api_factory);
- QDeclarativeComponent component(&engine, QUrl(SRCDIR "/data/moduleapi-target.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("moduleapi-target.qml")));
QObject *object = component.create();
QVERIFY(object != 0);
SOURCES += tst_qdeclarativecontext.cpp
macx:CONFIG -= app_bundle
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private testlib
# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
# LIBS += -lgcov
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#temporary
#include <private/qdeclarativevmemetaobject_p.h>
#include "testtypes.h"
#include "testhttpserver.h"
+#include "../shared/util.h"
#include "../../../shared/util.h"
/*
*/
inline QUrl TEST_FILE(const QString &filename)
{
- QFileInfo fileInfo(__FILE__);
- return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename));
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
inline QUrl TEST_FILE(const char *filename)
{
TestHTTPServer server(8111);
QVERIFY(server.isValid());
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
QDeclarativeComponent component(&engine, TEST_FILE("include_remote.qml"));
QObject *o = component.create();
{
TestHTTPServer server(8111);
QVERIFY(server.isValid());
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
QDeclarativeComponent component(&engine, TEST_FILE("include_remote_missing.qml"));
QObject *o = component.create();
SOURCES += tst_qdeclarativeengine.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private network testlib
SOURCES += tst_qdeclarativeexpression.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QtDeclarative/qdeclarativeexpression.h>
#include <QtDeclarative/qdeclarativescriptstring.h>
+#include "../shared/util.h"
class tst_qdeclarativeexpression : public QObject
{
qmlRegisterType<TestObject>("Test", 1, 0, "TestObject");
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/scriptString.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("scriptString.qml")));
TestObject *testObj = qobject_cast<TestObject*>(c.create());
QVERIFY(testObj != 0);
SOURCES += tst_qdeclarativefolderlistmodel.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
QT += core-private gui-private declarative-private testlib
#include <QtCore/qfile.h>
#include <QtCore/qabstractitemmodel.h>
#include <QDebug>
+#include "../shared/util.h"
// From qdeclarastivefolderlistmodel.h
const int FileNameRole = Qt::UserRole+1;
void tst_qdeclarativefolderlistmodel::basicProperties()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("basic.qml")));
checkNoErrors(component);
QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
QVERIFY(flm != 0);
- flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data"));
+ flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("")));
QTRY_COMPARE(flm->property("count").toInt(),4); // wait for refresh
- QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(SRCDIR "/data"));
- QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(SRCDIR));
+ QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(TESTDATA("")));
+ QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(QDir(TESTDATA("..")).canonicalPath()));
QCOMPARE(flm->property("sortField").toInt(), int(Name));
QCOMPARE(flm->property("nameFilters").toStringList(), QStringList() << "*.qml");
QCOMPARE(flm->property("sortReversed").toBool(), false);
void tst_qdeclarativefolderlistmodel::resetFiltering()
{
// see QTBUG-17837
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/resetFiltering.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("resetFiltering.qml")));
checkNoErrors(component);
QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
connect(flm, SIGNAL(rowsRemoved(const QModelIndex&,int,int)),
this, SLOT(removed(const QModelIndex&,int,int)));
- flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data/resetfiltering"));
+ flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("resetfiltering")));
QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test.txt" visible
int count = flm->rowCount();
QCOMPARE(removeStart, 0);
QCOMPARE(removeEnd, count-1);
- flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data/resetfiltering/innerdir"));
+ flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("resetfiltering/innerdir")));
QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test2.txt" visible
count = flm->rowCount();
QCOMPARE(removeStart, 0);
QCOMPARE(removeEnd, count-1);
- flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data/resetfiltering"));
+ flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("resetfiltering")));
QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test.txt" visible
count = flm->rowCount();
QCOMPARE(removeStart, 0);
void tst_qdeclarativefolderlistmodel::refresh()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("basic.qml")));
checkNoErrors(component);
QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
QVERIFY(flm != 0);
- flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data"));
+ flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("")));
QTRY_COMPARE(flm->property("count").toInt(),4); // wait for refresh
int count = flm->rowCount();
HEADERS += ../../declarative/shared/testhttpserver.h
SOURCES += tst_qdeclarativefontloader.cpp ../../declarative/shared/testhttpserver.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QtDeclarative/qdeclarativecontext.h>
#include <QtDeclarative/private/qdeclarativefontloader_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
#include "../../declarative/shared/testhttpserver.h"
tst_qdeclarativefontloader::tst_qdeclarativefontloader() :
server(SERVER_PORT)
{
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
}
void tst_qdeclarativefontloader::init()
void tst_qdeclarativefontloader::localFont()
{
- QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }";
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + TESTDATA("tarzeau_ocr_a.ttf") + "\" }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create());
void tst_qdeclarativefontloader::failLocalFont()
{
- QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }";
- QTest::ignoreMessage(QtWarningMsg, QString("file::2:1: QML FontLoader: Cannot load font: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\"").toUtf8().constData());
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + QUrl::fromLocalFile(TESTDATA("dummy.ttf")).toString() + "\" }";
+ QTest::ignoreMessage(QtWarningMsg, QString("file::2:1: QML FontLoader: Cannot load font: \"" + QUrl::fromLocalFile(TESTDATA("dummy.ttf")).toString() + "\"").toUtf8().constData());
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create());
{
QString componentStr = "import QtQuick 2.0\nFontLoader { source: font }";
QDeclarativeContext *ctxt = engine.rootContext();
- ctxt->setContextProperty("font", QUrl::fromLocalFile(SRCDIR "/data/tarzeau_ocr_a.ttf"));
+ ctxt->setContextProperty("font", QUrl::fromLocalFile(TESTDATA("tarzeau_ocr_a.ttf")));
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create());
QCOMPARE(statusSpy.count(), 2);
QTRY_COMPARE(fontObject->name(), QString("Daniel"));
- ctxt->setContextProperty("font", QUrl::fromLocalFile(SRCDIR "/data/tarzeau_ocr_a.ttf"));
+ ctxt->setContextProperty("font", QUrl::fromLocalFile(TESTDATA("tarzeau_ocr_a.ttf")));
QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready);
QCOMPARE(nameSpy.count(), 2);
QCOMPARE(statusSpy.count(), 2);
SOURCES += tst_qdeclarativeimageprovider.cpp
-# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
-# LIBS += -lgcov
-
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private network testlib
testtypes.cpp
HEADERS += testtypes.h
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QDeclarativeProperty>
#include <QDeclarativeComponent>
#include <QDeclarativeIncubator>
+#include "../shared/util.h"
inline QUrl TEST_FILE(const QString &filename)
{
- QFileInfo fileInfo(__FILE__);
- return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename));
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
inline QUrl TEST_FILE(const char *filename)
QVERIFY(!component.isError()); \
QVERIFY(component.errors().isEmpty()); \
} else { \
- QFile file(QLatin1String(SRCDIR) + QLatin1String("/data/") + QLatin1String(errorfile)); \
+ QFile file(TESTDATA(errorfile)); \
QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \
QByteArray data = file.readAll(); \
file.close(); \
SOURCES += tst_qdeclarativeinfo.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
QT += core-private gui-private declarative-private widgets testlib
#include <QTimer>
#include <QDeclarativeContext>
#include <qdeclarativeinfo.h>
+#include "../shared/util.h"
class tst_qdeclarativeinfo : public QObject
{
inline QUrl TEST_FILE(const QString &filename)
{
- return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
void tst_qdeclarativeinfo::qmlObject()
SOURCES += tst_qdeclarativeinstruction.cpp
macx:CONFIG -= app_bundle
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
CONFIG += parallel_test
QT += core-private gui-private v8-private declarative-private testlib
SOURCES += tst_qdeclarativelistcompositor.cpp
-symbian: {
- importFiles.files = data
- importFiles.path = .
- DEPLOYMENT += importFiles
-} else {
- DEFINES += SRCDIR=\\\"$$PWD\\\"
-}
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private testlib
SOURCES += tst_qdeclarativelistreference.cpp
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
+
CONFIG += parallel_test
QT += core-private gui-private declarative-private testlib
#include <QtDeclarative/qdeclarativeprivate.h>
#include <QtDeclarative/qdeclarativeproperty.h>
#include <QDebug>
+#include "../shared/util.h"
inline QUrl TEST_FILE(const QString &filename)
{
- QFileInfo fileInfo(__FILE__);
- return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename));
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
inline QUrl TEST_FILE(const char *filename)
SOURCES += tst_qdeclarativemetatype.cpp
macx:CONFIG -= app_bundle
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private widgets testlib
SOURCES += tst_qdeclarativepath.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QtDeclarative/private/qdeclarativepath_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
class tst_QDeclarativePath : public QObject
void tst_QDeclarativePath::arc()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/arc.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("arc.qml")));
QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create());
QVERIFY(obj != 0);
void tst_QDeclarativePath::catmullromCurve()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/curve.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("curve.qml")));
QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create());
QVERIFY(obj != 0);
void tst_QDeclarativePath::svg()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/svg.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("svg.qml")));
QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create());
QVERIFY(obj != 0);
SOURCES += tst_qdeclarativeproperty.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtWidgets/QLineEdit>
#include <QtCore/qfileinfo.h>
#include <QtCore/qdir.h>
+#include "../shared/util.h"
inline QUrl TEST_FILE(const QString &filename)
{
- QFileInfo fileInfo(__FILE__);
- return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(QLatin1String("data/") + filename));
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
class MyQmlObject : public QObject
SOURCES += tst_qdeclarativeqt.cpp
macx:CONFIG -= app_bundle
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
-# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
-# LIBS += -lgcov
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QCryptographicHash>
#include <QSGItem>
#include <QSignalSpy>
+#include "../shared/util.h"
class tst_qdeclarativeqt : public QObject
{
inline QUrl TEST_FILE(const QString &filename)
{
- return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
void tst_qdeclarativeqt::enums()
SOURCES += tst_qdeclarativescriptdebugging.cpp
INCLUDEPATH += ../shared
-# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
-# LIBS += -lgcov
-
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtCore/QDir>
#include <QtScript/QScriptEngineAgent>
#include <private/qdeclarativeengine_p.h>
+#include "../shared/util.h"
class MyTestObject : public QObject {
Q_OBJECT
*/
inline QUrl TEST_FILE(const QString &filename)
{
- QFileInfo fileInfo(__FILE__);
- return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename));
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
inline QUrl TEST_FILE(const char *filename)
SOURCES += tst_qdeclarativesmoothedanimation.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <private/qdeclarativesmoothedanimation_p.h>
#include <private/qsgrectangle_p.h>
#include <private/qdeclarativevaluetype_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
class tst_qdeclarativesmoothedanimation : public QObject
void tst_qdeclarativesmoothedanimation::defaultValues()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimation1.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("smoothedanimation1.qml")));
QDeclarativeSmoothedAnimation *obj = qobject_cast<QDeclarativeSmoothedAnimation*>(c.create());
QVERIFY(obj != 0);
void tst_qdeclarativesmoothedanimation::values()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimation2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("smoothedanimation2.qml")));
QDeclarativeSmoothedAnimation *obj = qobject_cast<QDeclarativeSmoothedAnimation*>(c.create());
QVERIFY(obj != 0);
void tst_qdeclarativesmoothedanimation::disabled()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimation3.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("smoothedanimation3.qml")));
QDeclarativeSmoothedAnimation *obj = qobject_cast<QDeclarativeSmoothedAnimation*>(c.create());
QVERIFY(obj != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimationValueSource.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("smoothedanimationValueSource.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimationBehavior.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("smoothedanimationBehavior.qml")));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect);
SOURCES += tst_qdeclarativespringanimation.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativecomponent.h>
#include <private/qdeclarativespringanimation_p.h>
#include <private/qdeclarativevaluetype_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
class tst_qdeclarativespringanimation : public QObject
void tst_qdeclarativespringanimation::defaultValues()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springanimation1.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("springanimation1.qml")));
QDeclarativeSpringAnimation *obj = qobject_cast<QDeclarativeSpringAnimation*>(c.create());
QVERIFY(obj != 0);
void tst_qdeclarativespringanimation::values()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springanimation2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("springanimation2.qml")));
QDeclarativeSpringAnimation *obj = qobject_cast<QDeclarativeSpringAnimation*>(c.create());
QVERIFY(obj != 0);
void tst_qdeclarativespringanimation::disabled()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springanimation3.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("springanimation3.qml")));
QDeclarativeSpringAnimation *obj = qobject_cast<QDeclarativeSpringAnimation*>(c.create());
QVERIFY(obj != 0);
SOURCES += tst_qdeclarativestates.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
QT += core-private gui-private v8-private declarative-private opengl-private testlib
#include <private/qdeclarativestategroup_p.h>
#include <private/qsgitem_p.h>
#include <private/qdeclarativeproperty_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
class MyAttached : public QObject
QByteArray tst_qdeclarativestates::fullDataPath(const QString &path)
{
- return QUrl::fromLocalFile(SRCDIR + path).toString().toUtf8();
+ return QUrl::fromLocalFile(TESTDATA(path)).toString().toUtf8();
}
void tst_qdeclarativestates::basicChanges()
QDeclarativeEngine engine;
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("basicChanges.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
QVERIFY(rect != 0);
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges2.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("basicChanges2.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
QVERIFY(rect != 0);
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges3.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("basicChanges3.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
QVERIFY(rect != 0);
// signal using 'onPropertyWithNotifyChanged' even though the signal name is
// actually 'oddlyNamedNotifySignal'
- QDeclarativeComponent component(&engine, SRCDIR "/data/basicChanges4.qml");
+ QDeclarativeComponent component(&engine, TESTDATA("basicChanges4.qml"));
QVERIFY(component.isReady());
MyRect *rect = qobject_cast<MyRect*>(component.create());
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, SRCDIR "/data/attachedPropertyChanges.qml");
+ QDeclarativeComponent component(&engine, TESTDATA("attachedPropertyChanges.qml"));
QVERIFY(component.isReady());
QSGItem *item = qobject_cast<QSGItem*>(component.create());
QDeclarativeEngine engine;
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicExtension.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("basicExtension.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
QVERIFY(rect != 0);
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/fakeExtension.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("fakeExtension.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
QVERIFY(rect != 0);
QDeclarativeEngine engine;
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("basicBinding.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
QVERIFY(rect != 0);
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding2.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("basicBinding2.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
QVERIFY(rect != 0);
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding3.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("basicBinding3.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
QVERIFY(rect != 0);
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding4.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("basicBinding4.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
QVERIFY(rect != 0);
QDeclarativeEngine engine;
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverride.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("signalOverride.qml"));
MyRect *rect = qobject_cast<MyRect*>(rectComponent.create());
QVERIFY(rect != 0);
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverride2.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("signalOverride2.qml"));
MyRect *rect = qobject_cast<MyRect*>(rectComponent.create());
QVERIFY(rect != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("signalOverrideCrash.qml"));
MyRect *rect = qobject_cast<MyRect*>(rectComponent.create());
QVERIFY(rect != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash2.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("signalOverrideCrash2.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QDeclarativeEngine engine;
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange1.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange1.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange2.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange2.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange3.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange3.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange6.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange6.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QDeclarativeEngine engine;
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange4.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange4.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGRectangle *innerRect = qobject_cast<QSGRectangle*>(rect->findChild<QSGRectangle*>("MyRect"));
QVERIFY(innerRect != 0);
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/parentChange4.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under non-uniform scale");
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("parentChange4.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under non-uniform scale");
QSGItemPrivate::get(rect)->setState("reparented");
QCOMPARE(innerRect->rotation(), qreal(0));
QCOMPARE(innerRect->scale(), qreal(1));
}
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange5.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange5.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGRectangle *innerRect = qobject_cast<QSGRectangle*>(rect->findChild<QSGRectangle*>("MyRect"));
QVERIFY(innerRect != 0);
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/parentChange5.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under complex transform");
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("parentChange5.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under complex transform");
QSGItemPrivate::get(rect)->setState("reparented");
QCOMPARE(innerRect->rotation(), qreal(0));
QCOMPARE(innerRect->scale(), qreal(1));
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges1.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges1.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges2.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges2.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges3.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges4.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges4.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges5.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges5.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges1.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges1.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges2.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges2.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges3.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChangesCrash.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChangesCrash.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
void tst_qdeclarativestates::anchorRewindBug()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchorRewindBug.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("anchorRewindBug.qml")));
view->show();
view->requestActivateWindow();
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorRewindBug2.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorRewindBug2.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QDeclarativeEngine engine;
{
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/script.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("script.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/restoreEntryValues.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("restoreEntryValues.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/explicit.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("explicit.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
void tst_qdeclarativestates::propertyErrors()
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/propertyErrors.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("propertyErrors.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QCOMPARE(rect->color(),QColor("red"));
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to read-only property \"activeFocus\"");
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to read-only property \"activeFocus\"");
QSGItemPrivate::get(rect)->setState("blue");
}
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("basicChanges.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, SRCDIR "/data/autoStateAtStartupRestoreBug.qml");
+ QDeclarativeComponent component(&engine, TESTDATA("autoStateAtStartupRestoreBug.qml"));
QObject *obj = component.create();
QVERIFY(obj != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/deleting.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("deleting.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/deletingState.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("deletingState.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/legalTempState.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("legalTempState.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/illegalTempState.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("illegalTempState.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/nonExistantProp.qml");
+ QDeclarativeComponent rectComponent(&engine, TESTDATA("nonExistantProp.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/nonExistantProp.qml") + ":9:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("nonExistantProp.qml") + ":9:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
rectPrivate->setState("blue");
QCOMPARE(rectPrivate->state(), QLatin1String("blue"));
}
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/reset.qml");
+ QDeclarativeComponent c(&engine, TESTDATA("reset.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, SRCDIR "/data/illegalObj.qml");
+ QDeclarativeComponent component(&engine, TESTDATA("illegalObj.qml"));
QList<QDeclarativeError> errors = component.errors();
QVERIFY(errors.count() == 1);
const QDeclarativeError &error = errors.at(0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/whenOrdering.qml");
+ QDeclarativeComponent c(&engine, TESTDATA("whenOrdering.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/urlResolution.qml");
+ QDeclarativeComponent c(&engine, TESTDATA("urlResolution.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
QVERIFY(myType != 0 && image1 != 0 && image2 != 0 && image3 != 0);
QSGItemPrivate::get(myType)->setState("SetImageState");
- QUrl resolved = QUrl::fromLocalFile(SRCDIR "/data/Implementation/images/qt-logo.png");
+ QUrl resolved = QUrl::fromLocalFile(TESTDATA("Implementation/images/qt-logo.png"));
QCOMPARE(image1->source(), resolved);
QCOMPARE(image2->source(), resolved);
QCOMPARE(image3->source(), resolved);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/unnamedWhen.qml");
+ QDeclarativeComponent c(&engine, TESTDATA("unnamedWhen.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/returnToBase.qml");
+ QDeclarativeComponent c(&engine, TESTDATA("returnToBase.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/extendsBug.qml");
+ QDeclarativeComponent c(&engine, TESTDATA("extendsBug.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/editProperties.qml");
+ QDeclarativeComponent c(&engine, TESTDATA("editProperties.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, SRCDIR "/data/QTBUG-14830.qml");
+ QDeclarativeComponent c(&engine, TESTDATA("QTBUG-14830.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
QSGItem *item = rect->findChild<QSGItem*>("area");
QDeclarativeEngine engine;
//shouldn't fast forward if there isn't a transition
- QDeclarativeComponent c(&engine, SRCDIR "/data/avoidFastForward.qml");
+ QDeclarativeComponent c(&engine, TESTDATA("avoidFastForward.qml"));
QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
QVERIFY(rect != 0);
SOURCES += tst_qdeclarativestyledtext.cpp
-# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
-# LIBS += -lgcov
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private network testlib
SOURCES += tst_qdeclarativesystempalette.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private widgets testlib
SOURCES += tst_qdeclarativetimer.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private gui testlib
SOURCES += tst_qdeclarativetranslation.cpp
RESOURCES += data/translation.qrc
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QDeclarativeEngine>
#include <QDeclarativeComponent>
#include <QTranslator>
+#include "../shared/util.h"
class tst_qdeclarativetranslation : public QObject
{
inline QUrl TEST_FILE(const QString &filename)
{
- return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
void tst_qdeclarativetranslation::translation()
{
QTranslator translator;
- translator.load(QLatin1String("qml_fr"), QLatin1String(SRCDIR) + QLatin1String("/data"));
+ translator.load(QLatin1String("qml_fr"), TESTDATA(""));
QCoreApplication::installTranslator(&translator);
QDeclarativeEngine engine;
void tst_qdeclarativetranslation::idTranslation()
{
QTranslator translator;
- translator.load(QLatin1String("qmlid_fr"), QLatin1String(SRCDIR) + QLatin1String("/data"));
+ translator.load(QLatin1String("qmlid_fr"),TESTDATA(""));
QCoreApplication::installTranslator(&translator);
QDeclarativeEngine engine;
SOURCES += tst_qdeclarativevaluetypes.cpp \
testtypes.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QDeclarativeComponent>
#include <QDebug>
#include <private/qdeclarativevaluetype_p.h>
+#include "../shared/util.h"
#include "testtypes.h"
QT_BEGIN_NAMESPACE
inline QUrl TEST_FILE(const QString &filename)
{
- return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
void tst_qdeclarativevaluetypes::point()
SOURCES += tst_qdeclarativeworkerscript.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <private/qdeclarativeworkerscript_p.h>
#include <private/qdeclarativeengine_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
inline QUrl TEST_FILE(const QString &filename)
{
- QFileInfo fileInfo(__FILE__);
- return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename));
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
void tst_QDeclarativeWorkerScript::source()
{
- QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml");
+ QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
const QMetaObject *mo = worker->metaObject();
waitForEchoMessage(worker);
QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), value);
- QUrl source = QUrl::fromLocalFile(SRCDIR "/data/script_fixed_return.js");
+ QUrl source = QUrl::fromLocalFile(TESTDATA("script_fixed_return.js"));
worker->setSource(source);
QCOMPARE(worker->source(), source);
QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
{
QFETCH(QVariant, value);
- QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml");
+ QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
// instances. If objects are sent in a list, they will be sent as 'undefined'
// js values.
- QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml");
+ QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
void tst_QDeclarativeWorkerScript::messaging_sendJsObject()
{
- QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml");
+ QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
{
QVariant value(100);
- QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_pragma.qml");
+ QDeclarativeComponent component(&m_engine, TESTDATA("worker_pragma.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
void tst_QDeclarativeWorkerScript::script_included()
{
- QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_include.qml");
+ QDeclarativeComponent component(&m_engine, TESTDATA("worker_include.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
void tst_QDeclarativeWorkerScript::scriptError_onLoad()
{
- QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_error_onLoad.qml");
+ QDeclarativeComponent component(&m_engine, TESTDATA("worker_error_onLoad.qml"));
QtMsgHandler previousMsgHandler = qInstallMsgHandler(qdeclarativeworkerscript_warningsHandler);
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
QTRY_COMPARE(qdeclarativeworkerscript_lastWarning,
- TEST_FILE("data/script_error_onLoad.js").toString() + QLatin1String(":3: SyntaxError: Unexpected identifier"));
+ TEST_FILE("script_error_onLoad.js").toString() + QLatin1String(":3: SyntaxError: Unexpected identifier"));
qInstallMsgHandler(previousMsgHandler);
qApp->processEvents();
void tst_QDeclarativeWorkerScript::scriptError_onCall()
{
- QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_error_onCall.qml");
+ QDeclarativeComponent component(&m_engine, TESTDATA("worker_error_onCall.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
QTRY_COMPARE(qdeclarativeworkerscript_lastWarning,
- TEST_FILE("data/script_error_onCall.js").toString() + QLatin1String(":4: ReferenceError: Can't find variable: getData"));
+ TEST_FILE("script_error_onCall.js").toString() + QLatin1String(":4: ReferenceError: Can't find variable: getData"));
qInstallMsgHandler(previousMsgHandler);
qApp->processEvents();
{
for (int ii = 0; ii < 100; ++ii) {
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, SRCDIR "/data/stressDispose.qml");
+ QDeclarativeComponent component(&engine, TESTDATA("stressDispose.qml"));
QObject *o = component.create();
QVERIFY(o);
delete o;
SOURCES += tst_qdeclarativexmlhttprequest.cpp \
../shared/testhttpserver.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QDebug>
#include <QNetworkCookieJar>
#include "testhttpserver.h"
+#include "../shared/util.h"
#include "../../../shared/util.h"
#define SERVER_PORT 14445
inline QUrl TEST_FILE(const QString &filename)
{
- return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
// Test that the dom exception codes are correct
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirecttarget.html");
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
QDeclarativeComponent component(&engine, TEST_FILE("redirects.qml"));
QObject *object = component.beginCreate(engine.rootContext());
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirectmissing.html");
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
QDeclarativeComponent component(&engine, TEST_FILE("redirectError.qml"));
QObject *object = component.beginCreate(engine.rootContext());
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirect.html");
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
QDeclarativeComponent component(&engine, TEST_FILE("redirectRecur.qml"));
QObject *object = component.beginCreate(engine.rootContext());
SOURCES += tst_qdeclarativexmllistmodel.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtCore/qtimer.h>
#include <QtCore/qfile.h>
#include <QtCore/qtemporaryfile.h>
+#include "../shared/util.h"
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
void tst_qdeclarativexmllistmodel::buildModel()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 9);
QFETCH(QString, roleName);
QFETCH(QVariant, expectedValue);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/testtypes.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("testtypes.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
model->setXml(xml.toUtf8());
void tst_qdeclarativexmllistmodel::cdata()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("recipes.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 5);
void tst_qdeclarativexmllistmodel::attributes()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("recipes.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 5);
void tst_qdeclarativexmllistmodel::roles()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 9);
void tst_qdeclarativexmllistmodel::roleErrors()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml"));
- QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml").toString() + ":6:5: QML XmlRole: An XmlRole query must not start with '/'").toUtf8().constData());
- QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml").toString() + ":9:5: QML XmlRole: invalid query: \"age/\"").toUtf8().constData());
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleErrors.qml")));
+ QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(TESTDATA("roleErrors.qml")).toString() + ":6:5: QML XmlRole: An XmlRole query must not start with '/'").toUtf8().constData());
+ QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(TESTDATA("roleErrors.qml")).toString() + ":9:5: QML XmlRole: invalid query: \"age/\"").toUtf8().constData());
//### make sure we receive all expected warning messages.
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
void tst_qdeclarativexmllistmodel::uniqueRoleNames()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/unique.qml"));
- QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(SRCDIR "/data/unique.qml").toString() + ":7:5: QML XmlRole: \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData());
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("unique.qml")));
+ QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(TESTDATA("unique.qml")).toString() + ":7:5: QML XmlRole: \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData());
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 9);
QFETCH(QString, xml);
QFETCH(int, count);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QSignalSpy spy(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status)));
CustomNetworkAccessManagerFactory factory;
qmlEng.setNetworkAccessManagerFactory(&factory);
- QDeclarativeComponent component(&qmlEng, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+ QDeclarativeComponent component(&qmlEng, QUrl::fromLocalFile(TESTDATA("model.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->status(), QDeclarativeXmlListModel::Ready);
QFETCH(int, count);
QFETCH(QDeclarativeXmlListModel::Status, status);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QSignalSpy spy(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status)));
QTest::addColumn<int>("count");
QTest::addColumn<QDeclarativeXmlListModel::Status>("status");
- QTest::newRow("valid") << QUrl::fromLocalFile(SRCDIR "/data/model2.xml") << 2 << QDeclarativeXmlListModel::Ready;
+ QTest::newRow("valid") << QUrl::fromLocalFile(TESTDATA("model2.xml")) << 2 << QDeclarativeXmlListModel::Ready;
QTest::newRow("invalid") << QUrl("http://blah.blah/blah.xml") << 0 << QDeclarativeXmlListModel::Error;
// empty file
void tst_qdeclarativexmllistmodel::data()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
void tst_qdeclarativexmllistmodel::get()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/get.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("get.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
// If no keys are used, the model should be rebuilt from scratch when
// reload() is called.
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 9);
QFETCH(QList<QDeclarativeXmlListRange>, insertRanges);
QFETCH(QList<QDeclarativeXmlListRange>, removeRanges);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
// If a 'sport' value is changed, the model should not be reloaded,
// since 'sport' is not marked as a key.
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
// delete all its data and build a clean model (i.e. same behaviour as
// if no keys are set).
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
{
QFETCH(int, xmlDataCount);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml")));
QDeclarativeXmlListModel *m1 = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(m1 != 0);
void tst_qdeclarativexmllistmodel::propertyChanges()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("propertychanges.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 9);
void tst_qdeclarativexmllistmodel::roleCrash()
{
// don't crash
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleCrash.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleCrash.qml")));
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QVERIFY(model != 0);
delete model;
SOURCES += tst_qsganimatedimage.cpp ../shared/testhttpserver.cpp
macx:CONFIG -= app_bundle
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativecontext.h>
#include "../shared/testhttpserver.h"
+#include "../shared/util.h"
#include "../../../shared/util.h"
class tst_qsganimatedimage : public QObject
void tst_qsganimatedimage::play()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickman.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickman.qml")));
QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create());
QVERIFY(anim);
QVERIFY(anim->isPlaying());
void tst_qsganimatedimage::pause()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickmanpause.qml")));
QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create());
QVERIFY(anim);
QVERIFY(anim->isPlaying());
void tst_qsganimatedimage::stopped()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanstopped.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickmanstopped.qml")));
QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create());
QVERIFY(anim);
QVERIFY(!anim->isPlaying());
void tst_qsganimatedimage::setFrame()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickmanpause.qml")));
QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create());
QVERIFY(anim);
QVERIFY(anim->isPlaying());
void tst_qsganimatedimage::frameCount()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/colors.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("colors.qml")));
QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create());
QVERIFY(anim);
QVERIFY(anim->isPlaying());
QSGView *canvas = new QSGView;
canvas->show();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/hearts.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("hearts.qml")));
QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(canvas->rootObject());
QVERIFY(anim);
{
QTest::addColumn<QUrl>("fileUrl");
- QTest::newRow("paused") << QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml");
- QTest::newRow("stopped") << QUrl::fromLocalFile(SRCDIR "/data/stickmanstopped.qml");
+ QTest::newRow("paused") << QUrl::fromLocalFile(TESTDATA("stickmanpause.qml"));
+ QTest::newRow("stopped") << QUrl::fromLocalFile(TESTDATA("stickmanstopped.qml"));
}
void tst_qsganimatedimage::remote()
TestHTTPServer server(14449);
QVERIFY(server.isValid());
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
QDeclarativeEngine engine;
QDeclarativeComponent component(&engine, QUrl("http://127.0.0.1:14449/" + fileName));
void tst_qsganimatedimage::sourceSize()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanscaled.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickmanscaled.qml")));
QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create());
QVERIFY(anim);
QCOMPARE(anim->width(),240.0);
void tst_qsganimatedimage::sourceSizeReadOnly()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanerror1.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickmanerror1.qml")));
QVERIFY(component.isError());
QCOMPARE(component.errors().at(0).description(), QString("Invalid property assignment: \"sourceSize\" is a read-only property"));
}
{
TestHTTPServer server(14449);
QVERIFY(server.isValid());
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/qtbug-16520.qml"));
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("qtbug-16520.qml")));
QTRY_VERIFY(component.isReady());
QSGRectangle *root = qobject_cast<QSGRectangle *>(component.create());
{
TestHTTPServer server(14449);
QVERIFY(server.isValid());
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
QDeclarativeEngine engine;
QString componentStr = "import QtQuick 2.0\nAnimatedImage { source: srcImage }";
QDeclarativeContext *ctxt = engine.rootContext();
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/stickman.gif"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("stickman.gif")));
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QSGImageBase::Status)));
// Loading local file
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.gif"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("colors.gif")));
QTRY_VERIFY(obj->status() == QSGImage::Ready);
QTRY_VERIFY(obj->progress() == 1.0);
QTRY_COMPARE(sourceSpy.count(), 1);
HEADERS += ../shared/testhttpserver.h
SOURCES += tst_qsgborderimage.cpp ../shared/testhttpserver.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativecontext.h>
#include "../shared/testhttpserver.h"
+#include "../shared/util.h"
#include "../../../shared/util.h"
#define SERVER_PORT 14446
QTest::addColumn<bool>("remote");
QTest::addColumn<QString>("error");
- QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << "";
- QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << false
- << "file::2:1: QML BorderImage: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString();
+ QTest::newRow("local") << QUrl::fromLocalFile(TESTDATA("colors.png")).toString() << false << "";
+ QTest::newRow("local not found") << QUrl::fromLocalFile(TESTDATA("no-such-file.png")).toString() << false
+ << "file::2:1: QML BorderImage: Cannot open: " + QUrl::fromLocalFile(TESTDATA("no-such-file.png")).toString();
QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << "";
QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true
<< "file::2:1: QML BorderImage: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found";
if (remote) {
server = new TestHTTPServer(SERVER_PORT);
QVERIFY(server->isValid());
- server->serveDirectory(SRCDIR "/data");
+ server->serveDirectory(TESTDATA(""));
}
if (!error.isEmpty())
{
QString componentStr = "import QtQuick 2.0\nBorderImage { source: srcImage }";
QDeclarativeContext *ctxt = engine.rootContext();
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("colors.png")));
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
void tst_qsgborderimage::resized()
{
- QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(TESTDATA("colors.png")).toString() + "\"; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
void tst_qsgborderimage::smooth()
{
- QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + TESTDATA("colors.png") + "\"; smooth: true; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
QSGView *canvas = new QSGView;
canvas->show();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirror.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("mirror.qml")));
QSGBorderImage *image = qobject_cast<QSGBorderImage*>(canvas->rootObject());
QVERIFY(image != 0);
canvas->show();
void tst_qsgborderimage::tileModes()
{
{
- QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + TESTDATA("colors.png") + "\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
delete obj;
}
{
- QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + TESTDATA("colors.png") + "\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
if (remote) {
server = new TestHTTPServer(SERVER_PORT);
QVERIFY(server->isValid());
- server->serveDirectory(SRCDIR "/data");
+ server->serveDirectory(TESTDATA(""));
}
QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }";
QTest::addColumn<QString>("source");
QTest::addColumn<bool>("valid");
- QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors-round.sci").toString() << true;
- QTest::newRow("local quoted filename") << QUrl::fromLocalFile(SRCDIR "/data/colors-round-quotes.sci").toString() << true;
- QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.sci").toString() << false;
+ QTest::newRow("local") << QUrl::fromLocalFile(TESTDATA("colors-round.sci")).toString() << true;
+ QTest::newRow("local quoted filename") << QUrl::fromLocalFile(TESTDATA("colors-round-quotes.sci")).toString() << true;
+ QTest::newRow("local not found") << QUrl::fromLocalFile(TESTDATA("no-such-file.sci")).toString() << false;
QTest::newRow("remote") << SERVER_ADDR "/colors-round.sci" << true;
QTest::newRow("remote filename quoted") << SERVER_ADDR "/colors-round-quotes.sci" << true;
QTest::newRow("remote image") << SERVER_ADDR "/colors-round-remote.sci" << true;
QTest::ignoreMessage(QtWarningMsg, "QSGGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Roun"
QTest::ignoreMessage(QtWarningMsg, "QSGGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Repea"
- QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(TESTDATA("invalid.sci")).toString() +"\"; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
SOURCES += tst_qsgdrag.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private
SOURCES += tst_qsgdroparea.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
CONFIG += parallel_test
QT += core-private gui-private declarative-private
SOURCES += tst_qsgflickable.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#temporary
#include <private/qsgflickable_p.h>
#include <private/qdeclarativevaluetype_p.h>
#include <math.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
#include <QtOpenGL/QGLShaderProgram>
void tst_qsgflickable::create()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable01.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("flickable01.qml")));
QSGFlickable *obj = qobject_cast<QSGFlickable*>(c.create());
QVERIFY(obj != 0);
void tst_qsgflickable::horizontalViewportSize()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable02.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("flickable02.qml")));
QSGFlickable *obj = qobject_cast<QSGFlickable*>(c.create());
QVERIFY(obj != 0);
void tst_qsgflickable::verticalViewportSize()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable03.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("flickable03.qml")));
QSGFlickable *obj = qobject_cast<QSGFlickable*>(c.create());
QVERIFY(obj != 0);
void tst_qsgflickable::properties()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable04.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("flickable04.qml")));
QSGFlickable *obj = qobject_cast<QSGFlickable*>(c.create());
QVERIFY(obj != 0);
void tst_qsgflickable::nestedPressDelay()
{
QSGView *canvas = new QSGView;
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/nestedPressDelay.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("nestedPressDelay.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_qsgflickable::resizeContent()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/resize.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("resize.qml")));
QSGItem *root = qobject_cast<QSGItem*>(c.create());
QSGFlickable *obj = findItem<QSGFlickable>(root, "flick");
void tst_qsgflickable::returnToBounds()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/resize.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("resize.qml")));
QSGItem *root = qobject_cast<QSGItem*>(c.create());
QSGFlickable *obj = findItem<QSGFlickable>(root, "flick");
void tst_qsgflickable::wheel()
{
QSGView *canvas = new QSGView;
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/wheel.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("wheel.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_qsgflickable::movingAndDragging()
{
QSGView *canvas = new QSGView;
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/flickable03.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("flickable03.qml")));
canvas->show();
canvas->requestActivateWindow();
QTest::qWaitForWindowShown(canvas);
void tst_qsgflickable::disabled()
{
QSGView *canvas = new QSGView;
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/disabled.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("disabled.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
#endif
QSGView *canvas = new QSGView;
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/flickable03.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("flickable03.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_qsgflickable::margins()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/margins.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("margins.qml")));
QSGItem *root = qobject_cast<QSGItem*>(c.create());
QSGFlickable *obj = qobject_cast<QSGFlickable*>(root);
QVERIFY(obj != 0);
SOURCES += tst_qsgflipable.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <private/qsgrectangle_p.h>
#include <math.h>
#include <QtOpenGL/QGLShaderProgram>
+#include "../shared/util.h"
class tst_qsgflipable : public QObject
{
void tst_qsgflipable::create()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-flipable.qml")));
QSGFlipable *obj = qobject_cast<QSGFlipable*>(c.create());
QVERIFY(obj != 0);
void tst_qsgflipable::checkFrontAndBack()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-flipable.qml")));
QSGFlipable *obj = qobject_cast<QSGFlipable*>(c.create());
QVERIFY(obj != 0);
void tst_qsgflipable::setFrontAndBack()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-flipable.qml")));
QSGFlipable *obj = qobject_cast<QSGFlipable*>(c.create());
QVERIFY(obj != 0);
void tst_qsgflipable::QTBUG_9161_crash()
{
QSGView *canvas = new QSGView;
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/crash.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("crash.qml")));
QSGItem *root = canvas->rootObject();
QVERIFY(root != 0);
canvas->show();
void tst_qsgflipable::QTBUG_8474_qgv_abort()
{
QSGView *canvas = new QSGView;
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/flipable-abort.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("flipable-abort.qml")));
QSGItem *root = canvas->rootObject();
QVERIFY(root != 0);
canvas->show();
SOURCES += tst_qsgfocusscope.cpp
macx:CONFIG -= app_bundle
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
QT += core-private gui-private declarative-private testlib
#include <private/qsgtextedit_p.h>
#include <private/qsgtext_p.h>
#include <QtDeclarative/private/qsgfocusscope_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
-#include <QtOpenGL/QGLShaderProgram>
class tst_qsgfocusscope : public QObject
{
void tst_qsgfocusscope::basic()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/test.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("test.qml")));
QSGFocusScope *item0 = findItem<QSGFocusScope>(view->rootObject(), QLatin1String("item0"));
QSGRectangle *item1 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item1"));
void tst_qsgfocusscope::nested()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/test2.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("test2.qml")));
QSGFocusScope *item1 = findItem<QSGFocusScope>(view->rootObject(), QLatin1String("item1"));
QSGFocusScope *item2 = findItem<QSGFocusScope>(view->rootObject(), QLatin1String("item2"));
void tst_qsgfocusscope::noFocus()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/test4.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("test4.qml")));
QSGRectangle *item0 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item0"));
QSGRectangle *item1 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item1"));
void tst_qsgfocusscope::textEdit()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/test5.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("test5.qml")));
QSGFocusScope *item0 = findItem<QSGFocusScope>(view->rootObject(), QLatin1String("item0"));
QSGTextEdit *item1 = findItem<QSGTextEdit>(view->rootObject(), QLatin1String("item1"));
void tst_qsgfocusscope::forceFocus()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/forcefocus.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("forcefocus.qml")));
QSGFocusScope *item0 = findItem<QSGFocusScope>(view->rootObject(), QLatin1String("item0"));
QSGRectangle *item1 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item1"));
void tst_qsgfocusscope::noParentFocus()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/chain.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("chain.qml")));
QVERIFY(view->rootObject());
view->show();
void tst_qsgfocusscope::signalEmission()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/signalEmission.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("signalEmission.qml")));
QSGRectangle *item1 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item1"));
QSGRectangle *item2 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item2"));
void tst_qsgfocusscope::qtBug13380()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtBug13380.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("qtBug13380.qml")));
view->show();
QVERIFY(view->rootObject());
void tst_qsgfocusscope::forceActiveFocus()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/forceActiveFocus.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("forceActiveFocus.qml")));
view->show();
view->requestActivateWindow();
void tst_qsgfocusscope::canvasFocus()
{
QSGView *view = new QSGView;
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/canvasFocus.qml"));
+ view->setSource(QUrl::fromLocalFile(TESTDATA("canvasFocus.qml")));
QSGItem *rootObject = view->rootObject();
QVERIFY(rootObject);
SOURCES += tst_qsggridview.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#temporary
#include <QtDeclarative/private/qsggridview_p.h>
#include <QtDeclarative/private/qsgtext_p.h>
#include <QtDeclarative/private/qdeclarativelistmodel_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
-#include <QtOpenGL/QGLShaderProgram>
#include <QtGui/qguiapplication.h>
Q_DECLARE_METATYPE(Qt::LayoutDirection)
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGFlickable *gridview = findItem<QSGFlickable>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- QString filename(SRCDIR "/data/gridview-initCurrent.qml");
+ QString filename(TESTDATA("gridview-initCurrent.qml"));
canvas->setSource(QUrl::fromLocalFile(filename));
qApp->processEvents();
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- QString filename(SRCDIR "/data/gridview-noCurrent.qml");
+ QString filename(TESTDATA("gridview-noCurrent.qml"));
canvas->setSource(QUrl::fromLocalFile(filename));
qApp->processEvents();
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
void tst_QSGGridView::defaultValues()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview3.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("gridview3.qml")));
QSGGridView *obj = qobject_cast<QSGGridView*>(c.create());
QTRY_VERIFY(obj != 0);
void tst_QSGGridView::properties()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("gridview2.qml")));
QSGGridView *obj = qobject_cast<QSGGridView*>(c.create());
QTRY_VERIFY(obj != 0);
{
QSGView *canvas = createView();
QTRY_VERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml")));
QSGGridView *gridView = canvas->rootObject()->findChild<QSGGridView*>("gridView");
QTRY_VERIFY(gridView);
{
QSGView *canvas = createView();
QTRY_VERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml")));
QSGGridView *gridView = canvas->rootObject()->findChild<QSGGridView*>("gridView");
QTRY_VERIFY(gridView);
{
QSGView *canvas = createView();
QTRY_VERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml")));
QSGGridView *gridView = canvas->rootObject()->findChild<QSGGridView*>("gridView");
QTRY_VERIFY(gridView);
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testTopToBottom", QVariant(false));
ctxt->setContextProperty("testRightToLeft", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
void tst_QSGGridView::mirroring()
{
QSGView *canvasA = createView();
- canvasA->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirroring.qml"));
+ canvasA->setSource(QUrl::fromLocalFile(TESTDATA("mirroring.qml")));
QSGGridView *gridviewA = findItem<QSGGridView>(canvasA->rootObject(), "view");
QTRY_VERIFY(gridviewA != 0);
QSGView *canvasB = createView();
- canvasB->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirroring.qml"));
+ canvasB->setSource(QUrl::fromLocalFile(TESTDATA("mirroring.qml")));
QSGGridView *gridviewB = findItem<QSGGridView>(canvasB->rootObject(), "view");
QTRY_VERIFY(gridviewA != 0);
qApp->processEvents();
ctxt->setContextProperty("testTopToBottom", QVariant(true));
ctxt->setContextProperty("testRightToLeft", QVariant(true));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaygrid.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("displaygrid.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview-enforcerange.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview-enforcerange.qml")));
qApp->processEvents();
QVERIFY(canvas->rootObject() != 0);
ctxt->setContextProperty("testRightToLeft", QVariant(true));
ctxt->setContextProperty("testTopToBottom", QVariant(true));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview-enforcerange.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview-enforcerange.qml")));
qApp->processEvents();
QVERIFY(canvas->rootObject() != 0);
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/setindex.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("setindex.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
{
QSGView *canvas = createView();
- QString filename(SRCDIR "/data/manual-highlight.qml");
+ QString filename(TESTDATA("manual-highlight.qml"));
canvas->setSource(QUrl::fromLocalFile(filename));
qApp->processEvents();
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/footer.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("footer.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
canvas->rootContext()->setContextProperty("testModel", &model);
canvas->rootContext()->setContextProperty("initialViewWidth", 240);
canvas->rootContext()->setContextProperty("initialViewHeight", 320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("header.qml")));
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
QTRY_VERIFY(gridview != 0);
canvas->rootContext()->setContextProperty("testModel", &model);
canvas->rootContext()->setContextProperty("initialViewWidth", 240);
canvas->rootContext()->setContextProperty("initialViewHeight", 320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("header.qml")));
gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
QTRY_VERIFY(gridview != 0);
ctxt->setContextProperty("testRightToLeft", QVariant(false));
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("delegateWidth", delegateWidth);
ctxt->setContextProperty("delegateHeight", delegateHeight);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("attachedSignals.qml")));
QObject *object = canvas->rootObject();
object->setProperty("width", canvas->width());
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("delegateWidth", delegateWidth);
ctxt->setContextProperty("delegateHeight", delegateHeight);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("attachedSignals.qml")));
QObject *object = canvas->rootObject();
model.removeItems(indexToRemove, removeCount);
void tst_QSGGridView::columnCount()
{
QSGView canvas;
- canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview4.qml"));
+ canvas.setSource(QUrl::fromLocalFile(TESTDATA("gridview4.qml")));
canvas.show();
canvas.requestActivateWindow();
QTest::qWaitForWindowShown(&canvas);
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testRightToLeft", QVariant(false));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("margins.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testRightToLeft", QVariant(true));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("margins.qml")));
qApp->processEvents();
QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid");
{
QSGView canvas;
canvas.setGeometry(0,0,240,320);
- canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/creationContext.qml"));
+ canvas.setSource(QUrl::fromLocalFile(TESTDATA("creationContext.qml")));
qApp->processEvents();
QSGItem *rootItem = qobject_cast<QSGItem *>(canvas.rootObject());
HEADERS += ../shared/testhttpserver.h
SOURCES += tst_qsgimage.cpp ../shared/testhttpserver.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#temporary
#include <QtGui/QPainter>
#include <QtGui/QImageReader>
+#include "../shared/util.h"
#include "../../../shared/util.h"
#include "../shared/testhttpserver.h"
QTest::addColumn<bool>("cache");
QTest::addColumn<QString>("error");
- QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << true << "";
- QTest::newRow("local no cache") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << false << "";
- QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << true << "";
- QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << 0.0 << 0.0 << false
- << false << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString();
- QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << 0.0 << 0.0 << false
- << true << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString();
+ QTest::newRow("local") << QUrl::fromLocalFile(TESTDATA("colors.png")).toString() << 120.0 << 120.0 << false << false << true << "";
+ QTest::newRow("local no cache") << QUrl::fromLocalFile(TESTDATA("colors.png")).toString() << 120.0 << 120.0 << false << false << false << "";
+ QTest::newRow("local async") << QUrl::fromLocalFile(TESTDATA("colors1.png")).toString() << 120.0 << 120.0 << false << true << true << "";
+ QTest::newRow("local not found") << QUrl::fromLocalFile(TESTDATA("no-such-file.png")).toString() << 0.0 << 0.0 << false
+ << false << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(TESTDATA("no-such-file.png")).toString();
+ QTest::newRow("local async not found") << QUrl::fromLocalFile(TESTDATA("no-such-file-1.png")).toString() << 0.0 << 0.0 << false
+ << true << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(TESTDATA("no-such-file-1.png")).toString();
QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << true << "";
QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << false << "";
if (QImageReader::supportedImageFormats().contains("svg"))
TestHTTPServer server(SERVER_PORT);
if (remote) {
QVERIFY(server.isValid());
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png");
}
{
QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }";
QDeclarativeContext *ctxt = engine.rootContext();
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("colors.png")));
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
void tst_qsgimage::resized()
{
- QString componentStr = "import QtQuick 2.0\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + TESTDATA("colors.png") + "\"; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
QSGView *canvas = new QSGView(0);
canvas->show();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/aspectratio.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("aspectratio.qml")));
QSGImage *image = qobject_cast<QSGImage*>(canvas->rootObject());
QVERIFY(image != 0);
image->setWidth(80.0);
QCOMPARE(image->width(), 80.);
QCOMPARE(image->height(), 80.);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/aspectratio.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("aspectratio.qml")));
image = qobject_cast<QSGImage*>(canvas->rootObject());
image->setHeight(60.0);
QVERIFY(image != 0);
void tst_qsgimage::smooth()
{
- QString componentStr = "import QtQuick 2.0\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + TESTDATA("colors.png") + "\"; smooth: true; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
foreach (QSGImage::FillMode fillMode, fillModes) {
QSGView *canvas = new QSGView;
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirror.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("mirror.qml")));
QSGImage *obj = canvas->rootObject()->findChild<QSGImage*>("image");
QVERIFY(obj != 0);
foreach (QSGImage::FillMode fillMode, fillModes) {
QPixmap srcPixmap;
- QVERIFY(srcPixmap.load(SRCDIR "/data/pattern.png"));
+ QVERIFY(srcPixmap.load(TESTDATA("pattern.png")));
QPixmap expected(width, height);
expected.fill();
if (!QImageReader::supportedImageFormats().contains("svg"))
QSKIP("svg support not available", SkipAll);
- QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.svg").toString();
+ QString src = QUrl::fromLocalFile(TESTDATA("heart.svg")).toString();
QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QFETCH(double, boundingWidth);
QFETCH(double, boundingHeight);
- QString src = QUrl::fromLocalFile(SRCDIR "/data/rect.png").toString();
+ QString src = QUrl::fromLocalFile(TESTDATA("rect.png")).toString();
QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; fillMode: Image." + fillMode + "; ";
if (explicitWidth)
// If the JPEG loader does not implement scaling efficiently, it would
// have to build a 400 MB image. That would be a bug in the JPEG loader.
- QString src = QUrl::fromLocalFile(SRCDIR "/data/big.jpeg").toString();
+ QString src = QUrl::fromLocalFile(TESTDATA("big.jpeg")).toString();
QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 100; sourceSize.height: 256 }";
QDeclarativeComponent component(&engine);
QFETCH(QString, source);
QSGView *canvas = new QSGView(0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR + source));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA(source)));
canvas->show();
qApp->processEvents();
{
QTest::addColumn<QString>("source");
#ifdef QT_BUILD_INTERNAL // QTBUG-21688 - unstable test on developer build
- QTest::newRow("vertical_tiling") << "/data/vtiling.qml";
+ QTest::newRow("vertical_tiling") << "vtiling.qml";
#endif
- QTest::newRow("horizontal_tiling") << "/data/htiling.qml";
+ QTest::newRow("horizontal_tiling") << "htiling.qml";
}
void tst_qsgimage::noLoading()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png");
QString componentStr = "import QtQuick 2.0\nImage { source: srcImage; cache: true }";
QDeclarativeContext *ctxt = engine.rootContext();
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart.png"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("heart.png")));
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QSGImageBase::Status)));
// Loading local file
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/green.png"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("green.png")));
QTRY_VERIFY(obj->status() == QSGImage::Ready);
QTRY_VERIFY(obj->progress() == 1.0);
QTRY_COMPARE(sourceSpy.count(), 1);
QTRY_COMPARE(statusSpy.count(), 2);
// Loading remote file again - should not go through 'Loading' state.
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/green.png"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("green.png")));
ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/rect.png");
QTRY_VERIFY(obj->status() == QSGImage::Ready);
QTRY_VERIFY(obj->progress() == 1.0);
void tst_qsgimage::paintedWidthHeight()
{
{
- QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.png").toString();
+ QString src = QUrl::fromLocalFile(TESTDATA("heart.png")).toString();
QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 200; height: 25; fillMode: Image.PreserveAspectFit }";
QDeclarativeComponent component(&engine);
}
{
- QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.png").toString();
+ QString src = QUrl::fromLocalFile(TESTDATA("heart.png")).toString();
QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 26; height: 175; fillMode: Image.PreserveAspectFit }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
{
QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }";
QDeclarativeContext *ctxt = engine.rootContext();
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart200.png"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("heart200.png")));
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
QTRY_COMPARE(obj->sourceSize().height(), 200);
QTRY_COMPARE(sourceSizeSpy.count(), 0);
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("colors.png")));
QTRY_COMPARE(obj->sourceSize().width(), 120);
QTRY_COMPARE(obj->sourceSize().height(), 120);
QTRY_COMPARE(sourceSizeSpy.count(), 1);
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart200.png"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("heart200.png")));
QTRY_COMPARE(obj->sourceSize().width(), 200);
QTRY_COMPARE(obj->sourceSize().height(), 200);
QTRY_COMPARE(sourceSizeSpy.count(), 2);
void tst_qsgimage::sourceSize_QTBUG_16389()
{
QSGView *canvas = new QSGView(0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug_16389.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("qtbug_16389.qml")));
canvas->show();
qApp->processEvents();
void tst_qsgimage::nullPixmapPaint()
{
QSGView *canvas = new QSGView(0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/nullpixmap.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("nullpixmap.qml")));
canvas->show();
QSGImage *image = qobject_cast<QSGImage*>(canvas->rootObject());
SOURCES += tst_qsgitem.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qsgview.h>
#include <private/qsgrectangle_p.h>
#include <private/qsgitem_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
class tst_QSGItem : public QObject
canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(true));
canvas->rootContext()->setContextProperty("forwardeeVisible", QVariant(true));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keystest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("keystest.qml")));
canvas->show();
qApp->processEvents();
KeysTestObject *testObject = new KeysTestObject;
canvas->rootContext()->setContextProperty("keysTestObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keyspriority.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("keyspriority.qml")));
canvas->show();
qApp->processEvents();
void tst_QSGItem::layoutMirroring()
{
QSGView *canvas = new QSGView(0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/layoutmirroring.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("layoutmirroring.qml")));
canvas->show();
QSGItem *rootItem = qobject_cast<QSGItem*>(canvas->rootObject());
QSGView *canvas = new QSGView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigationtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest.qml")));
canvas->show();
qApp->processEvents();
QSGView *canvas = new QSGView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigationtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest.qml")));
canvas->show();
qApp->processEvents();
QSGView *canvas = new QSGView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigationtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest.qml")));
canvas->show();
qApp->processEvents();
QSGView *canvas = new QSGView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigationtest_implicit.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest_implicit.qml")));
canvas->show();
qApp->processEvents();
QSGView *canvas = new QSGView(0);
canvas->setFixedSize(300, 300);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/mapCoordinates.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml")));
canvas->show();
qApp->processEvents();
Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y)));
QCOMPARE(result.value<QPointF>(), qobject_cast<QSGItem*>(a)->mapFromScene(QPointF(x, y)));
- QString warning1 = QUrl::fromLocalFile(SRCDIR "/data/mapCoordinates.qml").toString() + ":7:5: QML Item: mapToItem() given argument \"1122\" which is neither null nor an Item";
- QString warning2 = QUrl::fromLocalFile(SRCDIR "/data/mapCoordinates.qml").toString() + ":7:5: QML Item: mapFromItem() given argument \"1122\" which is neither null nor an Item";
+ QString warning1 = QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml")).toString() + ":7:5: QML Item: mapToItem() given argument \"1122\" which is neither null nor an Item";
+ QString warning2 = QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml")).toString() + ":7:5: QML Item: mapFromItem() given argument \"1122\" which is neither null nor an Item";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QVERIFY(QMetaObject::invokeMethod(root, "checkMapAToInvalid",
void tst_QSGItem::childrenProperty()
{
- QDeclarativeComponent component(&engine, SRCDIR "/data/childrenProperty.qml");
+ QDeclarativeComponent component(&engine, TESTDATA("childrenProperty.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
void tst_QSGItem::resourcesProperty()
{
- QDeclarativeComponent component(&engine, SRCDIR "/data/resourcesProperty.qml");
+ QDeclarativeComponent component(&engine, TESTDATA("resourcesProperty.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
{
QSGView *canvas = new QSGView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml")));
canvas->show();
QApplication::setActiveWindow(canvas);
{
QSGView *canvas = new QSGView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRect.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("childrenRect.qml")));
canvas->show();
QSGItem *o = canvas->rootObject();
void tst_QSGItem::childrenRectBug()
{
QSGView *canvas = new QSGView(0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("childrenRectBug.qml")));
canvas->show();
QSGItem *o = canvas->rootObject();
void tst_QSGItem::childrenRectBug2()
{
QSGView *canvas = new QSGView(0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug2.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("childrenRectBug2.qml")));
canvas->show();
QSGRectangle *rect = qobject_cast<QSGRectangle*>(canvas->rootObject());
void tst_QSGItem::childrenRectBug3()
{
QSGView *canvas = new QSGView(0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug3.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("childrenRectBug3.qml")));
canvas->show();
//don't crash on delete
void tst_QSGItem::transformCrash()
{
QSGView *canvas = new QSGView(0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/transformCrash.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("transformCrash.qml")));
canvas->show();
delete canvas;
void tst_QSGItem::implicitSize()
{
QSGView *canvas = new QSGView(0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/implicitsize.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("implicitsize.qml")));
canvas->show();
QSGItem *item = qobject_cast<QSGItem*>(canvas->rootObject());
void tst_QSGItem::qtbug_16871()
{
- QDeclarativeComponent component(&engine, SRCDIR "/data/qtbug_16871.qml");
+ QDeclarativeComponent component(&engine, TESTDATA("qtbug_16871.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
delete o;
HEADERS += incrementalmodel.h
SOURCES += tst_qsglistview.cpp incrementalmodel.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += insignificant_test parallel_test
QT += core-private gui-private declarative-private widgets widgets-private v8-private opengl-private testlib
#include <QtDeclarative/private/qdeclarativelistmodel_p.h>
#include <QtDeclarative/private/qlistmodelinterface_p.h>
#include <QtDeclarative/private/qdeclarativechangeset_p.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
#include "incrementalmodel.h"
-#include <QtOpenGL/QGLShaderProgram>
Q_DECLARE_METATYPE(Qt::LayoutDirection)
Q_DECLARE_METATYPE(QSGListView::Orientation)
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGFlickable *listview = findItem<QSGFlickable>(canvas->rootObject(), "list");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
canvas->show();
qApp->processEvents();
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-enforcerange.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listview-enforcerange.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-enforcerange-nohighlight.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listview-enforcerange-nohighlight.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listview-sections.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections_delegate.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listview-sections_delegate.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections_delegate.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listview-sections_delegate.qml")));
qApp->processEvents();
canvas->rootObject()->setProperty("sectionPositioning", QVariant(int(QSGViewSection::InlineLabels | QSGViewSection::CurrentLabelAtStart | QSGViewSection::NextLabelAtEnd)));
// (since the currentItem will have changed and that shares the same index)
canvas->rootContext()->setContextProperty("setCurrentToZero", setCurrentToZero);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/fillModelOnComponentCompleted.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("fillModelOnComponentCompleted.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testWrap", QVariant(false));
- QString filename(SRCDIR "/data/listview-initCurrent.qml");
+ QString filename(TESTDATA("listview-initCurrent.qml"));
canvas->setSource(QUrl::fromLocalFile(filename));
qApp->processEvents();
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- QString filename(SRCDIR "/data/listview-noCurrent.qml");
+ QString filename(TESTDATA("listview-noCurrent.qml"));
canvas->setSource(QUrl::fromLocalFile(filename));
qApp->processEvents();
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/itemlist.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("itemlist.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "view");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaylist.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("displaylist.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
{
QSGView *canvas = createView();
QTRY_VERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml")));
QSGListView *listView = canvas->rootObject()->findChild<QSGListView*>("listView");
QTRY_VERIFY(listView);
{
QSGView *canvas = createView();
QTRY_VERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml")));
QSGListView *listView = canvas->rootObject()->findChild<QSGListView*>("listView");
QTRY_VERIFY(listView);
{
QSGView *canvas = createView();
QTRY_VERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml")));
QSGListView *listView = canvas->rootObject()->findChild<QSGListView*>("listView");
QTRY_VERIFY(listView);
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/strictlyenforcerange.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("strictlyenforcerange.qml")));
qApp->processEvents();
QSGListView *listview = qobject_cast<QSGListView*>(canvas->rootObject());
QSGView *canvas = new QSGView(0);
canvas->setGeometry(0,0,240,320);
- QString filename(SRCDIR "/data/manual-highlight.qml");
+ QString filename(TESTDATA("manual-highlight.qml"));
canvas->setSource(QUrl::fromLocalFile(filename));
qApp->processEvents();
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
canvas->rootContext()->setContextProperty("testModel", &model);
canvas->rootContext()->setContextProperty("initialViewWidth", 240);
canvas->rootContext()->setContextProperty("initialViewHeight", 320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("header.qml")));
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QTRY_VERIFY(listview != 0);
canvas->rootContext()->setContextProperty("testModel", &model);
canvas->rootContext()->setContextProperty("initialViewWidth", 0.0);
canvas->rootContext()->setContextProperty("initialViewHeight", 0.0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("header.qml")));
listview = findItem<QSGListView>(canvas->rootObject(), "list");
QTRY_VERIFY(listview != 0);
TestModel model;
canvas->rootContext()->setContextProperty("setCurrentToZero", false);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/fillModelOnComponentCompleted.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("fillModelOnComponentCompleted.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/footer.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("footer.qml")));
canvas->show();
qApp->processEvents();
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/headerfooter.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("headerfooter.qml")));
qApp->processEvents();
QSGListView *listview = qobject_cast<QSGListView*>(canvas->rootObject());
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/headerfooter.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("headerfooter.qml")));
canvas->rootObject()->setProperty("horizontal", true);
qApp->processEvents();
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/headerfooter.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("headerfooter.qml")));
canvas->rootObject()->setProperty("horizontal", true);
canvas->rootObject()->setProperty("rtl", true);
qApp->processEvents();
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/sizelessthan1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("sizelessthan1.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug14821.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("qtbug14821.qml")));
qApp->processEvents();
QSGListView *listview = qobject_cast<QSGListView*>(canvas->rootObject());
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaylist.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("displaylist.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QSGView *canvas = createView();
canvas->show();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug16037.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("qtbug16037.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "listview");
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaylist.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("displaylist.qml")));
qApp->processEvents();
QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("delegateHeight", delegateHeight);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("attachedSignals.qml")));
QObject *object = canvas->rootObject();
object->setProperty("width", canvas->width());
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("delegateHeight", delegateHeight);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("attachedSignals.qml")));
QObject *object = canvas->rootObject();
model.removeItems(indexToRemove, removeCount);
{
QSGView *canvas = createView();
canvas->setGeometry(0,0,640,320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("rightToLeft.qml")));
qApp->processEvents();
QVERIFY(canvas->rootObject() != 0);
void tst_QSGListView::test_mirroring()
{
QSGView *canvasA = createView();
- canvasA->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml"));
+ canvasA->setSource(QUrl::fromLocalFile(TESTDATA("rightToLeft.qml")));
QSGListView *listviewA = findItem<QSGListView>(canvasA->rootObject(), "view");
QTRY_VERIFY(listviewA != 0);
QSGView *canvasB = createView();
- canvasB->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml"));
+ canvasB->setSource(QUrl::fromLocalFile(TESTDATA("rightToLeft.qml")));
QSGListView *listviewB = findItem<QSGListView>(canvasB->rootObject(), "view");
QTRY_VERIFY(listviewA != 0);
qApp->processEvents();
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("margins.qml")));
canvas->show();
qApp->processEvents();
{
QSGView canvas;
canvas.setGeometry(0,0,240,320);
- canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/creationContext.qml"));
+ canvas.setSource(QUrl::fromLocalFile(TESTDATA("creationContext.qml")));
qApp->processEvents();
QSGItem *rootItem = qobject_cast<QSGItem *>(canvas.rootObject());
SOURCES += tst_qsgloader.cpp \
../shared/testhttpserver.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativeincubator.h>
#include <private/qsgloader_p.h>
#include "testhttpserver.h"
+#include "../shared/util.h"
#include "../../../shared/util.h"
#define SERVER_PORT 14450
inline QUrl TEST_FILE(const QString &filename)
{
- return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
class PeriodicIncubationController : public QObject,
QTest::addColumn<QUrl>("sourceUrl");
QTest::addColumn<QString>("errorString");
- QTest::newRow("source") << "source" << "source: 'Rect120x60.qml'\n" << QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml") << "";
+ QTest::newRow("source") << "source" << "source: 'Rect120x60.qml'\n" << QUrl::fromLocalFile(TESTDATA("Rect120x60.qml")) << "";
QTest::newRow("sourceComponent") << "component" << "Component { id: comp; Rectangle { width: 100; height: 50 } }\n sourceComponent: comp\n" << QUrl() << "";
- QTest::newRow("invalid source") << "source" << "source: 'IDontExist.qml'\n" << QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml")
- << QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found");
+ QTest::newRow("invalid source") << "source" << "source: 'IDontExist.qml'\n" << QUrl::fromLocalFile(TESTDATA("IDontExist.qml"))
+ << QString(QUrl::fromLocalFile(TESTDATA("IDontExist.qml")).toString() + ": File not found");
}
void tst_QSGLoader::clear()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
QDeclarativeComponent component(&engine);
- component.setData(QByteArray("import QtQuick 2.0\nLoader { property int signalCount : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: signalCount += 1 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml"));
+ component.setData(QByteArray("import QtQuick 2.0\nLoader { property int signalCount : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: signalCount += 1 }"), QUrl::fromLocalFile(TESTDATA("../dummy.qml")));
if (component.isError())
qDebug() << component.errors();
QSGLoader *loader = qobject_cast<QSGLoader*>(component.create());
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
QTest::ignoreMessage(QtWarningMsg, "http://127.0.0.1:14450/IDontExist.qml: File not found");
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- server.serveDirectory(SRCDIR "/data");
+ server.serveDirectory(TESTDATA(""));
foreach (const QString &warning, expectedWarnings)
QTest::ignoreMessage(QtWarningMsg, warning.toAscii().constData());
QCOMPARE(loader->status(), QSGLoader::Ready);
qApp->processEvents(QEventLoop::DeferredDeletion);
QTRY_COMPARE(static_cast<QSGItem*>(loader)->childItems().count(), 1);
- QVERIFY(loader->source() == QUrl::fromLocalFile(SRCDIR "/data/BlueRect.qml"));
+ QVERIFY(loader->source() == QUrl::fromLocalFile(TESTDATA("BlueRect.qml")));
delete item;
}
void tst_QSGLoader::nonItem()
{
QDeclarativeComponent component(&engine, TEST_FILE("nonItem.qml"));
- QString err = QUrl::fromLocalFile(SRCDIR).toString() + "/data/nonItem.qml:3:1: QML Loader: Loader does not support loading non-visual elements.";
+ QString err = QUrl::fromLocalFile(TESTDATA("nonItem.qml")).toString() + ":3:1: QML Loader: Loader does not support loading non-visual elements.";
QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData());
QSGLoader *loader = qobject_cast<QSGLoader*>(component.create());
void tst_QSGLoader::vmeErrors()
{
QDeclarativeComponent component(&engine, TEST_FILE("vmeErrors.qml"));
- QString err = QUrl::fromLocalFile(SRCDIR).toString() + "/data/VmeError.qml:6: Cannot assign object type QObject with no default method";
+ QString err = QUrl::fromLocalFile(TESTDATA("VmeError.qml")).toString() + ":6: Cannot assign object type QObject with no default method";
QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData());
QSGLoader *loader = qobject_cast<QSGLoader*>(component.create());
QVERIFY(loader);
HEADERS += ../shared/testhttpserver.h
SOURCES += tst_qsgmousearea.cpp ../shared/testhttpserver.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <QtDeclarative/qdeclarativecontext.h>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtOpenGL/QGLShaderProgram>
+#include "../shared/util.h"
#include "../../../shared/util.h"
//#define OLDWAY
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragproperties.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("dragproperties.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
QSGView *canvas = createView();
canvas->rootContext()->setContextProperty("haveTarget", QVariant(true));
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragreset.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("dragreset.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragging.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("dragging.qml")));
canvas->show();
canvas->requestActivateWindow();
QTest::qWait(20);
void tst_QSGMouseArea::updateMouseAreaPosOnClick()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/updateMousePosOnClick.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("updateMousePosOnClick.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_QSGMouseArea::updateMouseAreaPosOnResize()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/updateMousePosOnResize.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("updateMousePosOnResize.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
{
// We handle onPressAndHold, therefore no onClicked
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/clickandhold.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("clickandhold.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
{
// We do not handle onPressAndHold, therefore we get onClicked
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/noclickandhold.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("noclickandhold.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_QSGMouseArea::onMousePressRejected()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/rejectEvent.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("rejectEvent.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_QSGMouseArea::pressedCanceledOnWindowDeactivate()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pressedCanceled.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pressedCanceled.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_QSGMouseArea::doubleClick()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/doubleclick.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("doubleclick.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_QSGMouseArea::clickTwice()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/clicktwice.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("clicktwice.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_QSGMouseArea::pressedOrdering()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pressedOrdering.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pressedOrdering.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/preventstealing.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("preventstealing.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
{
//With no handlers defined click, doubleClick and PressAndHold should propagate to those with handlers
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/clickThrough.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("clickThrough.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
//With handlers defined click, doubleClick and PressAndHold should propagate only when explicitly ignored
canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/clickThrough2.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("clickThrough2.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_QSGMouseArea::hoverPosition()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/hoverPosition.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("hoverPosition.qml")));
QSGItem *root = canvas->rootObject();
QVERIFY(root != 0);
{
//QTBUG-18175, to behave like GV did.
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/hoverPropagation.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("hoverPropagation.qml")));
QSGItem *root = canvas->rootObject();
QVERIFY(root != 0);
SOURCES += tst_qsgpathview.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#temporary
#include <QStringListModel>
#include <QStandardItemModel>
#include <QFile>
-#include <QtOpenGL/QGLShaderProgram>
+#include "../shared/util.h"
#include "../../../shared/util.h"
static void initStandardTreeModel(QStandardItemModel *model)
void tst_QSGPathView::initValues()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview1.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathview1.qml")));
QSGPathView *obj = qobject_cast<QSGPathView*>(c.create());
QVERIFY(obj != 0);
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview0.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathview0.qml")));
qApp->processEvents();
QSGPathView *pathview = findItem<QSGPathView>(canvas->rootObject(), "view");
void tst_QSGPathView::pathview2()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview2.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathview2.qml")));
QSGPathView *obj = qobject_cast<QSGPathView*>(c.create());
QVERIFY(obj != 0);
void tst_QSGPathView::pathview3()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview3.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathview3.qml")));
QSGPathView *obj = qobject_cast<QSGPathView*>(c.create());
QVERIFY(obj != 0);
void tst_QSGPathView::path()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathtest.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathtest.qml")));
QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create());
QVERIFY(obj != 0);
ctxt->setContextProperty("testData", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/datamodel.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("datamodel.qml")));
qApp->processEvents();
QSGPathView *pathview = qobject_cast<QSGPathView*>(canvas->rootObject());
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview0.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathview0.qml")));
qApp->processEvents();
QSGPathView *pathview = findItem<QSGPathView>(canvas->rootObject(), "view");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview0.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathview0.qml")));
qApp->processEvents();
QSGPathView *pathview = findItem<QSGPathView>(canvas->rootObject(), "view");
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaypath.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("displaypath.qml")));
qApp->processEvents();
QSGPathView *pathview = findItem<QSGPathView>(canvas->rootObject(), "view");
{
QSGView *canvas = createView();
QVERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml")));
QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView");
QVERIFY(pathView);
{
QSGView *canvas = createView();
QVERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml")));
QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView");
QVERIFY(pathView);
{
QSGView *canvas = createView();
QVERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml")));
QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView");
QVERIFY(pathView);
{
QSGView *canvas = createView();
QVERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml")));
QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView");
QVERIFY(pathView);
{
QSGView *canvas = createView();
QVERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathUpdateOnStartChanged.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathUpdateOnStartChanged.qml")));
QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView");
QVERIFY(pathView);
{
QSGView *canvas = createView();
QVERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview_package.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathview_package.qml")));
QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("photoPathView");
QVERIFY(pathView);
QDeclarativeContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("emptyModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/emptymodel.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("emptymodel.qml")));
qApp->processEvents();
QSGPathView *pathview = qobject_cast<QSGPathView*>(canvas->rootObject());
QDeclarativeEngine engine;
{
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/openPath.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("openPath.qml")));
QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create());
QVERIFY(obj);
QCOMPARE(obj->isClosed(), false);
}
{
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/closedPath.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("closedPath.qml")));
QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create());
QVERIFY(obj);
QCOMPARE(obj->isClosed(), true);
{
QSGView *canvas = createView();
QVERIFY(canvas);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathUpdate.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathUpdate.qml")));
QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView");
QVERIFY(pathView);
void tst_QSGPathView::visualDataModel()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/vdm.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("vdm.qml")));
QSGPathView *obj = qobject_cast<QSGPathView*>(c.create());
QVERIFY(obj != 0);
void tst_QSGPathView::undefinedPath()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/undefinedpath.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("undefinedpath.qml")));
QSGPathView *obj = qobject_cast<QSGPathView*>(c.create());
QVERIFY(obj != 0);
void tst_QSGPathView::mouseDrag()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragpath.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("dragpath.qml")));
canvas->show();
canvas->requestActivateWindow();
QTest::qWaitForWindowShown(canvas);
initStandardTreeModel(&model);
canvas->engine()->rootContext()->setContextProperty("myModel", &model);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/treemodel.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("treemodel.qml")));
QSGPathView *pathview = qobject_cast<QSGPathView*>(canvas->rootObject());
QVERIFY(pathview != 0);
{
QSGView *canvas = createView();
canvas->setGeometry(0,0,400,200);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragpath.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("dragpath.qml")));
canvas->show();
canvas->requestActivateWindow();
QTest::qWaitForWindowShown(canvas);
{
QSGView canvas;
canvas.setGeometry(0,0,240,320);
- canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/creationContext.qml"));
+ canvas.setSource(QUrl::fromLocalFile(TESTDATA("creationContext.qml")));
QSGItem *rootItem = qobject_cast<QSGItem *>(canvas.rootObject());
QVERIFY(rootItem);
void tst_QSGPathView::missingPercent()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/missingPercent.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("missingPercent.qml")));
QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create());
QVERIFY(obj);
QCOMPARE(obj->attributeAt("_qfx_percent", 1.0), qreal(1.0));
SOURCES += tst_qsgpincharea.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#include <private/qsgrectangle_p.h>
#include <QtDeclarative/qsgview.h>
#include <QtDeclarative/qdeclarativecontext.h>
-#include <QtOpenGL/QGLShaderProgram>
+#include "../shared/util.h"
class tst_QSGPinchArea: public QObject
{
void tst_QSGPinchArea::pinchProperties()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml")));
canvas->show();
canvas->requestActivateWindow();
QVERIFY(canvas->rootObject() != 0);
void tst_QSGPinchArea::scale()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml")));
canvas->show();
canvas->requestActivateWindow();
QTest::qWaitForWindowShown(canvas);
void tst_QSGPinchArea::pan()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml")));
canvas->show();
canvas->requestActivateWindow();
QTest::qWaitForWindowShown(canvas);
void tst_QSGPinchArea::retouch()
{
QSGView *canvas = createView();
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml")));
canvas->show();
canvas->requestActivateWindow();
QTest::qWaitForWindowShown(canvas);
SOURCES += tst_qsgpositioners.cpp
macx:CONFIG -= app_bundle
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
#temporary
#include <private/qdeclarativetransition_p.h>
#include <private/qsgitem_p.h>
#include <qdeclarativeexpression.h>
-#include <QtWidgets/qgraphicswidget.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
class tst_qsgpositioners : public QObject
void tst_qsgpositioners::test_horizontal()
{
- QSGView *canvas = createView(SRCDIR "/data/horizontal.qml");
+ QSGView *canvas = createView(TESTDATA("horizontal.qml"));
canvas->rootObject()->setProperty("testRightToLeft", false);
void tst_qsgpositioners::test_horizontal_rtl()
{
- QSGView *canvas = createView(SRCDIR "/data/horizontal.qml");
+ QSGView *canvas = createView(TESTDATA("horizontal.qml"));
canvas->rootObject()->setProperty("testRightToLeft", true);
void tst_qsgpositioners::test_horizontal_spacing()
{
- QSGView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml");
+ QSGView *canvas = createView(TESTDATA("horizontal-spacing.qml"));
canvas->rootObject()->setProperty("testRightToLeft", false);
void tst_qsgpositioners::test_horizontal_spacing_rightToLeft()
{
- QSGView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml");
+ QSGView *canvas = createView(TESTDATA("horizontal-spacing.qml"));
canvas->rootObject()->setProperty("testRightToLeft", true);
void tst_qsgpositioners::test_horizontal_animated()
{
- QSGView *canvas = createView(SRCDIR "/data/horizontal-animated.qml", false);
+ QSGView *canvas = createView(TESTDATA("horizontal-animated.qml"), false);
canvas->rootObject()->setProperty("testRightToLeft", false);
void tst_qsgpositioners::test_horizontal_animated_rightToLeft()
{
- QSGView *canvas = createView(SRCDIR "/data/horizontal-animated.qml", false);
+ QSGView *canvas = createView(TESTDATA("horizontal-animated.qml"), false);
canvas->rootObject()->setProperty("testRightToLeft", true);
void tst_qsgpositioners::test_horizontal_animated_disabled()
{
- QSGView *canvas = createView(SRCDIR "/data/horizontal-animated-disabled.qml");
+ QSGView *canvas = createView(TESTDATA("horizontal-animated-disabled.qml"));
QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
QVERIFY(one != 0);
void tst_qsgpositioners::test_vertical()
{
- QSGView *canvas = createView(SRCDIR "/data/vertical.qml");
+ QSGView *canvas = createView(TESTDATA("vertical.qml"));
QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
QVERIFY(one != 0);
void tst_qsgpositioners::test_vertical_spacing()
{
- QSGView *canvas = createView(SRCDIR "/data/vertical-spacing.qml");
+ QSGView *canvas = createView(TESTDATA("vertical-spacing.qml"));
QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
QVERIFY(one != 0);
void tst_qsgpositioners::test_vertical_animated()
{
- QSGView *canvas = createView(SRCDIR "/data/vertical-animated.qml", false);
+ QSGView *canvas = createView(TESTDATA("vertical-animated.qml"), false);
//Note that they animate in
QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
void tst_qsgpositioners::test_grid()
{
- QSGView *canvas = createView(SRCDIR "/data/gridtest.qml");
+ QSGView *canvas = createView(TESTDATA("gridtest.qml"));
QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
QVERIFY(one != 0);
void tst_qsgpositioners::test_grid_topToBottom()
{
- QSGView *canvas = createView(SRCDIR "/data/grid-toptobottom.qml");
+ QSGView *canvas = createView(TESTDATA("grid-toptobottom.qml"));
QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
QVERIFY(one != 0);
void tst_qsgpositioners::test_grid_rightToLeft()
{
- QSGView *canvas = createView(SRCDIR "/data/gridtest.qml");
+ QSGView *canvas = createView(TESTDATA("gridtest.qml"));
canvas->rootObject()->setProperty("testRightToLeft", true);
void tst_qsgpositioners::test_grid_spacing()
{
- QSGView *canvas = createView(SRCDIR "/data/grid-spacing.qml");
+ QSGView *canvas = createView(TESTDATA("grid-spacing.qml"));
QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
QVERIFY(one != 0);
void tst_qsgpositioners::test_grid_row_column_spacing()
{
- QSGView *canvas = createView(SRCDIR "/data/grid-row-column-spacing.qml");
+ QSGView *canvas = createView(TESTDATA("grid-row-column-spacing.qml"));
QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
QVERIFY(one != 0);
void tst_qsgpositioners::test_grid_animated()
{
- QSGView *canvas = createView(SRCDIR "/data/grid-animated.qml", false);
+ QSGView *canvas = createView(TESTDATA("grid-animated.qml"), false);
canvas->rootObject()->setProperty("testRightToLeft", false);
void tst_qsgpositioners::test_grid_animated_rightToLeft()
{
- QSGView *canvas = createView(SRCDIR "/data/grid-animated.qml", false);
+ QSGView *canvas = createView(TESTDATA("grid-animated.qml"), false);
canvas->rootObject()->setProperty("testRightToLeft", true);
void tst_qsgpositioners::test_grid_zero_columns()
{
- QSGView *canvas = createView(SRCDIR "/data/gridzerocolumns.qml");
+ QSGView *canvas = createView(TESTDATA("gridzerocolumns.qml"));
QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
QVERIFY(one != 0);
void tst_qsgpositioners::test_propertychanges()
{
- QSGView *canvas = createView(SRCDIR "/data/propertychangestest.qml");
+ QSGView *canvas = createView(TESTDATA("propertychangestest.qml"));
QSGGrid *grid = qobject_cast<QSGGrid*>(canvas->rootObject());
QVERIFY(grid != 0);
void tst_qsgpositioners::test_repeater()
{
- QSGView *canvas = createView(SRCDIR "/data/repeatertest.qml");
+ QSGView *canvas = createView(TESTDATA("repeatertest.qml"));
QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
QVERIFY(one != 0);
void tst_qsgpositioners::test_flow()
{
- QSGView *canvas = createView(SRCDIR "/data/flowtest.qml");
+ QSGView *canvas = createView(TESTDATA("flowtest.qml"));
canvas->rootObject()->setProperty("testRightToLeft", false);
void tst_qsgpositioners::test_flow_rightToLeft()
{
- QSGView *canvas = createView(SRCDIR "/data/flowtest.qml");
+ QSGView *canvas = createView(TESTDATA("flowtest.qml"));
canvas->rootObject()->setProperty("testRightToLeft", true);
void tst_qsgpositioners::test_flow_topToBottom()
{
- QSGView *canvas = createView(SRCDIR "/data/flowtest-toptobottom.qml");
+ QSGView *canvas = createView(TESTDATA("flowtest-toptobottom.qml"));
canvas->rootObject()->setProperty("testRightToLeft", false);
void tst_qsgpositioners::test_flow_resize()
{
- QSGView *canvas = createView(SRCDIR "/data/flowtest.qml");
+ QSGView *canvas = createView(TESTDATA("flowtest.qml"));
QSGItem *root = qobject_cast<QSGItem*>(canvas->rootObject());
QVERIFY(root);
void tst_qsgpositioners::test_flow_resize_rightToLeft()
{
- QSGView *canvas = createView(SRCDIR "/data/flowtest.qml");
+ QSGView *canvas = createView(TESTDATA("flowtest.qml"));
QSGItem *root = qobject_cast<QSGItem*>(canvas->rootObject());
QVERIFY(root);
void tst_qsgpositioners::test_flow_implicit_resize()
{
- QSGView *canvas = createView(SRCDIR "/data/flow-testimplicitsize.qml");
+ QSGView *canvas = createView(TESTDATA("flow-testimplicitsize.qml"));
QVERIFY(canvas->rootObject() != 0);
QSGFlow *flow = canvas->rootObject()->findChild<QSGFlow*>("flow");
objectNames << "one" << "two" << "three" << "four" << "five";
foreach(const QString qmlFile, qmlFiles) {
- QSGView *canvasA = createView(QString(SRCDIR) + "/data/" + qmlFile);
+ QSGView *canvasA = createView(TESTDATA(qmlFile));
QSGItem *rootA = qobject_cast<QSGItem*>(canvasA->rootObject());
- QSGView *canvasB = createView(QString(SRCDIR) + "/data/" + qmlFile);
+ QSGView *canvasB = createView(TESTDATA(qmlFile));
QSGItem *rootB = qobject_cast<QSGItem*>(canvasB->rootObject());
rootA->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft
void tst_qsgpositioners::test_allInvisible()
{
//QTBUG-19361
- QSGView *canvas = createView(SRCDIR "/data/allInvisible.qml");
+ QSGView *canvas = createView(TESTDATA("allInvisible.qml"));
QSGItem *root = qobject_cast<QSGItem*>(canvas->rootObject());
QVERIFY(root);
{
QTest::addColumn<QString>("filename");
- QTest::newRow("column") << SRCDIR "/data/attachedproperties-column.qml";
- QTest::newRow("row") << SRCDIR "/data/attachedproperties-row.qml";
- QTest::newRow("grid") << SRCDIR "/data/attachedproperties-grid.qml";
- QTest::newRow("flow") << SRCDIR "/data/attachedproperties-flow.qml";
+ QTest::newRow("column") << TESTDATA("attachedproperties-column.qml");
+ QTest::newRow("row") << TESTDATA("attachedproperties-row.qml");
+ QTest::newRow("grid") << TESTDATA("attachedproperties-grid.qml");
+ QTest::newRow("flow") << TESTDATA("attachedproperties-flow.qml");
}
void tst_qsgpositioners::test_attachedproperties_dynamic()
{
- QSGView *canvas = createView(SRCDIR "/data/attachedproperties-dynamic.qml");
+ QSGView *canvas = createView(TESTDATA("attachedproperties-dynamic.qml"));
QVERIFY(canvas->rootObject() != 0);
QSGRow *row = canvas->rootObject()->findChild<QSGRow *>("pos");
HEADERS += ../shared/testhttpserver.h
SOURCES += ../shared/testhttpserver.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += insignificant_test parallel_test
#include <private/qapplication_p.h>
#include <limits.h>
#include <QtGui/QMouseEvent>
+#include "../shared/util.h"
#include "../../../shared/util.h"
#include "testhttpserver.h"
-#include <QtOpenGL/QGLShaderProgram>
DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
QTest::addColumn<int>("vAlign");
QTest::addColumn<QString>("expectfile");
- QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << SRCDIR "/data/alignments_lt.png";
- QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << SRCDIR "/data/alignments_rt.png";
- QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << SRCDIR "/data/alignments_ct.png";
+ QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << TESTDATA("alignments_lt.png");
+ QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << TESTDATA("alignments_rt.png");
+ QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << TESTDATA("alignments_ct.png");
- QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_lb.png";
- QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_rb.png";
- QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_cb.png";
+ QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << TESTDATA("alignments_lb.png");
+ QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << TESTDATA("alignments_rb.png");
+ QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << TESTDATA("alignments_cb.png");
- QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_lc.png";
- QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_rc.png";
- QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_cc.png";
+ QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << TESTDATA("alignments_lc.png");
+ QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << TESTDATA("alignments_rc.png");
+ QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << TESTDATA("alignments_cc.png");
}
QApplication::setFont(fn);
#endif
- QSGView *canvas = createView(SRCDIR "/data/alignments.qml");
+ QSGView *canvas = createView(TESTDATA("alignments.qml"));
canvas->show();
canvas->requestActivateWindow();
void tst_qsgtext::horizontalAlignment_RightToLeft()
{
- QSGView *canvas = createView(SRCDIR "/data/horizontalAlignment_RightToLeft.qml");
+ QSGView *canvas = createView(TESTDATA("horizontalAlignment_RightToLeft.qml"));
QSGText *text = canvas->rootObject()->findChild<QSGText*>("text");
QVERIFY(text != 0);
canvas->show();
{
QTest::addColumn<QUrl>("qmlfile");
QTest::addColumn<QString>("error");
- QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocal.qml") << "";
- QTest::newRow("local-error") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocalError.qml")
- << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocalError.qml").toString()+":3:1: QML Text: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/http/notexists.png").toString();
- QTest::newRow("remote") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemote.qml") << "";
- QTest::newRow("remote-error") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemoteError.qml")
- << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error downloading http://127.0.0.1:14453/notexists.png - server replied: Not found";
+ QTest::newRow("local") << QUrl::fromLocalFile(TESTDATA("embeddedImagesLocal.qml")) << "";
+ QTest::newRow("local-error") << QUrl::fromLocalFile(TESTDATA("embeddedImagesLocalError.qml"))
+ << QUrl::fromLocalFile(TESTDATA("embeddedImagesLocalError.qml")).toString()+":3:1: QML Text: Cannot open: " + QUrl::fromLocalFile(TESTDATA("http/notexists.png")).toString();
+ QTest::newRow("remote") << QUrl::fromLocalFile(TESTDATA("embeddedImagesRemote.qml")) << "";
+ QTest::newRow("remote-error") << QUrl::fromLocalFile(TESTDATA("embeddedImagesRemoteError.qml"))
+ << QUrl::fromLocalFile(TESTDATA("embeddedImagesRemoteError.qml")).toString()+":3:1: QML Text: Error downloading http://127.0.0.1:14453/notexists.png - server replied: Not found";
}
void tst_qsgtext::embeddedImages()
QFETCH(QString, error);
TestHTTPServer server(14453);
- server.serveDirectory(SRCDIR "/data/http");
+ server.serveDirectory(TESTDATA("http"));
if (!error.isEmpty())
QTest::ignoreMessage(QtWarningMsg, error.toLatin1());
QTRY_COMPARE(textObject->resourcesLoading(), 0);
- QPixmap pm(SRCDIR "/data/http/exists.png");
+ QPixmap pm(TESTDATA("http/exists.png"));
if (error.isEmpty()) {
QCOMPARE(textObject->width(), double(pm.width()));
QCOMPARE(textObject->height(), double(pm.height()));
void tst_qsgtext::lineCount()
{
- QSGView *canvas = createView(SRCDIR "/data/lineCount.qml");
+ QSGView *canvas = createView(TESTDATA("lineCount.qml"));
QSGText *myText = canvas->rootObject()->findChild<QSGText*>("myText");
QVERIFY(myText != 0);
void tst_qsgtext::lineHeight()
{
- QSGView *canvas = createView(SRCDIR "/data/lineHeight.qml");
+ QSGView *canvas = createView(TESTDATA("lineHeight.qml"));
QSGText *myText = canvas->rootObject()->findChild<QSGText*>("myText");
QVERIFY(myText != 0);
void tst_qsgtext::lineLaidOut()
{
- QSGView *canvas = createView(SRCDIR "/data/lineLayout.qml");
+ QSGView *canvas = createView(TESTDATA("lineLayout.qml"));
QSGText *myText = canvas->rootObject()->findChild<QSGText*>("myText");
QVERIFY(myText != 0);
SOURCES += tst_qsgtextedit.cpp ../shared/testhttpserver.cpp
HEADERS += ../shared/testhttpserver.h
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
QT += core-private gui-private v8-private declarative-private opengl-private network widgets-private testlib
#include <QClipboard>
#include <QMimeData>
#include <private/qtextcontrol_p.h>
-#include <QtOpenGL/QGLShaderProgram>
+#include "../shared/util.h"
#ifdef Q_WS_MAC
#include <Carbon/Carbon.h>
QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual)
{
// XXX This will be replaced by some clever persistent platform image store.
- QString persistent_dir = SRCDIR "/data";
+ QString persistent_dir = TESTDATA("");
QString arch = "unknown-architecture"; // QTest needs to help with this.
QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png";
QFETCH(int, vAlign);
QFETCH(QString, expectfile);
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/alignments.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("alignments.qml")));
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextedit::hAlign_RightToLeft()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment_RightToLeft.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("horizontalAlignment_RightToLeft.qml")));
QSGTextEdit *textEdit = canvas.rootObject()->findChild<QSGTextEdit*>("text");
QVERIFY(textEdit != 0);
canvas.show();
void tst_qsgtextedit::keySelection()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("navigation.qml")));
canvas.show();
canvas.requestActivateWindow();
QTest::qWaitForWindowShown(&canvas);
QTest::addColumn<QString>("selectedText");
// import installed
- QTest::newRow("on") << SRCDIR "/data/mouseselection_true.qml" << 4 << 9 << "45678";
- QTest::newRow("off") << SRCDIR "/data/mouseselection_false.qml" << 4 << 9 << QString();
- QTest::newRow("default") << SRCDIR "/data/mouseselection_default.qml" << 4 << 9 << QString();
- QTest::newRow("off word selection") << SRCDIR "/data/mouseselection_false_words.qml" << 4 << 9 << QString();
- QTest::newRow("on word selection (4,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 4 << 9 << "0123456789";
- QTest::newRow("on word selection (2,13)") << SRCDIR "/data/mouseselection_true_words.qml" << 2 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- QTest::newRow("on word selection (2,30)") << SRCDIR "/data/mouseselection_true_words.qml" << 2 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- QTest::newRow("on word selection (9,13)") << SRCDIR "/data/mouseselection_true_words.qml" << 9 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- QTest::newRow("on word selection (9,30)") << SRCDIR "/data/mouseselection_true_words.qml" << 9 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- QTest::newRow("on word selection (13,2)") << SRCDIR "/data/mouseselection_true_words.qml" << 13 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- QTest::newRow("on word selection (20,2)") << SRCDIR "/data/mouseselection_true_words.qml" << 20 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- QTest::newRow("on word selection (12,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 12 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- QTest::newRow("on word selection (30,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 30 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ QTest::newRow("on") << TESTDATA("mouseselection_true.qml") << 4 << 9 << "45678";
+ QTest::newRow("off") << TESTDATA("mouseselection_false.qml") << 4 << 9 << QString();
+ QTest::newRow("default") << TESTDATA("mouseselection_default.qml") << 4 << 9 << QString();
+ QTest::newRow("off word selection") << TESTDATA("mouseselection_false_words.qml") << 4 << 9 << QString();
+ QTest::newRow("on word selection (4,9)") << TESTDATA("mouseselection_true_words.qml") << 4 << 9 << "0123456789";
+ QTest::newRow("on word selection (2,13)") << TESTDATA("mouseselection_true_words.qml") << 2 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ QTest::newRow("on word selection (2,30)") << TESTDATA("mouseselection_true_words.qml") << 2 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ QTest::newRow("on word selection (9,13)") << TESTDATA("mouseselection_true_words.qml") << 9 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ QTest::newRow("on word selection (9,30)") << TESTDATA("mouseselection_true_words.qml") << 9 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ QTest::newRow("on word selection (13,2)") << TESTDATA("mouseselection_true_words.qml") << 13 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ QTest::newRow("on word selection (20,2)") << TESTDATA("mouseselection_true_words.qml") << 20 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ QTest::newRow("on word selection (12,9)") << TESTDATA("mouseselection_true_words.qml") << 12 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ QTest::newRow("on word selection (30,9)") << TESTDATA("mouseselection_true_words.qml") << 30 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
void tst_qsgtextedit::mouseSelection()
void tst_qsgtextedit::dragMouseSelection()
{
- QString qmlfile = SRCDIR "/data/mouseselection_true.qml";
+ QString qmlfile = TESTDATA("mouseselection_true.qml");
QSGView canvas(QUrl::fromLocalFile(qmlfile));
QTest::addColumn<bool>("selectWords");
// import installed
- QTest::newRow("SelectWords") << SRCDIR "/data/mouseselectionmode_words.qml" << true;
- QTest::newRow("SelectCharacters") << SRCDIR "/data/mouseselectionmode_characters.qml" << false;
- QTest::newRow("default") << SRCDIR "/data/mouseselectionmode_default.qml" << false;
+ QTest::newRow("SelectWords") << TESTDATA("mouseselectionmode_words.qml") << true;
+ QTest::newRow("SelectCharacters") << TESTDATA("mouseselectionmode_characters.qml") << false;
+ QTest::newRow("default") << TESTDATA("mouseselectionmode_default.qml") << false;
}
void tst_qsgtextedit::mouseSelectionMode()
void tst_qsgtextedit::inputMethodHints()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/inputmethodhints.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("inputmethodhints.qml")));
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextedit::positionAt()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/positionAt.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("positionAt.qml")));
QVERIFY(canvas.rootObject() != 0);
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextedit::cursorDelegate()
{
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorTest.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("cursorTest.qml")));
view.show();
view.requestActivateWindow();
QSGTextEdit *textEditObject = view.rootObject()->findChild<QSGTextEdit*>("textEditObject");
void tst_qsgtextedit::cursorVisible()
{
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorVisible.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("cursorVisible.qml")));
view.show();
view.requestActivateWindow();
QTest::qWaitForWindowShown(&view);
QFETCH(QString, error);
TestHTTPServer server(42332);
- server.serveDirectory(SRCDIR "/data/httpfail", TestHTTPServer::Disconnect);
- server.serveDirectory(SRCDIR "/data/httpslow", TestHTTPServer::Delay);
- server.serveDirectory(SRCDIR "/data/http");
+ server.serveDirectory(TESTDATA("httpfail"), TestHTTPServer::Disconnect);
+ server.serveDirectory(TESTDATA("httpslow"), TestHTTPServer::Delay);
+ server.serveDirectory(TESTDATA("http"));
QSGView view(QUrl(QLatin1String("http://localhost:42332/") + qmlfile));
view.show();
*/
void tst_qsgtextedit::navigation()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("navigation.qml")));
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextedit::readOnly()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/readOnly.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("readOnly.qml")));
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextedit::textInput()
{
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputMethodEvent.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("inputMethodEvent.qml")));
view.show();
view.requestActivateWindow();
QTest::qWaitForWindowShown(&view);
void tst_qsgtextedit::openInputPanel()
{
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/openInputPanel.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("openInputPanel.qml")));
view.show();
view.requestActivateWindow();
QTest::qWaitForWindowShown(&view);
void tst_qsgtextedit::geometrySignals()
{
- QDeclarativeComponent component(&engine, SRCDIR "/data/geometrySignals.qml");
+ QDeclarativeComponent component(&engine, TESTDATA("geometrySignals.qml"));
QObject *o = component.create();
QVERIFY(o);
QCOMPARE(o->property("bindingWidth").toInt(), 400);
#else
QString preeditText = "super";
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputMethodEvent.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("inputMethodEvent.qml")));
view.show();
view.requestActivateWindow();
QTest::qWaitForWindowShown(&view);
#else
QString text = "supercalifragisiticexpialidocious!";
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputContext.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("inputContext.qml")));
MyInputContext ic;
// QSGCanvas won't set the Qt::WA_InputMethodEnabled flag unless a suitable item has focus
// and QWidget won't allow an input context to be set when the flag is not set.
{
QString text = "supercalifragisiticexpialidocious!";
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputContext.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("inputContext.qml")));
view.show();
view.requestActivateWindow();
QTest::qWaitForWindowShown(&view);
void tst_qsgtextedit::cursorRectangleSize()
{
- QSGView *canvas = new QSGView(QUrl::fromLocalFile(SRCDIR "/data/CursorRect.qml"));
+ QSGView *canvas = new QSGView(QUrl::fromLocalFile(TESTDATA("CursorRect.qml")));
QVERIFY(canvas->rootObject() != 0);
canvas->show();
canvas->requestActivateWindow();
SOURCES += tst_qsgtextinput.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
QT += core-private gui-private v8-private declarative-private opengl-private testlib
****************************************************************************/
#include <qtest.h>
#include <QtTest/QSignalSpy>
+#include "../shared/util.h"
#include "../../../shared/util.h"
#include <QtDeclarative/qdeclarativeengine.h>
#include <QFile>
QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual)
{
// XXX This will be replaced by some clever persistent platform image store.
- QString persistent_dir = SRCDIR "/data";
+ QString persistent_dir = TESTDATA("");
QString arch = "unknown-architecture"; // QTest needs to help with this.
QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png";
void tst_qsgtextinput::dragMouseSelection()
{
- QString qmlfile = SRCDIR "/data/mouseselection_true.qml";
+ QString qmlfile = TESTDATA("mouseselection_true.qml");
QSGView canvas(QUrl::fromLocalFile(qmlfile));
QTest::addColumn<bool>("selectWords");
// import installed
- QTest::newRow("SelectWords") << SRCDIR "/data/mouseselectionmode_words.qml" << true;
- QTest::newRow("SelectCharacters") << SRCDIR "/data/mouseselectionmode_characters.qml" << false;
- QTest::newRow("default") << SRCDIR "/data/mouseselectionmode_default.qml" << false;
+ QTest::newRow("SelectWords") << TESTDATA("mouseselectionmode_words.qml") << true;
+ QTest::newRow("SelectCharacters") << TESTDATA("mouseselectionmode_characters.qml") << false;
+ QTest::newRow("default") << TESTDATA("mouseselectionmode_default.qml") << false;
}
void tst_qsgtextinput::mouseSelectionMode()
QFETCH(int, hAlign);
QFETCH(QString, expectfile);
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("horizontalAlignment.qml")));
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextinput::horizontalAlignment_RightToLeft()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment_RightToLeft.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("horizontalAlignment_RightToLeft.qml")));
QSGTextInput *textInput = canvas.rootObject()->findChild<QSGTextInput*>("text");
QVERIFY(textInput != 0);
canvas.show();
void tst_qsgtextinput::positionAt()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/positionAt.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("positionAt.qml")));
QVERIFY(canvas.rootObject() != 0);
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextinput::maxLength()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/maxLength.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("maxLength.qml")));
QVERIFY(canvas.rootObject() != 0);
canvas.show();
canvas.requestActivateWindow();
{
//Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit)
//QString componentStr = "import QtQuick 2.0\nTextInput { inputMask: 'HHHHhhhh'; }";
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/masks.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("masks.qml")));
canvas.show();
canvas.requestActivateWindow();
QVERIFY(canvas.rootObject() != 0);
// so you may need to run their tests first. All validators are checked
// here to ensure that their exposure to QML is working.
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/validators.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("validators.qml")));
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextinput::inputMethods()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/inputmethods.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("inputmethods.qml")));
canvas.show();
canvas.requestActivateWindow();
QTest::qWaitForWindowShown(&canvas);
*/
void tst_qsgtextinput::navigation()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("navigation.qml")));
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextinput::navigation_RTL()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("navigation.qml")));
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextinput::cursorDelegate()
{
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorTest.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("cursorTest.qml")));
view.show();
view.requestActivateWindow();
QSGTextInput *textInputObject = view.rootObject()->findChild<QSGTextInput*>("textInputObject");
void tst_qsgtextinput::cursorVisible()
{
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorVisible.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("cursorVisible.qml")));
view.show();
view.requestActivateWindow();
QTest::qWaitForWindowShown(&view);
void tst_qsgtextinput::readOnly()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/readOnly.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("readOnly.qml")));
canvas.show();
canvas.requestActivateWindow();
void tst_qsgtextinput::echoMode()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/echoMode.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("echoMode.qml")));
canvas.show();
canvas.requestActivateWindow();
QTest::qWaitForWindowShown(&canvas);
#ifdef QT_GUI_PASSWORD_ECHO_DELAY
void tst_qdeclarativetextinput::passwordEchoDelay()
{
- QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/echoMode.qml"));
+ QSGView canvas(QUrl::fromLocalFile(TESTDATA("echoMode.qml")));
canvas.show();
canvas.setFocus();
QGuiApplication::setActiveWindow(&canvas);
void tst_qsgtextinput::openInputPanel()
{
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/openInputPanel.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("openInputPanel.qml")));
view.show();
view.requestActivateWindow();
QTest::qWaitForWindowShown(&view);
void tst_qsgtextinput::geometrySignals()
{
- QDeclarativeComponent component(&engine, SRCDIR "/data/geometrySignals.qml");
+ QDeclarativeComponent component(&engine, TESTDATA("geometrySignals.qml"));
QObject *o = component.create();
QVERIFY(o);
QCOMPARE(o->property("bindingWidth").toInt(), 400);
#else
QString preeditText = "califragisiticexpialidocious!";
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/preeditAutoScroll.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("preeditAutoScroll.qml")));
MyInputContext ic;
// QSGCanvas won't set the Qt::WA_InputMethodEnabled flag unless a suitable item has active focus
// and QWidget won't allow an input context to be set when the flag is not set.
#else
QString preeditText = "super";
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputMethodEvent.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("inputMethodEvent.qml")));
MyInputContext ic;
// QSGCanvas won't set the Qt::WA_InputMethodEnabled flag unless a suitable item has active focus
// and QWidget won't allow an input context to be set when the flag is not set.
#else
QString text = "supercalifragisiticexpialidocious!";
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputContext.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("inputContext.qml")));
MyInputContext ic;
// QSGCanvas won't set the Qt::WA_InputMethodEnabled flag unless a suitable item has active focus
// and QWidget won't allow an input context to be set when the flag is not set.
{
QString text = "supercalifragisiticexpialidocious!";
- QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputContext.qml"));
+ QSGView view(QUrl::fromLocalFile(TESTDATA("inputContext.qml")));
view.show();
view.requestActivateWindow();
QTest::qWaitForWindowShown(&view);
void tst_qsgtextinput::cursorRectangleSize()
{
- QSGView *canvas = new QSGView(QUrl::fromLocalFile(SRCDIR "/data/positionAt.qml"));
+ QSGView *canvas = new QSGView(QUrl::fromLocalFile(TESTDATA("positionAt.qml")));
QVERIFY(canvas->rootObject() != 0);
canvas->show();
canvas->requestActivateWindow();
void tst_qsgtextinput::tripleClickSelectsAll()
{
- QString qmlfile = SRCDIR "/data/positionAt.qml";
+ QString qmlfile = TESTDATA("positionAt.qml");
QSGView view(QUrl::fromLocalFile(qmlfile));
view.show();
view.requestActivateWindow();
SOURCES += tst_qsgview.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
QT += core-private gui-private declarative-private testlib
#include <QtDeclarative/qdeclarativecontext.h>
#include <QtDeclarative/qsgview.h>
#include <QtDeclarative/qsgitem.h>
+#include "../shared/util.h"
#include "../../../shared/util.h"
#include <QtGui/QWindow>
#include <QtCore/QDebug>
QVERIFY(canvas);
canvas->setResizeMode(QSGView::SizeRootObjectToView);
QCOMPARE(QSize(0,0), canvas->initialSize());
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodeitem.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("resizemodeitem.qml")));
QSGItem* item = qobject_cast<QSGItem*>(canvas->rootObject());
QVERIFY(item);
window.show();
QCOMPARE(canvas->size(), canvas->sizeHint());
QCOMPARE(canvas->size(), canvas->initialSize());
- qDebug() << window.size();
- qDebug() << "canvas size:" << canvas->size();
// size update from view
canvas->resize(QSize(80,100));
QTest::qWait(50);
- qDebug() << window.size();
- qDebug() << "canvas size:" << canvas->size();
QCOMPARE(item->width(), 80.0);
QCOMPARE(item->height(), 100.0);
canvas = new QSGView(&window);
QVERIFY(canvas);
canvas->setResizeMode(QSGView::SizeViewToRootObject);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodeitem.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("resizemodeitem.qml")));
item = qobject_cast<QSGItem*>(canvas->rootObject());
QVERIFY(item);
window.show();
canvas->resize(300, 300);
canvas->setResizeMode(QSGView::SizeRootObjectToView);
QCOMPARE(QSize(0,0), canvas->initialSize());
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodeitem.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("resizemodeitem.qml")));
canvas->resize(300, 300);
item = qobject_cast<QSGItem*>(canvas->rootObject());
QVERIFY(item);
QSGView *canvas = new QSGView;
QVERIFY(canvas);
QtMsgHandler old = qInstallMsgHandler(silentErrorsMsgHandler);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/error1.qml"));
+ canvas->setSource(QUrl::fromLocalFile(TESTDATA("error1.qml")));
qInstallMsgHandler(old);
QVERIFY(canvas->status() == QSGView::Error);
QVERIFY(canvas->errors().count() == 1);
SOURCES += tst_qsgvisualdatamodel.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test
** $QT_END_LICENSE$
**
****************************************************************************/
+#include "../shared/util.h"
#include "../../../shared/util.h"
#include <qtest.h>
#include <QtTest/QSignalSpy>
#include <private/qdeclarativechangeset_p.h>
#include <private/qdeclarativeengine_p.h>
#include <math.h>
-#include <QtOpenGL/QGLShaderProgram>
template <typename T, int N> int lengthOf(const T (&)[N]) { return N; }
void tst_qsgvisualdatamodel::rootIndex()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/visualdatamodel.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("visualdatamodel.qml")));
QStandardItemModel model;
initStandardTreeModel(&model);
view.rootContext()->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("datalist.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
view.rootContext()->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("datalist.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/objectlist.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("objectlist.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/singlerole1.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("singlerole1.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/singlerole2.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("singlerole2.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/singlerole2.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("singlerole2.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/modelproperties.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("modelproperties.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/modelproperties.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("modelproperties.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
view.rootContext()->setContextProperty("myModel", &model);
- QUrl source(QUrl::fromLocalFile(SRCDIR "/data/modelproperties2.qml"));
+ QUrl source(QUrl::fromLocalFile(TESTDATA("modelproperties2.qml")));
//3 items, 3 warnings each
QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: Can't find variable: modelData");
view.rootContext()->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("datalist.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QFETCH(int, expectCount);
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/visualdatamodel.qml"));
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("visualdatamodel.qml")));
SingleRoleModel model;
model.list.clear();
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/groups.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("groups.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/groups.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("groups.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/groups.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("groups.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/groups.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("groups.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", &model);
- view.setSource(QUrl::fromLocalFile(SRCDIR "/data/create.qml"));
+ view.setSource(QUrl::fromLocalFile(TESTDATA("create.qml")));
QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject());
QVERIFY(listview != 0);
#define QDECLARATIVETESTUTILS_H
#include <QtCore/qdir.h>
+#include <QtCore/qcoreapplication.h>
namespace QDeclarativeTestUtils
{
#include <private/qv4compiler_p.h>
+#include "../shared/util.h"
#include "testtypes.h"
inline QUrl TEST_FILE(const QString &filename)
{
- QFileInfo fileInfo(__FILE__);
- return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename));
+ return QUrl::fromLocalFile(TESTDATA(filename));
}
inline QUrl TEST_FILE(const char *filename)
testtypes.cpp
HEADERS += testtypes.h
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
CONFIG += parallel_test