aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-05-18 21:11:51 +1000
committerAlan Alpert <alan.alpert@nokia.com>2011-05-18 21:11:51 +1000
commit1edb32e75df1b52411907d0c35130dfb48018b83 (patch)
tree5e2617b1eb21e5ef9e0058128903b0c2ebb3d802
parentb8338a188160651fec238edb4d7fd59417eefe6d (diff)
parent57d9b5d3ca685ceacc0537dc9d3afdfaa243a768 (diff)
Merge branch 'qtquick2' of scm.dev.nokia.troll.no:qt/qtdeclarative-staging into qtquick2
-rw-r--r--examples/declarative/canvas/motionchart/motionchart.qml140
-rw-r--r--src/declarative/items/qsgshadereffectsource.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp3
-rw-r--r--tests/auto/declarative/declarative.pro2
-rw-r--r--tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp40
-rw-r--r--tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp10
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp5
-rw-r--r--tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp5
-rw-r--r--tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp14
-rw-r--r--tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp6
-rw-r--r--tests/auto/declarative/qsgborderimage/data/mirror.qml2
-rw-r--r--tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp22
-rw-r--r--tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp16
-rw-r--r--tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp15
-rw-r--r--tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp14
-rw-r--r--tests/auto/declarative/qsggridview/tst_qsggridview.cpp13
-rw-r--r--tests/auto/declarative/qsgimage/data/htiling.qml11
-rw-r--r--tests/auto/declarative/qsgimage/data/mirror.qml5
-rw-r--r--tests/auto/declarative/qsgimage/data/nullpixmap.qml6
-rw-r--r--tests/auto/declarative/qsgimage/data/tiling.qml16
-rw-r--r--tests/auto/declarative/qsgimage/data/vtiling.qml11
-rw-r--r--tests/auto/declarative/qsgimage/tst_qsgimage.cpp175
-rw-r--r--tests/auto/declarative/qsglistview/tst_qsglistview.cpp14
-rw-r--r--tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp15
-rw-r--r--tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp15
-rw-r--r--tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp13
-rw-r--r--tests/auto/declarative/qsgtext/tst_qsgtext.cpp15
-rw-r--r--tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp21
-rw-r--r--tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp14
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp13
33 files changed, 462 insertions, 201 deletions
diff --git a/examples/declarative/canvas/motionchart/motionchart.qml b/examples/declarative/canvas/motionchart/motionchart.qml
new file mode 100644
index 0000000000..974690e3fc
--- /dev/null
+++ b/examples/declarative/canvas/motionchart/motionchart.qml
@@ -0,0 +1,140 @@
+import QtQuick 2.0
+
+Canvas {
+ id:motionChart
+ width:1300
+ height: 700
+ property int progress:-1
+ property variant applesFrom: [1000, 300];
+ property variant applesTo:[1200, 400];
+ property variant orangesFrom: [1150, 200];
+ property variant orangesTo:[250, 550];
+ property variant bananasFrom: [300, 250];
+ property variant bananasTo:[788, 617];
+
+ property date startDate:new Date (1988,0,1)
+ property date endDate:new Date (1989,6,1)
+ property variant title:["Fruit", "Sales", "Expenses", "Location"];
+ property bool clearTrace:true
+ Text {id:appleText; text:"Apples"; font.bold:true; font.pixelSize:12; opacity:0}
+ Text {id:orangeText; text:"Oranges"; font.bold:true; font.pixelSize:12; opacity:0}
+ Text {id:bananaText; text:"Bananas"; font.bold:true; font.pixelSize:12; opacity:0}
+
+ Text {id:sales; text: "700 Sales"; x:15; y:15;font.bold:true; font.pixelSize:15; opacity:0}
+ Text {id:expenses; text: "Expenses 1300"; x:1170; y:670;font.bold:true; font.pixelSize:15; opacity:0}
+ Timer {
+ id:timer
+ interval: 1; running: true; repeat: true
+ onTriggered: {
+ if (motionChart.progress == -1) {
+ motionChart.setup();
+ running = false;
+ }
+ motionChart.draw();
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed : {
+ motionChart.progress = 0;
+ setup();
+ timer.running = true;
+ motionChart.clearTrace = true;
+ }
+ onDoubleClicked : {
+ motionChart.progress = 0;
+ setup();
+ timer.running = true;
+ motionChart.clearTrace = false;
+ }
+ }
+
+
+ function setup() {
+ var ctx = motionChart.getContext("2d");
+ ctx.globalCompositeOperation = "source-over";
+ ctx.clearRect(0, 0, motionChart.width, motionChart.height);
+
+ ctx.strokeColor = Qt.rgba(133, 133, 133,1);
+ ctx.lineWidth = 2;
+ ctx.beginPath();
+ ctx.moveTo(10,690);
+ ctx.lineTo(10, 5);
+ ctx.moveTo(10,690);
+ ctx.lineTo(1295, 690);
+
+ for ( var i = 0; i < 10; i++) {
+ ctx.moveTo(10, i*70);
+ ctx.lineTo(15, i*70);
+ ctx.moveTo(i*130, 690);
+ ctx.lineTo(i*130, 685);
+ }
+
+ ctx.stroke();
+ sales.opacity =1;
+ expenses.opacity = 1;
+ appleText.opacity = 1;
+ orangeText.opacity = 1;
+ bananaText.opacity = 1;
+ }
+
+ function draw() {
+ var totalDays = Math.ceil((endDate.getTime()-startDate.getTime())/(1000*60*60*24));
+ if (motionChart.progress >= totalDays) {
+ timer.running = false;
+ return;
+ }
+ var apples = [];
+ apples[0] = applesFrom[0] + ((applesTo[0] - applesFrom[0]) * (motionChart.progress/totalDays));
+ apples[1] = applesFrom[1] + ((applesTo[1] - applesFrom[1]) * (motionChart.progress/totalDays));
+
+ var oranges = [];
+ oranges[0] = orangesFrom[0] + ((orangesTo[0] - orangesFrom[0]) * (motionChart.progress/totalDays));
+ oranges[1] = orangesFrom[1] + ((orangesTo[1] - orangesFrom[1]) * (motionChart.progress/totalDays));
+
+ var bananas = [];
+ bananas[0] = bananasFrom[0] + ((bananasTo[0] - bananasFrom[0]) * (motionChart.progress/totalDays));
+ bananas[1] = bananasFrom[1] + ((bananasTo[1] - bananasFrom[1]) * (motionChart.progress/totalDays));
+
+ var ctx = motionChart.getContext("2d");
+ ctx.globalCompositeOperation = "source-over";
+
+ if (motionChart.clearTrace)
+ ctx.clearRect(15, 15, motionChart.width - 15, motionChart.height - 30);
+
+
+ //apples
+ ctx.fillColor = Qt.rgba(0,255,0,1);
+
+ ctx.beginPath();
+ ctx.arc( apples[0] , 700 - apples[1] , 20 , 0 , Math.PI * 2 , true );
+ //ctx.closePath();
+ ctx.fill();
+ ctx.fillRect(apples[0], 700 - apples[1], 28, 28);
+ appleText.x = apples[0];
+ appleText.y = 700 - apples[1] - 30;
+ //oranges
+ ctx.fillColor = Qt.rgba(0,0,255,1);
+ ctx.beginPath();
+ ctx.arc( oranges[0], 700 - oranges[1] , 20 , 0 , Math.PI * 2 , true );
+ ctx.closePath();
+ ctx.fill();
+ ctx.fillRect(oranges[0], 700 - oranges[1], 28, 28);
+ orangeText.x = oranges[0];
+ orangeText.y = 700 - oranges[1] - 30;
+
+ //bananas
+ ctx.fillColor = Qt.rgba(255,0,0,1);
+ ctx.beginPath();
+ ctx.arc( bananas[0] , 700 - bananas[1] , 20 , 0 , Math.PI * 2 , true );
+ ctx.closePath();
+ ctx.fill();
+ ctx.fillRect(bananas[0], 700 - bananas[1], 28, 28);
+ bananaText.x = bananas[0];
+ bananaText.y = 700 - bananas[1] - 30;
+
+ ctx.sync();
+ motionChart.progress ++;
+ }
+}
diff --git a/src/declarative/items/qsgshadereffectsource.cpp b/src/declarative/items/qsgshadereffectsource.cpp
index 5b6f305f17..199a56067e 100644
--- a/src/declarative/items/qsgshadereffectsource.cpp
+++ b/src/declarative/items/qsgshadereffectsource.cpp
@@ -774,12 +774,12 @@ QSGNode *QSGShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNod
tex->setLive(m_live);
tex->setItem(QSGItemPrivate::get(m_sourceItem)->itemNode());
- QRectF sourceRect = m_sourceRect.isNull()
+ QRectF sourceRect = m_sourceRect.isEmpty()
? QRectF(0, 0, m_sourceItem->width(), m_sourceItem->height())
: m_sourceRect;
tex->setRect(sourceRect);
QSize textureSize = m_textureSize.isEmpty()
- ? QSize(qCeil(qAbs(sourceRect.width())), qCeil(qAbs(sourceRect.height())))
+ ? QSize(qCeil(sourceRect.width()), qCeil(sourceRect.height()))
: m_textureSize;
tex->setSize(textureSize);
tex->setRecursive(m_recursive);
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index eb2974f46a..001884161b 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1740,6 +1740,9 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine
qsreal w = ctxt->argument(2).toNumber();
qsreal h = ctxt->argument(3).toNumber();
+ if (w < 0 || h < 0)
+ return engine->nullValue();
+
return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(QVariant::fromValue(QRectF(x, y, w, h)));
}
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 774e9216a7..8273fa1181 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -76,12 +76,14 @@ contains(QT_CONFIG, private_tests) {
qdeclarativexmllistmodel \
qpacketprotocol \
qdeclarativev4 \
+ qsganimatedimage \
qsgborderimage \
qsgcanvas \
qsgflickable \
qsgflipable \
qsgfocusscope \
qsggridview \
+ qsgimage \
qsgitem \
qsglistview \
qsgloader \
diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
index e63b14ef61..dba2007e94 100644
--- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
+++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
@@ -80,7 +80,7 @@ private:
void recursiveCompareObjects(const QDeclarativeDebugObjectReference &a, const QDeclarativeDebugObjectReference &b) const;
void recursiveCompareContexts(const QDeclarativeDebugContextReference &a, const QDeclarativeDebugContextReference &b) const;
void compareProperties(const QDeclarativeDebugPropertyReference &a, const QDeclarativeDebugPropertyReference &b) const;
-
+
QDeclarativeDebugConnection *m_conn;
QDeclarativeEngineDebug *m_dbg;
QDeclarativeEngine *m_engine;
@@ -134,7 +134,7 @@ QDeclarativeDebugObjectReference tst_QDeclarativeDebug::findRootObject(int conte
{
QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
-
+
if (q_engines->engines().count() == 0)
return QDeclarativeDebugObjectReference();
QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this);
@@ -368,7 +368,7 @@ void tst_QDeclarativeDebug::initTestCase()
for (int i=0; i<qml.count(); i++) {
QDeclarativeComponent component(m_engine);
component.setData(qml[i], QUrl::fromLocalFile(""));
- Q_ASSERT(component.isReady()); // fails if bad syntax
+ QVERIFY(component.isReady()); // fails if bad syntax
m_components << qobject_cast<QDeclarativeItem*>(component.create());
}
m_rootItem = qobject_cast<QDeclarativeItem*>(m_components.first());
@@ -382,7 +382,7 @@ void tst_QDeclarativeDebug::initTestCase()
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established");
bool ok = m_conn->waitForConnected();
- Q_ASSERT(ok);
+ QVERIFY(ok);
QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
m_dbg = new QDeclarativeEngineDebug(m_conn, this);
QTRY_VERIFY(m_dbg->status() == QDeclarativeEngineDebug::Enabled);
@@ -439,7 +439,7 @@ void tst_QDeclarativeDebug::watch_property()
QDeclarativeDebugPropertyReference prop = findProperty(obj.properties(), "width");
QDeclarativeDebugPropertyWatch *watch;
-
+
QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0);
watch = unconnected->addWatch(prop, this);
QCOMPARE(watch->state(), QDeclarativeDebugWatch::Dead);
@@ -450,7 +450,7 @@ void tst_QDeclarativeDebug::watch_property()
QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State))));
QCOMPARE(watch->state(), QDeclarativeDebugWatch::Inactive);
delete watch;
-
+
watch = m_dbg->addWatch(prop, this);
QCOMPARE(watch->state(), QDeclarativeDebugWatch::Waiting);
QCOMPARE(watch->objectDebugId(), obj.debugId());
@@ -482,12 +482,12 @@ void tst_QDeclarativeDebug::watch_object()
{
QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
-
- Q_ASSERT(q_engines->engines().count() > 0);
+
+ QVERIFY(q_engines->engines().count() > 0);
QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this);
waitForQuery(q_context);
- Q_ASSERT(q_context->rootContext().objects().count() > 0);
+ QVERIFY(q_context->rootContext().objects().count() > 0);
QDeclarativeDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().objects()[0], this);
waitForQuery(q_obj);
@@ -504,7 +504,7 @@ void tst_QDeclarativeDebug::watch_object()
QCOMPARE(watch->state(), QDeclarativeDebugWatch::Dead);
delete watch;
delete unconnected;
-
+
watch = m_dbg->addWatch(QDeclarativeDebugObjectReference(), this);
QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State))));
QCOMPARE(watch->state(), QDeclarativeDebugWatch::Inactive);
@@ -558,7 +558,7 @@ void tst_QDeclarativeDebug::watch_expression()
QFETCH(int, incrementCount);
int origWidth = m_rootItem->property("width").toInt();
-
+
QDeclarativeDebugObjectReference obj = findRootObject();
QDeclarativeDebugObjectExpressionWatch *watch;
@@ -568,12 +568,12 @@ void tst_QDeclarativeDebug::watch_expression()
QCOMPARE(watch->state(), QDeclarativeDebugWatch::Dead);
delete watch;
delete unconnected;
-
+
watch = m_dbg->addWatch(QDeclarativeDebugObjectReference(), expr, this);
QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State))));
QCOMPARE(watch->state(), QDeclarativeDebugWatch::Inactive);
delete watch;
-
+
watch = m_dbg->addWatch(obj, expr, this);
QCOMPARE(watch->state(), QDeclarativeDebugWatch::Waiting);
QCOMPARE(watch->objectDebugId(), obj.debugId());
@@ -603,7 +603,7 @@ void tst_QDeclarativeDebug::watch_expression()
delete watch;
// restore original value and verify spy doesn't get a signal since watch has been removed
- m_rootItem->setProperty("width", origWidth);
+ m_rootItem->setProperty("width", origWidth);
QTest::qWait(100);
QCOMPARE(spy.count(), expectedSpyCount);
@@ -681,7 +681,7 @@ void tst_QDeclarativeDebug::queryRootContexts()
delete q_engines;
QDeclarativeDebugRootContextQuery *q_context;
-
+
QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0);
q_context = unconnected->queryRootContexts(engineId, this);
QCOMPARE(q_context->state(), QDeclarativeDebugQuery::Error);
@@ -725,7 +725,7 @@ void tst_QDeclarativeDebug::queryObject()
QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
-
+
QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this);
waitForQuery(q_context);
QDeclarativeDebugObjectReference rootObject = q_context->rootContext().objects()[0];
@@ -806,7 +806,7 @@ void tst_QDeclarativeDebug::queryExpressionResult()
QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines); // check immediate deletion is ok
-
+
QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this);
waitForQuery(q_context);
int objectId = q_context->rootContext().objects()[0].debugId();
@@ -818,7 +818,7 @@ void tst_QDeclarativeDebug::queryExpressionResult()
QCOMPARE(q_expr->state(), QDeclarativeDebugQuery::Error);
delete q_expr;
delete unconnected;
-
+
q_expr = m_dbg->queryExpressionResult(objectId, expr, this);
delete q_expr;
@@ -964,7 +964,7 @@ void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference()
QDeclarativeDebugObjectQuery *query = m_dbg->queryObject(rootObject, this);
waitForQuery(query);
QDeclarativeDebugObjectReference obj = query->object();
- delete query;
+ delete query;
QDeclarativeDebugPropertyReference ref = findProperty(obj.properties(), "scale");
QVERIFY(ref.objectDebugId() > 0);
@@ -973,7 +973,7 @@ void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference()
QVERIFY(!ref.valueTypeName().isEmpty());
QVERIFY(!ref.binding().isEmpty());
QVERIFY(ref.hasNotifySignal());
-
+
QDeclarativeDebugPropertyReference copy(ref);
QDeclarativeDebugPropertyReference copyAssign;
copyAssign = ref;
diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
index c182893fb7..59214d1342 100644
--- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
+++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
@@ -88,7 +88,7 @@ void tst_QDeclarativeDebugClient::initTestCase()
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established");
bool ok = m_conn->waitForConnected();
- Q_ASSERT(ok);
+ QVERIFY(ok);
QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled);
diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
index 0911a8354d..a61f4a8ea7 100644
--- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
+++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
@@ -87,7 +87,7 @@ void tst_QDeclarativeDebugService::initTestCase()
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established");
bool ok = m_conn->waitForConnected();
- Q_ASSERT(ok);
+ QVERIFY(ok);
QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index d9cd8250f7..a408000a37 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -2272,16 +2272,12 @@ public:
~CppOwnershipReturnValue() { delete value; }
Q_INVOKABLE QObject *create() {
- Q_ASSERT(value == 0);
-
value = new QObject;
QDeclarativeEngine::setObjectOwnership(value, QDeclarativeEngine::CppOwnership);
return value;
}
Q_INVOKABLE MyQmlObject *createQmlObject() {
- Q_ASSERT(value == 0);
-
MyQmlObject *rv = new MyQmlObject;
value = rv;
return rv;
diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp
index e684bbeeb0..2f0992c1eb 100644
--- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp
+++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp
@@ -55,13 +55,13 @@
#endif
class tst_qdeclarativefontloader : public QObject
-
{
Q_OBJECT
public:
tst_qdeclarativefontloader();
private slots:
+ void init();
void noFont();
void namedFont();
void localFont();
@@ -71,8 +71,6 @@ private slots:
void failWebFont();
void changeFont();
-private slots:
-
private:
QDeclarativeEngine engine;
TestHTTPServer server;
@@ -82,7 +80,11 @@ tst_qdeclarativefontloader::tst_qdeclarativefontloader() :
server(SERVER_PORT)
{
server.serveDirectory(SRCDIR "/data");
- Q_ASSERT(server.isValid());
+}
+
+void tst_qdeclarativefontloader::init()
+{
+ QVERIFY(server.isValid());
}
void tst_qdeclarativefontloader::noFont()
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index cf053e5fb0..fa5dcc44c0 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -115,7 +115,6 @@ int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model,
if (model->toString(roles[i]) == roleName)
return roles[i];
}
- Q_ASSERT(false);
return -1;
}
@@ -741,6 +740,7 @@ void tst_qdeclarativelistmodel::get()
"}", QUrl());
QDeclarativeListModel *model = qobject_cast<QDeclarativeListModel*>(component.create());
int role = roleFromName(model, roleName);
+ QVERIFY(role >= 0);
QSignalSpy spy(model, SIGNAL(itemsChanged(int, int, QList<int>)));
QDeclarativeExpression expr(eng.rootContext(), model, expression);
@@ -804,6 +804,7 @@ void tst_qdeclarativelistmodel::get_worker()
model.append(sv);
model.append(sv);
int role = roleFromName(&model, roleName);
+ QVERIFY(role >= 0);
const char *warning = "<Unknown File>: QML ListModel: Cannot add list-type data when modifying or after modification from a worker script";
if (roleValue.type() == QVariant::List || roleValue.type() == QVariant::Map)
@@ -895,6 +896,7 @@ void tst_qdeclarativelistmodel::get_nested()
int outerListIndex = testData[i].first;
QString outerListRoleName = testData[i].second;
int outerListRole = roleFromName(model, outerListRoleName);
+ QVERIFY(outerListRole >= 0);
childModel = qobject_cast<QDeclarativeListModel*>(model->data(outerListIndex, outerListRole).value<QObject*>());
QVERIFY(childModel);
@@ -907,6 +909,7 @@ void tst_qdeclarativelistmodel::get_nested()
QVERIFY(!expr.hasError());
int role = roleFromName(childModel, roleName);
+ QVERIFY(role >= 0);
QCOMPARE(childModel->data(index, role), roleValue);
QCOMPARE(spy.count(), 1);
diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
index a0e254773b..c4f4058753 100644
--- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
@@ -126,7 +126,10 @@ private:
QStringList fields = item.split(",");
foreach(const QString &field, fields) {
QStringList values = field.split("=");
- Q_ASSERT(values.count() == 2);
+ if (values.count() != 2) {
+ qWarning() << "makeItemXmlAndData: invalid field:" << field;
+ continue;
+ }
xml += QString("<%1>%2</%1>").arg(values[0], values[1]);
if (!modelData)
continue;
diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
index 2dbed3b21a..61e188311b 100644
--- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
+++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
@@ -185,16 +185,22 @@ QString tst_qmlvisual::toTestScript(const QString &file, Mode mode)
if (platformsuffix && (mode == UpdatePlatformVisuals || QFile::exists(testdata+QLatin1String(platformsuffix)+QDir::separator()+testname+".qml"))) {
QString platformdir = testdata + QLatin1String(platformsuffix);
if (mode == UpdatePlatformVisuals) {
- Q_ASSERT(QDir().mkpath(platformdir));
+ if (!QDir().mkpath(platformdir)) {
+ qFatal("Cannot make path %s", qPrintable(platformdir));
+ }
// Copy from base
QDir dir(testdata,testname+".*");
dir.setFilter(QDir::Files);
QFileInfoList list = dir.entryInfoList();
for (int i = 0; i < list.size(); ++i) {
QFile in(list.at(i).filePath());
- Q_ASSERT(in.open(QIODevice::ReadOnly));
+ if (!in.open(QIODevice::ReadOnly)) {
+ qFatal("Cannot open file %s: %s", qPrintable(in.fileName()), qPrintable(in.errorString()));
+ }
QFile out(platformdir + QDir::separator() + list.at(i).fileName());
- Q_ASSERT(out.open(QIODevice::WriteOnly));
+ if (!out.open(QIODevice::WriteOnly)) {
+ qFatal("Cannot open file %s: %s", qPrintable(out.fileName()), qPrintable(out.errorString()));
+ }
out.write(in.readAll());
}
}
@@ -234,8 +240,6 @@ QStringList tst_qmlvisual::findQmlFiles(const QDir &d)
void action(Mode mode, const QString &file)
{
- Q_ASSERT(mode != Test);
-
QString testdata = tst_qmlvisual::toTestScript(file,mode);
QStringList arguments;
diff --git a/tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp b/tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp
index e8475a53ae..739e890721 100644
--- a/tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp
+++ b/tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp
@@ -209,7 +209,7 @@ void tst_qsganimatedimage::mirror_notRunning()
anim->setProperty("mirror", true);
screenshot = canvas->renderPixmap();
- QEXPECT_FAIL("", "QTBUG-19252", Abort);
+ QSKIP("Skip while QTBUG-19351 and QTBUG-19252 are not resolved", SkipSingle);
QCOMPARE(screenshot, expected);
// mirroring should not change the current frame or playing status
@@ -288,7 +288,7 @@ void tst_qsganimatedimage::invalidSource()
{
QDeclarativeEngine engine;
QDeclarativeComponent component(&engine);
- component.setData("import QtQuick 1.0\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile(""));
+ component.setData("import QtQuick 2.0\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile(""));
QVERIFY(component.isReady());
QTest::ignoreMessage(QtWarningMsg, "file::2:2: QML AnimatedImage: Error Reading Animated Image File file:no-such-file.gif");
@@ -332,7 +332,7 @@ void tst_qsganimatedimage::progressAndStatusChanges()
server.serveDirectory(SRCDIR "/data");
QDeclarativeEngine engine;
- QString componentStr = "import QtQuick 1.0\nAnimatedImage { source: srcImage }";
+ QString componentStr = "import QtQuick 2.0\nAnimatedImage { source: srcImage }";
QDeclarativeContext *ctxt = engine.rootContext();
ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/stickman.gif"));
QDeclarativeComponent component(&engine);
diff --git a/tests/auto/declarative/qsgborderimage/data/mirror.qml b/tests/auto/declarative/qsgborderimage/data/mirror.qml
index 13244d6cc4..8d02f58e05 100644
--- a/tests/auto/declarative/qsgborderimage/data/mirror.qml
+++ b/tests/auto/declarative/qsgborderimage/data/mirror.qml
@@ -1,4 +1,4 @@
-import QtQuick 1.0
+import QtQuick 2.0
BorderImage {
source: "heart200.png"
diff --git a/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp b/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp
index cdf2f62069..2bd15c1094 100644
--- a/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp
+++ b/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp
@@ -98,7 +98,7 @@ tst_qsgborderimage::tst_qsgborderimage()
void tst_qsgborderimage::noSource()
{
- QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"\" }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"\" }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
@@ -142,7 +142,7 @@ void tst_qsgborderimage::imageSource()
if (!error.isEmpty())
QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
- QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" + source + "\" }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + source + "\" }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
@@ -171,7 +171,7 @@ void tst_qsgborderimage::imageSource()
void tst_qsgborderimage::clearSource()
{
- QString componentStr = "import QtQuick 1.0\nBorderImage { source: srcImage }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: srcImage }";
QDeclarativeContext *ctxt = engine.rootContext();
ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png"));
QDeclarativeComponent component(&engine);
@@ -191,7 +191,7 @@ void tst_qsgborderimage::clearSource()
void tst_qsgborderimage::resized()
{
- QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
@@ -208,7 +208,7 @@ void tst_qsgborderimage::resized()
void tst_qsgborderimage::smooth()
{
- QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
@@ -238,7 +238,7 @@ void tst_qsgborderimage::mirror()
image->setProperty("mirror", true);
QPixmap mirrored;
- QEXPECT_FAIL("", "QTBUG-19252", Abort);
+ QSKIP("Skip while QTBUG-19351 and QTBUG-19252 are not resolved", SkipSingle);
QCOMPARE(screenshot, mirrored);
delete canvas;
@@ -247,7 +247,7 @@ void tst_qsgborderimage::mirror()
void tst_qsgborderimage::tileModes()
{
{
- QString componentStr = "import QtQuick 1.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: \"" SRCDIR "/data/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());
@@ -260,7 +260,7 @@ void tst_qsgborderimage::tileModes()
delete obj;
}
{
- QString componentStr = "import QtQuick 1.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: \"" SRCDIR "/data/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());
@@ -287,7 +287,7 @@ void tst_qsgborderimage::sciSource()
server->serveDirectory(SRCDIR "/data");
}
- QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
@@ -333,7 +333,7 @@ void tst_qsgborderimage::invalidSciFile()
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 1.0\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
@@ -351,7 +351,7 @@ void tst_qsgborderimage::pendingRemoteRequest()
{
QFETCH(QString, source);
- QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" + source + "\" }";
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + source + "\" }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create());
diff --git a/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp b/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp
index 2cc6b3eac2..1892350058 100644
--- a/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp
+++ b/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp
@@ -47,6 +47,7 @@
#include <private/qdeclarativevaluetype_p.h>
#include <math.h>
#include "../../../shared/util.h"
+#include <QtOpenGL/QGLShaderProgram>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -60,6 +61,9 @@ public:
tst_qsgflickable();
private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
void create();
void horizontalViewportSize();
void verticalViewportSize();
@@ -86,6 +90,18 @@ tst_qsgflickable::tst_qsgflickable()
{
}
+void tst_qsgflickable::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("Flickable item needs OpenGL 2.0", SkipAll);
+}
+
+void tst_qsgflickable::cleanupTestCase()
+{
+
+}
+
void tst_qsgflickable::create()
{
QDeclarativeEngine engine;
diff --git a/tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp b/tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp
index 205c2ce607..a5e8105405 100644
--- a/tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp
+++ b/tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp
@@ -47,6 +47,8 @@
#include <QFontMetrics>
#include <private/qsgrectangle_p.h>
#include <math.h>
+#include <QtOpenGL/QGLShaderProgram>
+
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -60,6 +62,8 @@ public:
tst_qsgflipable();
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void create();
void checkFrontAndBack();
void setFrontAndBack();
@@ -75,6 +79,17 @@ private:
tst_qsgflipable::tst_qsgflipable()
{
}
+void tst_qsgflipable::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("Flipable item needs OpenGL 2.0", SkipAll);
+}
+
+void tst_qsgflipable::cleanupTestCase()
+{
+
+}
void tst_qsgflipable::create()
{
diff --git a/tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp b/tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp
index c793ce91c5..98ed425b1d 100644
--- a/tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp
+++ b/tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp
@@ -47,6 +47,7 @@
#include <private/qsgtextedit_p.h>
#include <private/qsgtext_p.h>
#include <QtDeclarative/private/qsgfocusscope_p.h>
+#include <QtOpenGL/QGLShaderProgram>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -63,6 +64,8 @@ public:
T *findItem(QSGItem *parent, const QString &id);
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void basic();
void nested();
void noFocus();
@@ -73,6 +76,17 @@ private slots:
void qtBug13380();
void forceActiveFocus();
};
+void tst_qsgfocusscope::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("FocusScope item needs OpenGL 2.0", SkipAll);
+}
+
+void tst_qsgfocusscope::cleanupTestCase()
+{
+
+}
/*
Find an item with the specified id.
diff --git a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
index 931ae7ee49..73744794e3 100644
--- a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
+++ b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
@@ -52,6 +52,7 @@
#include <QtDeclarative/private/qsgtext_p.h>
#include <QtDeclarative/private/qdeclarativelistmodel_p.h>
#include "../../../shared/util.h"
+#include <QtOpenGL/QGLShaderProgram>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -65,6 +66,8 @@ public:
tst_QSGGridView();
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void items();
void changed();
void inserted();
@@ -106,7 +109,17 @@ private:
QList<T*> findItems(QSGItem *parent, const QString &objectName);
void dumpTree(QSGItem *parent, int depth = 0);
};
+void tst_QSGGridView::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("QSGGridView needs OpenGL 2.0", SkipAll);
+}
+void tst_QSGGridView::cleanupTestCase()
+{
+
+}
class TestModel : public QAbstractListModel
{
public:
diff --git a/tests/auto/declarative/qsgimage/data/htiling.qml b/tests/auto/declarative/qsgimage/data/htiling.qml
new file mode 100644
index 0000000000..f192f931c9
--- /dev/null
+++ b/tests/auto/declarative/qsgimage/data/htiling.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 550
+
+ Image {
+ objectName: "tiling"; anchors.fill: parent
+ source: "green.png"; fillMode: Image.TileHorizontally
+ }
+}
+
diff --git a/tests/auto/declarative/qsgimage/data/mirror.qml b/tests/auto/declarative/qsgimage/data/mirror.qml
new file mode 100644
index 0000000000..69bdcb9dc3
--- /dev/null
+++ b/tests/auto/declarative/qsgimage/data/mirror.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Image {
+ source: "heart200.png"
+}
diff --git a/tests/auto/declarative/qsgimage/data/nullpixmap.qml b/tests/auto/declarative/qsgimage/data/nullpixmap.qml
new file mode 100644
index 0000000000..d52f41f164
--- /dev/null
+++ b/tests/auto/declarative/qsgimage/data/nullpixmap.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Image {
+ width: 10; height:10; fillMode: Image.PreserveAspectFit
+ source: ""
+}
diff --git a/tests/auto/declarative/qsgimage/data/tiling.qml b/tests/auto/declarative/qsgimage/data/tiling.qml
deleted file mode 100644
index 986b7708a2..0000000000
--- a/tests/auto/declarative/qsgimage/data/tiling.qml
+++ /dev/null
@@ -1,16 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- width: 800; height: 600
-
- Image {
- objectName: "vTiling"; height: 550; width: 200
- source: "green.png"; fillMode: Image.TileVertically
- }
-
- Image {
- objectName: "hTiling"; x: 225; height: 250; width: 550
- source: "green.png"; fillMode: Image.TileHorizontally
- }
-}
-
diff --git a/tests/auto/declarative/qsgimage/data/vtiling.qml b/tests/auto/declarative/qsgimage/data/vtiling.qml
new file mode 100644
index 0000000000..f730f6e050
--- /dev/null
+++ b/tests/auto/declarative/qsgimage/data/vtiling.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 550; height: 200
+
+ Image {
+ objectName: "tiling"; anchors.fill: parent
+ source: "green.png"; fillMode: Image.TileVertically
+ }
+}
+
diff --git a/tests/auto/declarative/qsgimage/tst_qsgimage.cpp b/tests/auto/declarative/qsgimage/tst_qsgimage.cpp
index e7366ff1b8..ff5de4baf5 100644
--- a/tests/auto/declarative/qsgimage/tst_qsgimage.cpp
+++ b/tests/auto/declarative/qsgimage/tst_qsgimage.cpp
@@ -86,13 +86,12 @@ private slots:
void geometry_data();
void big();
void tiling_QTBUG_6716();
+ void tiling_QTBUG_6716_data();
void noLoading();
void paintedWidthHeight();
void sourceSize_QTBUG_14303();
void sourceSize_QTBUG_16389();
void nullPixmapPaint();
- void testQtQuick11Attributes();
- void testQtQuick11Attributes_data();
private:
template<typename T>
@@ -107,7 +106,7 @@ tst_qsgimage::tst_qsgimage()
void tst_qsgimage::noSource()
{
- QString componentStr = "import QtQuick 1.0\nImage { source: \"\" }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"\" }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
@@ -167,7 +166,7 @@ void tst_qsgimage::imageSource()
if (!error.isEmpty())
QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
- QString componentStr = "import QtQuick 1.1\nImage { source: \"" + source + "\"; asynchronous: "
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + source + "\"; asynchronous: "
+ (async ? QLatin1String("true") : QLatin1String("false")) + "; cache: "
+ (cache ? QLatin1String("true") : QLatin1String("false")) + " }";
QDeclarativeComponent component(&engine);
@@ -205,7 +204,7 @@ void tst_qsgimage::imageSource()
void tst_qsgimage::clearSource()
{
- QString componentStr = "import QtQuick 1.0\nImage { source: srcImage }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }";
QDeclarativeContext *ctxt = engine.rootContext();
ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png"));
QDeclarativeComponent component(&engine);
@@ -229,7 +228,7 @@ void tst_qsgimage::clearSource()
void tst_qsgimage::resized()
{
- QString componentStr = "import QtQuick 1.0\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
@@ -264,7 +263,7 @@ void tst_qsgimage::preserveAspectRatio()
void tst_qsgimage::smooth()
{
- QString componentStr = "import QtQuick 1.0\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
@@ -284,12 +283,11 @@ void tst_qsgimage::mirror()
qreal width = 300;
qreal height = 250;
- QString src = QUrl::fromLocalFile(SRCDIR "/data/heart200.png").toString();
- QString componentStr = "import QtQuick 1.1\nImage { source: \"" + src + "\"; }";
+ QSGView *canvas = new QSGView;
+ canvas->show();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirror.qml"));
- QDeclarativeComponent component(&engine);
- component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QSGImage *obj = qobject_cast<QSGImage*>(component.create());
+ QSGImage *obj = qobject_cast<QSGImage*>(canvas->rootObject());
QVERIFY(obj != 0);
obj->setProperty("width", width);
@@ -297,12 +295,7 @@ void tst_qsgimage::mirror()
obj->setFillMode((QSGImage::FillMode)fillMode);
obj->setProperty("mirror", true);
- QGraphicsScene scene;
- scene.addItem(qobject_cast<QSGItem *>(obj));
- QPixmap screenshot(width, height);
- screenshot.fill();
- QPainter p_screenshot(&screenshot);
- scene.render(&p_screenshot, QRect(0, 0, width, height), QRect(0, 0, width, height));
+ QPixmap screenshot = canvas->renderPixmap();
QPixmap srcPixmap;
QVERIFY(srcPixmap.load(SRCDIR "/data/heart200.png"));
@@ -344,9 +337,10 @@ void tst_qsgimage::mirror()
break;
}
+ QSKIP("Skip while QTBUG-19351 and QTBUG-19252 are not resolved", SkipSingle);
QCOMPARE(screenshot, expected);
- delete obj;
+ delete canvas;
}
void tst_qsgimage::mirror_data()
@@ -364,32 +358,17 @@ void tst_qsgimage::mirror_data()
void tst_qsgimage::svg()
{
QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.svg").toString();
- QString componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
QVERIFY(obj != 0);
- QCOMPARE(obj->pixmap().width(), 300);
- QCOMPARE(obj->pixmap().height(), 300);
QCOMPARE(obj->width(), 300.0);
QCOMPARE(obj->height(), 300.0);
-#if defined(Q_OS_LINUX)
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png"));
-#elif defined(Q_OS_WIN32)
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-win32.png"));
-#endif
-
obj->setSourceSize(QSize(200,200));
- QCOMPARE(obj->pixmap().width(), 200);
- QCOMPARE(obj->pixmap().height(), 200);
QCOMPARE(obj->width(), 200.0);
QCOMPARE(obj->height(), 200.0);
-#if defined(Q_OS_LINUX)
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png"));
-#elif defined(Q_OS_WIN32)
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-win32.png"));
-#endif
delete obj;
}
@@ -443,7 +422,7 @@ void tst_qsgimage::geometry()
QFETCH(double, boundingHeight);
QString src = QUrl::fromLocalFile(SRCDIR "/data/rect.png").toString();
- QString componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; fillMode: Image." + fillMode + "; ";
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; fillMode: Image." + fillMode + "; ";
if (explicitWidth)
componentStr.append("width: 300; ");
@@ -471,63 +450,48 @@ void tst_qsgimage::big()
// 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 componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; width: 100; sourceSize.height: 256 }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 100; sourceSize.height: 256 }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
QVERIFY(obj != 0);
- QCOMPARE(obj->pixmap().width(), 256);
- QCOMPARE(obj->pixmap().height(), 256);
QCOMPARE(obj->width(), 100.0);
QCOMPARE(obj->height(), 256.0);
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/big256.png"));
delete obj;
}
void tst_qsgimage::tiling_QTBUG_6716()
{
+ QFETCH(QString, source);
+
QSGView *canvas = new QSGView(0);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/tiling.qml"));
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR + source));
canvas->show();
qApp->processEvents();
- QSGImage *vTiling = findItem<QSGImage>(canvas->rootObject(), "vTiling");
- QSGImage *hTiling = findItem<QSGImage>(canvas->rootObject(), "hTiling");
-
- QVERIFY(vTiling != 0);
- QVERIFY(hTiling != 0);
+ QSGImage *tiling = findItem<QSGImage>(canvas->rootObject(), "tiling");
- {
- QPixmap pm(vTiling->width(), vTiling->height());
- QPainter p(&pm);
- vTiling->paint(&p, 0, 0);
-
- QImage img = pm.toImage();
- for (int x = 0; x < vTiling->width(); ++x) {
- for (int y = 0; y < vTiling->height(); ++y) {
- QVERIFY(img.pixel(x, y) == qRgb(0, 255, 0));
- }
- }
- }
-
- {
- QPixmap pm(hTiling->width(), hTiling->height());
- QPainter p(&pm);
- hTiling->paint(&p, 0, 0);
-
- QImage img = pm.toImage();
- for (int x = 0; x < hTiling->width(); ++x) {
- for (int y = 0; y < hTiling->height(); ++y) {
- QVERIFY(img.pixel(x, y) == qRgb(0, 255, 0));
- }
+ QVERIFY(tiling != 0);
+ QPixmap pm = canvas->renderPixmap();
+ QImage img = pm.toImage();
+ for (int x = 0; x < tiling->width(); ++x) {
+ for (int y = 0; y < tiling->height(); ++y) {
+ QEXPECT_FAIL("", "QTBUG-19351", Abort);
+ QVERIFY(img.pixel(x, y) == qRgb(0, 255, 0));
}
}
-
delete canvas;
}
+void tst_qsgimage::tiling_QTBUG_6716_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::newRow("vertical_tiling") << "/data/vtiling.qml";
+ QTest::newRow("horizontal_tiling") << "/data/htiling.qml";
+}
+
void tst_qsgimage::noLoading()
{
TestHTTPServer server(SERVER_PORT);
@@ -535,7 +499,7 @@ void tst_qsgimage::noLoading()
server.serveDirectory(SRCDIR "/data");
server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png");
- QString componentStr = "import QtQuick 1.0\nImage { source: srcImage }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }";
QDeclarativeContext *ctxt = engine.rootContext();
ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart.png"));
QDeclarativeComponent component(&engine);
@@ -582,37 +546,31 @@ void tst_qsgimage::paintedWidthHeight()
{
{
QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.png").toString();
- QString componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; width: 200; height: 25; fillMode: Image.PreserveAspectFit }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 200; height: 25; fillMode: Image.PreserveAspectFit }";
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
QVERIFY(obj != 0);
- QCOMPARE(obj->pixmap().width(), 300);
- QCOMPARE(obj->pixmap().height(), 300);
QCOMPARE(obj->width(), 200.0);
QCOMPARE(obj->height(), 25.0);
QCOMPARE(obj->paintedWidth(), 25.0);
QCOMPARE(obj->paintedHeight(), 25.0);
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png"));
delete obj;
}
{
QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.png").toString();
- QString componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; width: 26; height: 175; fillMode: Image.PreserveAspectFit }";
+ 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(""));
QSGImage *obj = qobject_cast<QSGImage*>(component.create());
QVERIFY(obj != 0);
- QCOMPARE(obj->pixmap().width(), 300);
- QCOMPARE(obj->pixmap().height(), 300);
QCOMPARE(obj->width(), 26.0);
QCOMPARE(obj->height(), 175.0);
QCOMPARE(obj->paintedWidth(), 26.0);
QCOMPARE(obj->paintedHeight(), 26.0);
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png"));
delete obj;
}
@@ -620,7 +578,7 @@ void tst_qsgimage::paintedWidthHeight()
void tst_qsgimage::sourceSize_QTBUG_14303()
{
- QString componentStr = "import QtQuick 1.0\nImage { source: srcImage }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }";
QDeclarativeContext *ctxt = engine.rootContext();
ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart200.png"));
QDeclarativeComponent component(&engine);
@@ -681,65 +639,24 @@ static void checkWarnings(QtMsgType, const char *)
// QTBUG-15690
void tst_qsgimage::nullPixmapPaint()
{
- QString componentStr = QString("import QtQuick 1.0\nImage { width: 10; height:10; fillMode: Image.PreserveAspectFit; source: \"")
- + SERVER_ADDR + QString("/no-such-file.png\" }");
- QDeclarativeComponent component(&engine);
- component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
- QSGImage *image = qobject_cast<QSGImage*>(component.create());
+ QSGView *canvas = new QSGView(0);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/nullpixmap.qml"));
+ canvas->show();
+ QSGImage *image = qobject_cast<QSGImage*>(canvas->rootObject());
QTRY_VERIFY(image != 0);
-
- QtMsgHandler previousMsgHandler = qInstallMsgHandler(checkWarnings);
+ image->setSource(SERVER_ADDR + QString("/no-such-file.png"));
- QPixmap pm(100, 100);
- QPainter p(&pm);
+ QtMsgHandler previousMsgHandler = qInstallMsgHandler(checkWarnings);
// used to print "QTransform::translate with NaN called"
- image->paint(&p, 0, 0);
+ QPixmap pm = canvas->renderPixmap();
+
qInstallMsgHandler(previousMsgHandler);
QVERIFY(numberOfWarnings == 0);
delete image;
}
-void tst_qsgimage::testQtQuick11Attributes()
-{
- QFETCH(QString, code);
- QFETCH(QString, warning);
- QFETCH(QString, error);
-
- QDeclarativeEngine engine;
- QObject *obj;
-
- QDeclarativeComponent valid(&engine);
- valid.setData("import QtQuick 1.1; Image { " + code.toUtf8() + " }", QUrl(""));
- obj = valid.create();
- QVERIFY(obj);
- QVERIFY(valid.errorString().isEmpty());
- delete obj;
-
- QDeclarativeComponent invalid(&engine);
- invalid.setData("import QtQuick 1.0; Image { " + code.toUtf8() + " }", QUrl(""));
- QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
- obj = invalid.create();
- QCOMPARE(invalid.errorString(), error);
- delete obj;
-}
-
-void tst_qsgimage::testQtQuick11Attributes_data()
-{
- QTest::addColumn<QString>("code");
- QTest::addColumn<QString>("warning");
- QTest::addColumn<QString>("error");
-
- QTest::newRow("mirror") << "mirror: true"
- << "QDeclarativeComponent: Component is not ready"
- << ":1 \"Image.mirror\" is not available in QtQuick 1.0.\n";
-
- QTest::newRow("cache") << "cache: true"
- << "QDeclarativeComponent: Component is not ready"
- << ":1 \"Image.cache\" is not available in QtQuick 1.0.\n";
-}
-
/*
Find an item with the specified objectName. If index is supplied then the
item must also evaluate the {index} expression equal to index
diff --git a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
index f697e61208..507caede71 100644
--- a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
+++ b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
@@ -53,6 +53,7 @@
#include <QtDeclarative/private/qlistmodelinterface_p.h>
#include "../../../shared/util.h"
#include "incrementalmodel.h"
+#include <QtOpenGL/QGLShaderProgram>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -66,6 +67,8 @@ public:
tst_QSGListView();
private slots:
+ void initTestCase();
+ void cleanupTestCase();
// Test both QListModelInterface and QAbstractItemModel model types
void qListModelInterface_items();
void qAbstractItemModel_items();
@@ -133,6 +136,17 @@ private:
void dumpTree(QSGItem *parent, int depth = 0);
};
+void tst_QSGListView::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("QSGListView needs OpenGL 2.0", SkipAll);
+}
+
+void tst_QSGListView::cleanupTestCase()
+{
+
+}
class TestObject : public QObject
{
Q_OBJECT
diff --git a/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp b/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
index 857f888c29..4e1d253c3d 100644
--- a/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
+++ b/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
@@ -47,6 +47,7 @@
#include <QtDeclarative/qsgview.h>
#include <QtDeclarative/qdeclarativecontext.h>
#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtOpenGL/QGLShaderProgram>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -57,6 +58,8 @@ class tst_QSGMouseArea: public QObject
{
Q_OBJECT
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void dragProperties();
void resetDrag();
void dragging();
@@ -77,6 +80,18 @@ private:
QSGView *createView();
};
+void tst_QSGMouseArea::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("MouseArea needs OpenGL 2.0", SkipAll);
+}
+
+void tst_QSGMouseArea::cleanupTestCase()
+{
+
+}
+
void tst_QSGMouseArea::dragProperties()
{
QSGView *canvas = createView();
diff --git a/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp b/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
index df8057c4c4..5b95acec68 100644
--- a/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
+++ b/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
@@ -55,6 +55,7 @@
#include <QStringListModel>
#include <QStandardItemModel>
#include <QFile>
+#include <QtOpenGL/QGLShaderProgram>
#include "../../../shared/util.h"
@@ -89,6 +90,8 @@ public:
tst_QSGPathView();
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void initValues();
void items();
void dataModel();
@@ -121,6 +124,18 @@ private:
QList<T*> findItems(QSGItem *parent, const QString &objectName);
};
+void tst_QSGPathView::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("PathView needs OpenGL 2.0", SkipAll);
+}
+
+void tst_QSGPathView::cleanupTestCase()
+{
+
+}
+
class TestObject : public QObject
{
Q_OBJECT
diff --git a/tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp b/tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp
index 01895a69bd..b6dd1c7831 100644
--- a/tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp
+++ b/tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp
@@ -45,6 +45,7 @@
#include <private/qsgrectangle_p.h>
#include <QtDeclarative/qsgview.h>
#include <QtDeclarative/qdeclarativecontext.h>
+#include <QtOpenGL/QGLShaderProgram>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -55,6 +56,8 @@ class tst_QSGPinchArea: public QObject
{
Q_OBJECT
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void pinchProperties();
void scale();
void pan();
@@ -62,7 +65,17 @@ private slots:
private:
QSGView *createView();
};
+void tst_QSGPinchArea::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("PinchArea needs OpenGL 2.0", SkipAll);
+}
+void tst_QSGPinchArea::cleanupTestCase()
+{
+
+}
void tst_QSGPinchArea::pinchProperties()
{
QSGView *canvas = createView();
diff --git a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp
index 2861dd9a9f..27db79b640 100644
--- a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp
+++ b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp
@@ -54,6 +54,7 @@
#include "../../../shared/util.h"
#include "testhttpserver.h"
+#include <QtOpenGL/QGLShaderProgram>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -68,6 +69,8 @@ public:
tst_qsgtext();
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void text();
void width();
void wrap();
@@ -127,7 +130,17 @@ private:
QSGView *createView(const QString &filename);
};
+void tst_qsgtext::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("Text item needs OpenGL 2.0", SkipAll);
+}
+
+void tst_qsgtext::cleanupTestCase()
+{
+}
tst_qsgtext::tst_qsgtext()
{
standard << "the quick brown fox jumped over the lazy dog"
@@ -461,6 +474,8 @@ void tst_qsgtext::alignments_data()
void tst_qsgtext::alignments()
{
+ QSKIP("Text alignment pixmap comparison tests will not work with scenegraph", SkipAll);
+
QFETCH(int, hAlign);
QFETCH(int, vAlign);
QFETCH(QString, expectfile);
diff --git a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
index 5510701962..3e4803bc03 100644
--- a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
+++ b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
@@ -60,6 +60,7 @@
#include <QMimeData>
#include <private/qapplication_p.h>
#include <private/qtextcontrol_p.h>
+#include <QtOpenGL/QGLShaderProgram>
#ifdef Q_WS_MAC
#include <Carbon/Carbon.h>
@@ -97,6 +98,8 @@ public:
tst_qsgtextedit();
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void text();
void width();
void wrap();
@@ -170,7 +173,17 @@ private:
QDeclarativeEngine engine;
};
+void tst_qsgtextedit::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("TextEdit item needs OpenGL 2.0", SkipAll);
+}
+
+void tst_qsgtextedit::cleanupTestCase()
+{
+}
tst_qsgtextedit::tst_qsgtextedit()
{
standard << "the quick brown fox jumped over the lazy dog"
@@ -2173,6 +2186,8 @@ void tst_qsgtextedit::preeditMicroFocus()
QSGTextEdit *edit = qobject_cast<QSGTextEdit *>(view.rootObject());
QVERIFY(edit);
+ QSignalSpy cursorRectangleSpy(edit, SIGNAL(cursorRectangleChanged()));
+
QRect currentRect;
QRect previousRect = edit->inputMethodQuery(Qt::ImMicroFocus).toRect();
@@ -2183,8 +2198,9 @@ void tst_qsgtextedit::preeditMicroFocus()
currentRect = edit->inputMethodQuery(Qt::ImMicroFocus).toRect();
QCOMPARE(currentRect, previousRect);
#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
- QCOMPARE(ic.updateReceived, true);
+ QCOMPARE(ic.updateReceived, false); // The cursor position hasn't changed.
#endif
+ QCOMPARE(cursorRectangleSpy.count(), 0);
// Verify that the micro focus rect moves to the left as the cursor position
// is incremented.
@@ -2196,6 +2212,8 @@ void tst_qsgtextedit::preeditMicroFocus()
#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
QCOMPARE(ic.updateReceived, true);
#endif
+ QVERIFY(cursorRectangleSpy.count() > 0);
+ cursorRectangleSpy.clear();
previousRect = currentRect;
}
@@ -2209,6 +2227,7 @@ void tst_qsgtextedit::preeditMicroFocus()
#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
QCOMPARE(ic.updateReceived, true);
#endif
+ QVERIFY(cursorRectangleSpy.count() > 0);
}
void tst_qsgtextedit::inputContextMouseHandler()
diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
index b349de9800..5f6884b2b9 100644
--- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
+++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
@@ -51,6 +51,7 @@
#include <QStyle>
#include <QInputContext>
#include <private/qapplication_p.h>
+#include <QtOpenGL/QGLShaderProgram>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -83,7 +84,8 @@ public:
tst_qsgtextinput();
private slots:
-
+ void initTestCase();
+ void cleanupTestCase();
void text();
void width();
void font();
@@ -144,7 +146,17 @@ private:
QStringList standard;
QStringList colorStrings;
};
+void tst_qsgtextinput::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("TextInput item needs OpenGL 2.0", SkipAll);
+}
+void tst_qsgtextinput::cleanupTestCase()
+{
+
+}
tst_qsgtextinput::tst_qsgtextinput()
{
standard << "the quick brown fox jumped over the lazy dog"
diff --git a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
index 23e629538d..ce2c816dd6 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
+++ b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
@@ -51,6 +51,7 @@
#include <private/qsgvisualitemmodel_p.h>
#include <private/qdeclarativevaluetype_p.h>
#include <math.h>
+#include <QtOpenGL/QGLShaderProgram>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -115,6 +116,8 @@ public:
tst_qsgvisualdatamodel();
private slots:
+ void initTestCase();
+ void cleanupTestCase();
void rootIndex();
void updateLayout();
void childChanged();
@@ -128,7 +131,17 @@ private:
template<typename T>
T *findItem(QSGItem *parent, const QString &objectName, int index);
};
+void tst_qsgvisualdatamodel::initTestCase()
+{
+ QSGView canvas;
+ if (!QGLShaderProgram::hasOpenGLShaderPrograms(canvas.context()))
+ QSKIP("VisualDatamodel item needs OpenGL 2.0", SkipAll);
+}
+void tst_qsgvisualdatamodel::cleanupTestCase()
+{
+
+}
class DataObject : public QObject
{
Q_OBJECT