Fix QSGBorderImage autotests
authorYann Bodson <yann.bodson@nokia.com>
Wed, 6 Jul 2011 04:32:37 +0000 (14:32 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 6 Jul 2011 22:31:11 +0000 (00:31 +0200)
Change-Id: I6dd87232fc3d12a0ea3b8c25932d2ca01879fb3b
Reviewed-on: http://codereview.qt.nokia.com/1196
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
tests/auto/declarative/qsgborderimage/data/colors-mirror.png [new file with mode: 0644]
tests/auto/declarative/qsgborderimage/data/mirror.qml
tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp

diff --git a/tests/auto/declarative/qsgborderimage/data/colors-mirror.png b/tests/auto/declarative/qsgborderimage/data/colors-mirror.png
new file mode 100644 (file)
index 0000000..e30870d
Binary files /dev/null and b/tests/auto/declarative/qsgborderimage/data/colors-mirror.png differ
index 8d02f58..abab076 100644 (file)
@@ -1,8 +1,7 @@
 import QtQuick 2.0
 
 BorderImage {
-    source: "heart200.png"
-    smooth: true
+    source: "colors-mirror.png"
     width: 300; height: 300
-    border { top: 50; right: 50; bottom: 50; left: 50 }
+    border { top: 30; right: 30; bottom: 30; left: 30 }
 }
index 2bd15c1..b5836cf 100644 (file)
@@ -230,16 +230,18 @@ void tst_qsgborderimage::mirror()
     canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirror.qml"));
     QSGBorderImage *image = qobject_cast<QSGBorderImage*>(canvas->rootObject());
     QVERIFY(image != 0);
+    canvas->show();
 
-    int width = image->property("width").toInt();
+    QImage screenshot = canvas->grabFrameBuffer();
 
-    QPixmap screenshot = canvas->renderPixmap();
+    QImage srcPixmap(screenshot);
+    QTransform transform;
+    transform.translate(image->width(), 0).scale(-1, 1.0);
+    srcPixmap = srcPixmap.transformed(transform);
 
     image->setProperty("mirror", true);
-    QPixmap mirrored;
-
-    QSKIP("Skip while QTBUG-19351 and QTBUG-19252 are not resolved", SkipSingle);
-    QCOMPARE(screenshot, mirrored);
+    screenshot = canvas->grabFrameBuffer();
+    QCOMPARE(screenshot, srcPixmap);
 
     delete canvas;
 }