aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-05-31 12:05:26 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-05-31 12:05:39 +0200
commitdece229a7c2284598c36fb668de766309a6893cf (patch)
tree6e34cfa52416b2f27d2fa0631cf34f8ffd171be4 /tests/auto/quick
parente2520ff76be49c5aa917741cc6a380fe1549e47d (diff)
parentc158ca8be49a75026e83751dfd825c5bdd63189a (diff)
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qquickscreen/tst_qquickscreen.cpp3
-rw-r--r--tests/auto/quick/qquicktextinput/BLACKLIST3
-rw-r--r--tests/auto/quick/quick.pro3
-rw-r--r--tests/auto/quick/sharedimage/data/yellow.pngbin0 -> 95 bytes
-rw-r--r--tests/auto/quick/sharedimage/sharedimage.pro12
-rw-r--r--tests/auto/quick/sharedimage/tst_sharedimage.cpp103
6 files changed, 123 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
index 26b687a4a6..0a3796402a 100644
--- a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
+++ b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
@@ -113,6 +113,9 @@ void tst_qquickscreen::fullScreenList()
QQuickScreenInfo *info = qobject_cast<QQuickScreenInfo *>(screensArray.property(i).toQObject());
QVERIFY(info != nullptr);
QCOMPARE(screenList[i]->name(), info->name());
+ QCOMPARE(screenList[i]->manufacturer(), info->manufacturer());
+ QCOMPARE(screenList[i]->model(), info->model());
+ QCOMPARE(screenList[i]->serialNumber(), info->serialNumber());
QCOMPARE(screenList[i]->size().width(), info->width());
QCOMPARE(screenList[i]->size().height(), info->height());
QCOMPARE(screenList[i]->availableVirtualGeometry().width(), info->desktopAvailableWidth());
diff --git a/tests/auto/quick/qquicktextinput/BLACKLIST b/tests/auto/quick/qquicktextinput/BLACKLIST
new file mode 100644
index 0000000000..e9f4f11c58
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/BLACKLIST
@@ -0,0 +1,3 @@
+# QTBUG-41895
+[tripleClickSelectsAll]
+windows
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index 9b1657e2a2..ebc2e32b79 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -86,7 +86,8 @@ QUICKTESTS = \
qquickdesignersupport \
qquickscreen \
touchmouse \
- scenegraph
+ scenegraph \
+ sharedimage
SUBDIRS += $$PUBLICTESTS
diff --git a/tests/auto/quick/sharedimage/data/yellow.png b/tests/auto/quick/sharedimage/data/yellow.png
new file mode 100644
index 0000000000..51e8aaf38c
--- /dev/null
+++ b/tests/auto/quick/sharedimage/data/yellow.png
Binary files differ
diff --git a/tests/auto/quick/sharedimage/sharedimage.pro b/tests/auto/quick/sharedimage/sharedimage.pro
new file mode 100644
index 0000000000..00ec2c1131
--- /dev/null
+++ b/tests/auto/quick/sharedimage/sharedimage.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_sharedimage
+CONFIG -= app_bundle
+
+SOURCES += tst_sharedimage.cpp
+
+QT += testlib quick-private
+
+TESTDATA = data/*
+
+OTHER_FILES += \
+ data/yellow.png
diff --git a/tests/auto/quick/sharedimage/tst_sharedimage.cpp b/tests/auto/quick/sharedimage/tst_sharedimage.cpp
new file mode 100644
index 0000000000..b91fc8a0de
--- /dev/null
+++ b/tests/auto/quick/sharedimage/tst_sharedimage.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest>
+#include <private/qquickimage_p.h>
+#include <QQmlApplicationEngine>
+
+class tst_sharedimage : public QObject
+{
+ Q_OBJECT
+public:
+ tst_sharedimage()
+ {
+ }
+
+private slots:
+ void initTestCase();
+ void compareToPlainLoad_data();
+ void compareToPlainLoad();
+};
+
+void tst_sharedimage::initTestCase()
+{
+#if !QT_CONFIG(systemsemaphore)
+ QSKIP("Shared image not supported");
+#endif
+}
+
+void tst_sharedimage::compareToPlainLoad_data()
+{
+ QString imagePath = QFINDTESTDATA("data/yellow.png");
+ if (imagePath.startsWith(QLatin1Char('/')))
+ imagePath.remove(0, 1);
+ QString plainImage("Image { source: \"file:///%1\"; cache: false; %2 }");
+ QString sharedImage("Image { source: \"image://shared/%1\"; cache: false; %2 }");
+ QString script("import QtQuick 2.0\nimport Qt.labs.sharedimage 1.0\n%1\n");
+
+ QString plain = script.arg(plainImage).arg(imagePath);
+ QString shared = script.arg(sharedImage).arg(imagePath);
+
+ QTest::addColumn<QByteArray>("plainScript");
+ QTest::addColumn<QByteArray>("sharedScript");
+
+ QString opts = QStringLiteral("asynchronous: false;");
+ QTest::newRow("sync") << plain.arg(opts).toLatin1() << shared.arg(opts).toLatin1();
+
+ opts = QStringLiteral("asynchronous: true");
+ QTest::newRow("async") << plain.arg(opts).toLatin1() << shared.arg(opts).toLatin1();
+
+ opts = QStringLiteral("sourceSize: Qt.size(50, 50)");
+ QTest::newRow("scaled, stretch") << plain.arg(opts).toLatin1() << shared.arg(opts).toLatin1();
+
+ opts = QStringLiteral("sourceSize: Qt.size(50, 50); fillMode: Image.PreserveAspectFit");
+ QTest::newRow("scaled, aspectfit") << plain.arg(opts).toLatin1() << shared.arg(opts).toLatin1();
+}
+
+void tst_sharedimage::compareToPlainLoad()
+{
+ QFETCH(QByteArray, plainScript);
+ QFETCH(QByteArray, sharedScript);
+
+ QImage images[2];
+ for (int i = 0; i < 2; i++) {
+ QQmlApplicationEngine engine;
+ engine.loadData(i ? sharedScript : plainScript);
+ QVERIFY(engine.rootObjects().size());
+ QQuickImage *obj = qobject_cast<QQuickImage*>(engine.rootObjects().at(0));
+ QVERIFY(obj != 0);
+ QTRY_VERIFY(!obj->image().isNull());
+ images[i] = obj->image();
+ }
+
+ QCOMPARE(images[1], images[0].convertToFormat(images[1].format()));
+}
+
+QTEST_MAIN(tst_sharedimage)
+
+#include "tst_sharedimage.moc"