diff options
Diffstat (limited to 'tests')
6 files changed, 106 insertions, 0 deletions
diff --git a/tests/auto/qml/qmltyperegistrar/foreign/foreign.h b/tests/auto/qml/qmltyperegistrar/foreign/foreign.h index d5e5a060b4..dc9fbc84a8 100644 --- a/tests/auto/qml/qmltyperegistrar/foreign/foreign.h +++ b/tests/auto/qml/qmltyperegistrar/foreign/foreign.h @@ -30,6 +30,7 @@ #define FOREIGN_H #include <QtCore/qobject.h> +#include <QtCore/qsize.h> class Foreign : public QObject { @@ -49,4 +50,10 @@ private: int m_things = 0; }; +class SizeGadget : public QSize +{ + Q_GADGET + Q_PROPERTY(int height READ height WRITE setHeight FINAL) +}; + #endif // FOREIGN_H diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp index b3304963d8..1cfcd689c6 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp @@ -65,4 +65,14 @@ void tst_qmltyperegistrar::qmltypesHasFlags() QVERIFY(qmltypesData.contains("isFlag: true")); } +void tst_qmltyperegistrar::superAndForeignTypes() +{ + QVERIFY(qmltypesData.contains("values: [\"Pixel\", \"Centimeter\", \"Inch\", \"Point\"]")); + QVERIFY(qmltypesData.contains("name: \"SizeGadget\"")); + QVERIFY(qmltypesData.contains("prototype: \"SizeEnums\"")); + QVERIFY(qmltypesData.contains("Property { name: \"height\"; type: \"int\" }")); + QVERIFY(qmltypesData.contains("Property { name: \"width\"; type: \"int\" }")); + QVERIFY(qmltypesData.contains("Method { name: \"sizeToString\"; type: \"string\" }")); +} + QTEST_MAIN(tst_qmltyperegistrar) diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h index 07a28e1976..09485ab0b6 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h @@ -33,6 +33,35 @@ #include <QtQml/qqml.h> +class SizeEnums +{ + Q_GADGET + QML_NAMED_ELEMENT(SizeEnums) + QML_UNCREATABLE("Element is not creatable.") + +public: + enum Unit { Pixel, Centimeter, Inch, Point }; + Q_ENUM(Unit) +}; + +class SizeValueType : public SizeEnums +{ + QSize v; + Q_GADGET + Q_PROPERTY(int width READ width WRITE setWidth FINAL) + QML_NAMED_ELEMENT(MySize) + QML_FOREIGN(SizeGadget) + +public: + Q_INVOKABLE QString sizeToString() const + { + return QString::fromLatin1("%1x%2").arg(v.width()).arg(v.height()); + } + + int width() const { return v.width(); } + void setWidth(int width) { v.setWidth(width); } +}; + class Local : public Foreign { Q_OBJECT @@ -58,6 +87,7 @@ private slots: void qmltypesHasHppClassAndNoext(); void qmltypesHasFileNames(); void qmltypesHasFlags(); + void superAndForeignTypes(); private: QByteArray qmltypesData; diff --git a/tests/auto/quick/qquickanimations/data/opacityAnimationFromZero.qml b/tests/auto/quick/qquickanimations/data/opacityAnimationFromZero.qml new file mode 100644 index 0000000000..bfb8211706 --- /dev/null +++ b/tests/auto/quick/qquickanimations/data/opacityAnimationFromZero.qml @@ -0,0 +1,20 @@ +import QtQuick 2.14 +import QtQuick.Window 2.14 + +Window { + width: 640 + height: 480 + Rectangle { + id: rect + width: 200 + height: 200 + color: "black" + OpacityAnimator { + target: rect + from: 0 + to: 1 + duration: 1000 + running: true + } + } +} diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index e62d49ed6b..b4eb33eb7a 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -114,6 +114,7 @@ private slots: void replacingTransitions(); void animationJobSelfDestruction(); void fastFlickingBug(); + void opacityAnimationFromZero(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -1858,6 +1859,42 @@ void tst_qquickanimations::fastFlickingBug() } } +void tst_qquickanimations::opacityAnimationFromZero() +{ + if ((QGuiApplication::platformName() == QLatin1String("offscreen")) + || (QGuiApplication::platformName() == QLatin1String("minimal"))) + QSKIP("Skipping due to grabWindow not functional on offscreen/minimimal platforms"); + + // not easy to verify this in threaded render loop + // since it's difficult to capture the first frame when scene graph + // is renderred in another thread + qputenv("QSG_RENDER_LOOP", "basic"); + auto cleanup = qScopeGuard([]() { qputenv("QSG_RENDER_LOOP", ""); }); + + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("opacityAnimationFromZero.qml")); + QScopedPointer<QQuickWindow> win(qobject_cast<QQuickWindow*>(c.create())); + if (!c.errors().isEmpty()) + qDebug() << c.errorString(); + QVERIFY(win); + win->setTitle(QTest::currentTestFunction()); + win->show(); + QVERIFY(QTest::qWaitForWindowExposed(win.data())); + + QImage img; + bool firstFrameSwapped = false; + QObject::connect(win.get(), &QQuickWindow::frameSwapped, win.get(), [&win, &img, &firstFrameSwapped]() { + if (firstFrameSwapped) + return; + else + firstFrameSwapped = true; + img = win->grabWindow(); + if (img.width() < win->width()) + QSKIP("Skipping due to grabWindow not functional"); + }); + QTRY_VERIFY(!img.isNull() && img.pixel(100, 100) > qRgb(10, 10, 10)); +} + QTEST_MAIN(tst_qquickanimations) #include "tst_qquickanimations.moc" diff --git a/tests/auto/quick/qquicktext/BLACKLIST b/tests/auto/quick/qquicktext/BLACKLIST index 08a5249e2e..f50276a4f1 100644 --- a/tests/auto/quick/qquicktext/BLACKLIST +++ b/tests/auto/quick/qquicktext/BLACKLIST @@ -4,3 +4,5 @@ qemu macos [fontSizeMode] opensuse-42.1 +[hAlignVisual] +sles |