diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicktextinput/BLACKLIST | 4 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 1 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/LottieAnimation.qml | 1 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/VectorImage.qml | 1 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/mainwindow.cpp | 13 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/mainwindow.h | 1 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/mainwindow.ui | 55 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/svgpainter.cpp | 3 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/svgpainter.h | 17 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/vectorimagemanager.h | 16 |
10 files changed, 87 insertions, 25 deletions
diff --git a/tests/auto/quick/qquicktextinput/BLACKLIST b/tests/auto/quick/qquicktextinput/BLACKLIST index 87df955e9a..7510e44426 100644 --- a/tests/auto/quick/qquicktextinput/BLACKLIST +++ b/tests/auto/quick/qquicktextinput/BLACKLIST @@ -1,7 +1,3 @@ -# QTBUG-78162 -[mouseSelectionMode] -opensuse-leap - # QTQAINFRA-4127 [passwordCharacter] ci b2qt 32bit diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index d2c68382d0..c12edf5a1c 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -1336,7 +1336,6 @@ void tst_qquicktextinput::mouseSelectionMode() QQuickView window(QUrl::fromLocalFile(qmlfile)); window.show(); - window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(window.rootObject() != nullptr); diff --git a/tests/manual/vectorimagetest/LottieAnimation.qml b/tests/manual/vectorimagetest/LottieAnimation.qml index 8463234393..28c14706cc 100644 --- a/tests/manual/vectorimagetest/LottieAnimation.qml +++ b/tests/manual/vectorimagetest/LottieAnimation.qml @@ -12,5 +12,6 @@ Item { id: lottieAnimation textureSize: Qt.size(width * parent.scale, height * parent.scale) source: VectorImageManager.currentSource.toString().endsWith("json") ? VectorImageManager.currentSource : "" + loops: VectorImageManager.looping ? LottieAnimation.Infinite : 1 } } diff --git a/tests/manual/vectorimagetest/VectorImage.qml b/tests/manual/vectorimagetest/VectorImage.qml index dfd5473ed6..4a3fedf832 100644 --- a/tests/manual/vectorimagetest/VectorImage.qml +++ b/tests/manual/vectorimagetest/VectorImage.qml @@ -14,5 +14,6 @@ Item { source: VectorImageManager.currentSource preferredRendererType: VectorImage.CurveRenderer assumeTrustedSource: true + animations.loops: VectorImageManager.looping ? Animation.Infinite : 1 } } diff --git a/tests/manual/vectorimagetest/mainwindow.cpp b/tests/manual/vectorimagetest/mainwindow.cpp index a1580d7f8b..c3b11c04b8 100644 --- a/tests/manual/vectorimagetest/mainwindow.cpp +++ b/tests/manual/vectorimagetest/mainwindow.cpp @@ -12,6 +12,7 @@ #include <QQuickWidget> #include <QQmlEngine> #include <QSlider> +#include <QCheckBox> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) @@ -58,9 +59,16 @@ MainWindow::MainWindow(QWidget *parent) connect(ui->hsScale, &QAbstractSlider::valueChanged, m_manager, &VectorImageManager::setScale); connect(ui->hsScale, &QAbstractSlider::valueChanged, m_svgPainter, &SvgPainter::setScale); connect(ui->hsScale, &QAbstractSlider::valueChanged, this, &MainWindow::setScale); + + connect(ui->cbLooping, &QCheckBox::toggled, m_manager, &VectorImageManager::setLooping); + connect(ui->cbLooping, &QCheckBox::toggled, this, &MainWindow::setLooping); + connect(ui->cbLooping, &QCheckBox::toggled, m_svgPainter, &SvgPainter::setLooping); + int scale = m_settings->value(QStringLiteral("scale"), 10).toInt(); ui->hsScale->setValue(scale); + ui->cbLooping->setChecked(m_settings->value(QStringLiteral("looping")).toBool()); + ui->tbNext->setShortcut(QKeySequence(QKeySequence::MoveToNextChar)); ui->tbPrev->setShortcut(QKeySequence(QKeySequence::MoveToPreviousChar)); } @@ -175,3 +183,8 @@ void MainWindow::previous() m_manager->setCurrentIndex(m_manager->currentIndex() - 1); } + +void MainWindow::setLooping(bool looping) +{ + m_settings->setValue(QStringLiteral("looping"), looping); +} diff --git a/tests/manual/vectorimagetest/mainwindow.h b/tests/manual/vectorimagetest/mainwindow.h index cc0fe83ab5..865893b847 100644 --- a/tests/manual/vectorimagetest/mainwindow.h +++ b/tests/manual/vectorimagetest/mainwindow.h @@ -34,6 +34,7 @@ private slots: void previous(); void loadDirectory(const QString &newDir); void updateIndex(int newIndex); + void setLooping(bool looping); private: void updateCurrentDir(const QString &newDir); diff --git a/tests/manual/vectorimagetest/mainwindow.ui b/tests/manual/vectorimagetest/mainwindow.ui index dd5a32dc8d..f7e16d0585 100644 --- a/tests/manual/vectorimagetest/mainwindow.ui +++ b/tests/manual/vectorimagetest/mainwindow.ui @@ -55,7 +55,7 @@ <x>0</x> <y>0</y> <width>263</width> - <height>790</height> + <height>788</height> </rect> </property> </widget> @@ -98,7 +98,7 @@ <x>0</x> <y>0</y> <width>264</width> - <height>790</height> + <height>788</height> </rect> </property> </widget> @@ -141,7 +141,7 @@ <x>0</x> <y>0</y> <width>263</width> - <height>790</height> + <height>788</height> </rect> </property> </widget> @@ -167,7 +167,7 @@ <item> <widget class="QScrollArea" name="saVectorImage"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -184,7 +184,7 @@ <x>0</x> <y>0</y> <width>263</width> - <height>790</height> + <height>788</height> </rect> </property> </widget> @@ -254,20 +254,37 @@ </widget> </item> <item> - <widget class="QSlider" name="hsScale"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>10</number> - </property> - <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QSlider" name="hsScale"> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>10</number> + </property> + <property name="orientation"> + <enum>Qt::Orientation::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbLooping"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Looping animations</string> + </property> + </widget> + </item> + </layout> </item> </layout> </widget> diff --git a/tests/manual/vectorimagetest/svgpainter.cpp b/tests/manual/vectorimagetest/svgpainter.cpp index 7de39e5a4d..3deec5a2ee 100644 --- a/tests/manual/vectorimagetest/svgpainter.cpp +++ b/tests/manual/vectorimagetest/svgpainter.cpp @@ -73,6 +73,9 @@ void SvgPainter::paintEvent(QPaintEvent *event) m_renderer.render(&p); m_size = m_renderer.defaultSize(); setFixedSize(m_size * m_scale / 10.0); + + if (m_looping && m_renderer.currentFrame() >= (m_renderer.animationDuration() / 1000 * m_renderer.framesPerSecond())) + m_renderer.setCurrentFrame(0); } #else m_size = renderer()->defaultSize(); diff --git a/tests/manual/vectorimagetest/svgpainter.h b/tests/manual/vectorimagetest/svgpainter.h index d362258661..d78af20aa1 100644 --- a/tests/manual/vectorimagetest/svgpainter.h +++ b/tests/manual/vectorimagetest/svgpainter.h @@ -20,6 +20,7 @@ class SvgPainter : public QWidget Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) + Q_PROPERTY(bool looping READ looping WRITE setLooping NOTIFY loopingChanged) public: explicit SvgPainter(QWidget *parent = nullptr); @@ -29,10 +30,23 @@ public: qreal scale() const; void setScale(const qreal scale); + bool looping() const + { + return m_looping; + } + + void setLooping(bool looping) + { + if (m_looping == looping) + return; + m_looping = looping; + emit loopingChanged(); + } + signals: void sourceChanged(); void scaleChanged(); - + void loopingChanged(); protected: #ifndef SVGWIDGET @@ -45,6 +59,7 @@ private: QUrl m_source; QSize m_size; qreal m_scale; + bool m_looping = false; #ifndef SVGWIDGET QSvgRenderer m_renderer; #endif diff --git a/tests/manual/vectorimagetest/vectorimagemanager.h b/tests/manual/vectorimagetest/vectorimagemanager.h index e81cf4520a..67fa8989dc 100644 --- a/tests/manual/vectorimagetest/vectorimagemanager.h +++ b/tests/manual/vectorimagetest/vectorimagemanager.h @@ -20,6 +20,7 @@ class VectorImageManager : public QObject Q_PROPERTY(QString currentDirectory READ currentDirectory WRITE setCurrentDirectory NOTIFY currentDirectoryChanged) Q_PROPERTY(QList<QUrl> sources READ sources NOTIFY sourcesChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) + Q_PROPERTY(bool looping READ looping WRITE setLooping NOTIFY loopingChanged) public: VectorImageManager(QObject *parent); ~VectorImageManager() override; @@ -57,8 +58,21 @@ public: qreal scale() const; + bool looping() const + { + return m_looping; + } + public slots: void setScale(int newScale); + void setLooping(bool looping) + { + if (m_looping == looping) + return; + + m_looping = looping; + emit loopingChanged(); + } signals: void currentSourceChanged(); @@ -69,6 +83,7 @@ signals: void currentDirectoryChanged(); void scaleChanged(); + void loopingChanged(); private: static VectorImageManager *g_manager; @@ -77,6 +92,7 @@ private: QString m_currentDirectory; QString m_qmlSource; qreal m_scale = 10.0; + bool m_looping = false; }; #endif // VECTORIMAGEMANAGER_H |