aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickanimatedimage
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickanimatedimage')
-rw-r--r--tests/auto/quick/qquickanimatedimage/CMakeLists.txt6
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/currentframe.qml1
-rw-r--r--tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp33
3 files changed, 39 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickanimatedimage/CMakeLists.txt b/tests/auto/quick/qquickanimatedimage/CMakeLists.txt
index 2d58301f15..109e84cc14 100644
--- a/tests/auto/quick/qquickanimatedimage/CMakeLists.txt
+++ b/tests/auto/quick/qquickanimatedimage/CMakeLists.txt
@@ -7,6 +7,12 @@
## tst_qquickanimatedimage Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qquickanimatedimage LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
# Collect test data
file(GLOB_RECURSE test_data_glob
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/tests/auto/quick/qquickanimatedimage/data/currentframe.qml b/tests/auto/quick/qquickanimatedimage/data/currentframe.qml
index b679da2a99..3c58bdaa4b 100644
--- a/tests/auto/quick/qquickanimatedimage/data/currentframe.qml
+++ b/tests/auto/quick/qquickanimatedimage/data/currentframe.qml
@@ -4,6 +4,7 @@ AnimatedImage {
property int currentFrameChangeCount: 0
property int frameChangeCount: 0
source: "stickman.gif"
+ paused: true
onCurrentFrameChanged: if (currentFrame > 0) ++currentFrameChangeCount;
onFrameChanged: if (currentFrame > 0) ++frameChangeCount;
function scriptedSetCurrentFrame(frame) {
diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
index cb81ec8a07..efea42de34 100644
--- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
+++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <qtest.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlexpression.h>
@@ -62,6 +62,7 @@ private slots:
void noCaching();
void sourceChangesOnFrameChanged();
void currentFrame();
+ void qtbug_120555();
};
void tst_qquickanimatedimage::cleanup()
@@ -646,6 +647,36 @@ void tst_qquickanimatedimage::currentFrame()
QCOMPARE(anim->property("frameChangeCount"), 2);
}
+void tst_qquickanimatedimage::qtbug_120555()
+{
+ TestHTTPServer server;
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
+ server.serveDirectory(dataDirectory());
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nAnimatedImage {}", {});
+
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage*>(component.create());
+ QVERIFY(anim);
+
+ anim->setSource(server.url("/stickman.gif"));
+ QTRY_COMPARE(anim->status(), QQuickImage::Loading);
+
+ anim->setFillMode(QQuickImage::PreserveAspectFit);
+ QCOMPARE(anim->fillMode(), QQuickImage::PreserveAspectFit);
+ anim->setMipmap(true);
+ QCOMPARE(anim->mipmap(), true);
+ anim->setCache(false);
+ QCOMPARE(anim->cache(), false);
+ anim->setSourceSize(QSize(200, 200));
+ QCOMPARE(anim->sourceSize(), QSize(200, 200));
+
+ QTRY_COMPARE(anim->status(), QQuickImage::Ready);
+
+ delete anim;
+}
+
QTEST_MAIN(tst_qquickanimatedimage)
#include "tst_qquickanimatedimage.moc"