summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlgraphicsborderimage
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-11-19 02:58:51 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-11-19 02:58:51 (GMT)
commitc72211c1f518adc53e12aaf70e47e966a50698d5 (patch)
tree784799ba846ca1833ab83b5c24a2385b0178cb6a /tests/auto/declarative/qmlgraphicsborderimage
parentfb6a6063ef17d188494d1832e7bd669f0391b55d (diff)
downloadQt-c72211c1f518adc53e12aaf70e47e966a50698d5.zip
Qt-c72211c1f518adc53e12aaf70e47e966a50698d5.tar.gz
Qt-c72211c1f518adc53e12aaf70e47e966a50698d5.tar.bz2
Test clearing the source of a BorderImage.
Diffstat (limited to 'tests/auto/declarative/qmlgraphicsborderimage')
-rw-r--r--tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp
index 06a05dd..a0860c5 100644
--- a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp
+++ b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp
@@ -50,6 +50,7 @@
#include <private/qmlgraphicsimagebase_p.h>
#include <private/qmlgraphicsscalegrid_p_p.h>
#include <private/qmlgraphicsloader_p.h>
+#include <QtDeclarative/qmlcontext.h>
#include "../shared/testhttpserver.h"
@@ -78,6 +79,7 @@ private slots:
void noSource();
void imageSource();
void imageSource_data();
+ void clearSource();
void resized();
void smooth();
void tileModes();
@@ -143,6 +145,25 @@ void tst_qmlgraphicsborderimage::imageSource()
delete obj;
}
+void tst_qmlgraphicsborderimage::clearSource()
+{
+ QString componentStr = "import Qt 4.6\nBorderImage { source: srcImage }";
+ QmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", SRCDIR "/data/colors.png");
+ QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QVERIFY(obj->status() == QmlGraphicsBorderImage::Ready);
+ QCOMPARE(obj->width(), 120.);
+ QCOMPARE(obj->height(), 120.);
+
+ ctxt->setContextProperty("srcImage", "");
+ QVERIFY(obj->source().isEmpty());
+ QVERIFY(obj->status() == QmlGraphicsBorderImage::Null);
+ QCOMPARE(obj->width(), 0.);
+ QCOMPARE(obj->height(), 0.);
+}
+
void tst_qmlgraphicsborderimage::imageSource_data()
{
QTest::addColumn<QString>("source");