From 65e642f13d5e21d104806179b73dddfeb7b6dc81 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 4 May 2016 13:51:05 +0200 Subject: Make it possible to call some benchmark functions directly Some benchmarks - such as "elements" - rely on QQmlMetaType::qmlTypeNames(), which is implicitly populated when other benchmarks import for example QtQuick. However when calling them directly, the benchmark data set is much smaller. Therefore let's add QtQuick to the "base" set that is always available. Change-Id: I4b3696a426854195deb1c31ad24d80427da7b340 Reviewed-by: Robin Burchell --- tests/benchmarks/qml/creation/tst_creation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp index 4b985d00f1..38ab577120 100644 --- a/tests/benchmarks/qml/creation/tst_creation.cpp +++ b/tests/benchmarks/qml/creation/tst_creation.cpp @@ -100,6 +100,12 @@ public: tst_creation::tst_creation() { qmlRegisterType("Qt.test", 1, 0, "TestType"); + + // Ensure QtQuick is loaded and imported. Some benchmark like elements() rely on QQmlMetaType::qmlTypeNames() to + // be populated. + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\nItem{}", QUrl()); + QScopedPointer obj(component.create()); } inline QUrl TEST_FILE(const QString &filename) -- cgit v1.2.3 From 48492b2ee5d2f9ad178982f4c16e895b3083d8df Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 21 Apr 2016 14:14:08 +0200 Subject: QML: add librarymetrics_performance to the builds. Also make sure that we can easily deploy this test to devices by putting all data inside a qrc file. Change-Id: I175830fde51332b13068b163eba3d68c0535b712 Reviewed-by: Simon Hausmann --- .../qml/librarymetrics_performance/librarymetrics_performance.pro | 2 ++ .../qml/librarymetrics_performance/tst_librarymetrics_performance.cpp | 2 +- tests/benchmarks/qml/qml.pro | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/benchmarks/qml/librarymetrics_performance/librarymetrics_performance.pro b/tests/benchmarks/qml/librarymetrics_performance/librarymetrics_performance.pro index 3bedc0ea18..67f9d3b395 100644 --- a/tests/benchmarks/qml/librarymetrics_performance/librarymetrics_performance.pro +++ b/tests/benchmarks/qml/librarymetrics_performance/librarymetrics_performance.pro @@ -7,3 +7,5 @@ macx:CONFIG -= app_bundle CONFIG += release SOURCES += tst_librarymetrics_performance.cpp + +RESOURCES += data diff --git a/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp b/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp index a83c1479f2..ad72ebc6f0 100644 --- a/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp +++ b/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp @@ -119,7 +119,7 @@ tst_librarymetrics_performance::~tst_librarymetrics_performance() static QUrl testFileUrl(const char * filename) { - return QUrl::fromLocalFile(QString(QLatin1String(filename))); + return QUrl(QLatin1String("qrc:///") + QLatin1String(filename)); } void tst_librarymetrics_performance::metrics_data() diff --git a/tests/benchmarks/qml/qml.pro b/tests/benchmarks/qml/qml.pro index 7969866673..d3ce69c713 100644 --- a/tests/benchmarks/qml/qml.pro +++ b/tests/benchmarks/qml/qml.pro @@ -8,6 +8,7 @@ SUBDIRS += \ qqmlcomponent \ qqmlimage \ qqmlmetaproperty \ + librarymetrics_performance \ # script \ ### FIXME: doesn't build js -- cgit v1.2.3 From 70d30cb2b9b9253f52b6330287c102310e8a0707 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 22 Apr 2016 20:47:51 +0200 Subject: prune unused assignment Change-Id: Iecb1e9cd4d068660a96ba98480e92d9aa3981671 Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro | 1 - 1 file changed, 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro index 00c076d9cf..7cd63e0bfc 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro @@ -6,7 +6,6 @@ DESTDIR = ../imports/org/qtproject/AutoTestQmlPluginType.2 QT += core-private gui-private qml-private -IMPORT_DIR = DESTDIR IMPORT_FILES = \ qmldir -- cgit v1.2.3 From 578d2717196cdf109d459c7a63b5085dc0791747 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 22 Apr 2016 20:47:58 +0200 Subject: make use of COPIES Change-Id: I479c9523a89be1d64364e8205daa5860e16882cc Reviewed-by: Simon Hausmann --- tests/auto/shared/imports.pri | 9 +++------ tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro | 8 +++----- tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro | 8 +++----- tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro | 8 +++----- 4 files changed, 12 insertions(+), 21 deletions(-) (limited to 'tests') diff --git a/tests/auto/shared/imports.pri b/tests/auto/shared/imports.pri index 20e9bcb371..9cbf286386 100644 --- a/tests/auto/shared/imports.pri +++ b/tests/auto/shared/imports.pri @@ -1,7 +1,4 @@ -copyimportfiles.input = IMPORT_FILES -copyimportfiles.output = $$DESTDIR/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT} -copyimportfiles.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} -copyimportfiles.CONFIG += no_link_no_clean -copyimportfiles.variable_out = PRE_TARGETDEPS -QMAKE_EXTRA_COMPILERS += copyimportfiles +importfiles.files = $$IMPORT_FILES +importfiles.path = $$DESTDIR +COPIES += importfiles diff --git a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro b/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro index 3e690d389f..81975ee01c 100644 --- a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro +++ b/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro @@ -18,11 +18,9 @@ HEADERS += \ DISTFILES = qmldir !equals(_PRO_FILE_PWD_, $$OUT_PWD) { - copy_qmldir.target = $$OUT_PWD/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir - copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target + cpqmldir.files = qmldir + cpqmldir.path = $$OUT_PWD + COPIES += cpqmldir } qmldir.files = qmldir diff --git a/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro b/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro index fe9caea13a..1033c7a28f 100644 --- a/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro +++ b/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro @@ -18,11 +18,9 @@ HEADERS += \ DISTFILES = qmldir !equals(_PRO_FILE_PWD_, $$OUT_PWD) { - copy_qmldir.target = $$OUT_PWD/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir - copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target + cpqmldir.files = qmldir + cpqmldir.path = $$OUT_PWD + COPIES += cpqmldir } qmldir.files = qmldir diff --git a/tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro b/tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro index 951f886368..d59470862d 100644 --- a/tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro +++ b/tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro @@ -18,11 +18,9 @@ HEADERS += \ DISTFILES = qmldir !equals(_PRO_FILE_PWD_, $$OUT_PWD) { - copy_qmldir.target = $$OUT_PWD/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir - copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target + cpqmldir.files = qmldir + cpqmldir.path = $$OUT_PWD + COPIES += cpqmldir } qmldir.files = qmldir -- cgit v1.2.3 From 3cdf72a7b53e189ad5ff67536a0c55eec04ebe6b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 3 May 2016 13:16:32 +0200 Subject: adjust example naming convention test to "new" structure Change-Id: I42ec26bd3c2ffa32ae8c5323f7c0a0343d12ce2f Reviewed-by: Simon Hausmann --- tests/auto/quick/examples/tst_examples.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 90c78ec942..fe1991772d 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -83,11 +83,11 @@ tst_examples::tst_examples() excludedFiles << "snippets/qml/listmodel/listmodel.qml"; //Just a ListModel, no root QQuickItem excludedFiles << "examples/quick/demos/photosurface/photosurface.qml"; // root item is Window rather than Item - // Add directories you want excluded here (don't add examples/, because they install to examples/qtdeclarative/) + // Add directories you want excluded here excludedDirs << "shared"; //Not an example excludedDirs << "quick/text/fonts"; // QTBUG-29004 excludedDirs << "snippets/qml/path"; //No root QQuickItem - excludedDirs << "tutorials/gettingStartedQml"; //C++ example, but no cpp files in root dir + excludedDirs << "examples/quick/tutorials/gettingStartedQml"; //C++ example, but no cpp files in root dir // These snippets are not expected to run on their own. excludedDirs << "snippets/qml/visualdatamodel_rootindex"; @@ -175,9 +175,8 @@ void tst_examples::namingConvention(const QDir &d) void tst_examples::namingConvention() { QStringList examplesLocations; - examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qtdeclarative"); - examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qtquick"); - examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qtqml"); + examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qml"); + examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/quick"); foreach(const QString &examples, examplesLocations) { QDir d(examples); -- cgit v1.2.3 From 83d3611199ee1e4814ed94a16c9d3f9db9c3ce89 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 3 May 2016 18:31:32 +0200 Subject: remove blacklisting of tiger and fonts examples the associated bugs are marked as fixed for a long time. Change-Id: If8c8710bdf4b7b1962c9749b701cbd335d938fdb Reviewed-by: Simon Hausmann --- tests/auto/quick/examples/tst_examples.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index fe1991772d..4111f42d58 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -79,13 +79,11 @@ private: tst_examples::tst_examples() { // Add files to exclude here - excludedFiles << "examples/quick/canvas/tiger/tiger.qml"; // QTBUG-26528 excludedFiles << "snippets/qml/listmodel/listmodel.qml"; //Just a ListModel, no root QQuickItem excludedFiles << "examples/quick/demos/photosurface/photosurface.qml"; // root item is Window rather than Item // Add directories you want excluded here excludedDirs << "shared"; //Not an example - excludedDirs << "quick/text/fonts"; // QTBUG-29004 excludedDirs << "snippets/qml/path"; //No root QQuickItem excludedDirs << "examples/quick/tutorials/gettingStartedQml"; //C++ example, but no cpp files in root dir -- cgit v1.2.3 From 61c8539e2a3979f5ac30ea04a7c748877eb745f3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 3 May 2016 19:09:08 +0200 Subject: blacklist the qmlextensionplugins example for testing it requires a special import search path. it would be possible to hack this into the test launcher, but that doesn't seem worth it (there are other plugin examples already). Change-Id: I147b802c690933803cb8f9cf35210618957a6998 Reviewed-by: Simon Hausmann --- tests/auto/quick/examples/tst_examples.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 4111f42d58..20031c24d9 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -85,6 +85,7 @@ tst_examples::tst_examples() // Add directories you want excluded here excludedDirs << "shared"; //Not an example excludedDirs << "snippets/qml/path"; //No root QQuickItem + excludedDirs << "examples/qml/qmlextensionplugins"; //Requires special import search path excludedDirs << "examples/quick/tutorials/gettingStartedQml"; //C++ example, but no cpp files in root dir // These snippets are not expected to run on their own. -- cgit v1.2.3 From 064dc6a29b09fa3bc7c57ed3f443befda510663f Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 13 May 2016 17:50:05 +0200 Subject: QQuickTextInput: Remove redundant centerPoint calculations. The default is to press/release in the center of the window, so we don't need to DIY. Change-Id: Id65b2b54c15d45e8d780a008d05275718f519a71 Reviewed-by: Friedemann Kleint --- .../quick/qquicktextinput/tst_qquicktextinput.cpp | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index ce90e4c60a..70d3906ff3 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -3409,16 +3409,15 @@ void tst_qquicktextinput::focusOnPress() QCOMPARE(textInputObject->hasFocus(), false); QCOMPARE(textInputObject->hasActiveFocus(), false); - QPoint centerPoint(window.width()/2, window.height()/2); Qt::KeyboardModifiers noModifiers = 0; - QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint); + QTest::mousePress(&window, Qt::LeftButton, noModifiers); QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), true); QCOMPARE(textInputObject->hasActiveFocus(), true); QCOMPARE(focusSpy.count(), 1); QCOMPARE(activeFocusSpy.count(), 1); QCOMPARE(textInputObject->selectedText(), QString()); - QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint); + QTest::mouseRelease(&window, Qt::LeftButton, noModifiers); textInputObject->setFocusOnPress(false); QCOMPARE(textInputObject->focusOnPress(), false); @@ -3432,13 +3431,13 @@ void tst_qquicktextinput::focusOnPress() // Wait for double click timeout to expire before clicking again. QTest::qWait(400); - QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint); + QTest::mousePress(&window, Qt::LeftButton, noModifiers); QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), false); QCOMPARE(textInputObject->hasActiveFocus(), false); QCOMPARE(focusSpy.count(), 2); QCOMPARE(activeFocusSpy.count(), 2); - QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint); + QTest::mouseRelease(&window, Qt::LeftButton, noModifiers); textInputObject->setFocusOnPress(true); QCOMPARE(textInputObject->focusOnPress(), true); @@ -3448,14 +3447,14 @@ void tst_qquicktextinput::focusOnPress() textInputObject->setProperty("selectOnFocus", true); QTest::qWait(400); - QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint); + QTest::mousePress(&window, Qt::LeftButton, noModifiers); QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), true); QCOMPARE(textInputObject->hasActiveFocus(), true); QCOMPARE(focusSpy.count(), 3); QCOMPARE(activeFocusSpy.count(), 3); QCOMPARE(textInputObject->selectedText(), textInputObject->text()); - QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint); + QTest::mouseRelease(&window, Qt::LeftButton, noModifiers); } void tst_qquicktextinput::openInputPanel() @@ -3479,23 +3478,22 @@ void tst_qquicktextinput::openInputPanel() QCOMPARE(qApp->inputMethod()->isVisible(), false); // input panel should open on focus - QPoint centerPoint(view.width()/2, view.height()/2); Qt::KeyboardModifiers noModifiers = 0; - QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); + QTest::mousePress(&view, Qt::LeftButton, noModifiers); QGuiApplication::processEvents(); QVERIFY(input->hasActiveFocus()); QCOMPARE(qApp->focusObject(), input); QCOMPARE(qApp->inputMethod()->isVisible(), true); - QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); + QTest::mouseRelease(&view, Qt::LeftButton, noModifiers); // input panel should be re-opened when pressing already focused TextInput qApp->inputMethod()->hide(); QCOMPARE(qApp->inputMethod()->isVisible(), false); QVERIFY(input->hasActiveFocus()); - QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); + QTest::mousePress(&view, Qt::LeftButton, noModifiers); QGuiApplication::processEvents(); QCOMPARE(qApp->inputMethod()->isVisible(), true); - QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); + QTest::mouseRelease(&view, Qt::LeftButton, noModifiers); // input panel should stay visible if focus is lost to another text inputor QSignalSpy inputPanelVisibilitySpy(qApp->inputMethod(), SIGNAL(visibleChanged())); @@ -3518,8 +3516,8 @@ void tst_qquicktextinput::openInputPanel() input->setReadOnly(true); input->setFocus(true); QCOMPARE(qApp->inputMethod()->isVisible(), false); - QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); - QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); + QTest::mousePress(&view, Qt::LeftButton, noModifiers); + QTest::mouseRelease(&view, Qt::LeftButton, noModifiers); QGuiApplication::processEvents(); QCOMPARE(qApp->inputMethod()->isVisible(), false); @@ -3528,8 +3526,8 @@ void tst_qquicktextinput::openInputPanel() input->setFocus(false); input->setFocus(true); QCOMPARE(qApp->inputMethod()->isVisible(), false); - QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); - QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); + QTest::mousePress(&view, Qt::LeftButton, noModifiers); + QTest::mouseRelease(&view, Qt::LeftButton, noModifiers); QCOMPARE(qApp->inputMethod()->isVisible(), false); } -- cgit v1.2.3 From 87cf6b7ae7fbaf61595311d04c7e2e99a124e3c6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 11 May 2016 17:57:26 +0200 Subject: standardize on QT_CONFIG debug_and_release instead of build_all the two flags are equivalent. use the same one everywhere. Change-Id: I9ac0caad5a9a8d37813f8de4d81067e20656abc5 Reviewed-by: Joerg Bornemann --- tests/auto/qmldevtools/compile/compile.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qmldevtools/compile/compile.pro b/tests/auto/qmldevtools/compile/compile.pro index 0ed113a031..819289f5f7 100644 --- a/tests/auto/qmldevtools/compile/compile.pro +++ b/tests/auto/qmldevtools/compile/compile.pro @@ -5,7 +5,7 @@ force_bootstrap { !build_pass: CONFIG += release } else { QT = core - !build_pass:contains(QT_CONFIG, build_all): CONFIG += release + !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release } QT += qmldevtools-private macx:CONFIG -= app_bundle -- cgit v1.2.3 From 6371b208a9e55845090dcd34234e314c6587c105 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 17 May 2016 15:18:12 +0200 Subject: Revert "Remove this piece of code" This reverts commit bad007360a0f6fba304d8f4c99826a1250fd886c. The lookup in the global object is necessary to detect whether we've seen any unresolved properties. This is used for the optimization of skipping binding refresh updates when a context property changes. Task-number: QTBUG-53431 Change-Id: Idb39a32e4b58b915496bbb9d8a098dc17a6f688a Reviewed-by: Lars Knoll --- tests/auto/qml/qqmlcontext/data/qtbug_53431.qml | 7 +++++++ tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/auto/qml/qqmlcontext/data/qtbug_53431.qml (limited to 'tests') diff --git a/tests/auto/qml/qqmlcontext/data/qtbug_53431.qml b/tests/auto/qml/qqmlcontext/data/qtbug_53431.qml new file mode 100644 index 0000000000..2ceee2bade --- /dev/null +++ b/tests/auto/qml/qqmlcontext/data/qtbug_53431.qml @@ -0,0 +1,7 @@ +import QtQml 2.0 +QtObject { + property int value: { + console.log("lookup in global object") + return 1 + } +} diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp index 18ef7ac31d..d338e6f5ad 100644 --- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp +++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp @@ -61,6 +61,7 @@ private slots: void refreshExpressions(); void refreshExpressionsCrash(); void refreshExpressionsRootContext(); + void skipExpressionRefresh_qtbug_53431(); void qtbug_22535(); void evalAfterInvalidate(); @@ -642,6 +643,19 @@ void tst_qqmlcontext::refreshExpressionsRootContext() delete o1; } +void tst_qqmlcontext::skipExpressionRefresh_qtbug_53431() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("qtbug_53431.qml")); + QScopedPointer object(component.create(0)); + QVERIFY(!object.isNull()); + QCOMPARE(object->property("value").toInt(), 1); + object->setProperty("value", 10); + QCOMPARE(object->property("value").toInt(), 10); + engine.rootContext()->setContextProperty("randomContextProperty", 42); + QCOMPARE(object->property("value").toInt(), 10); +} + void tst_qqmlcontext::qtbug_22535() { QQmlEngine engine; -- cgit v1.2.3 From 72515ebe5a63c201fde09471bc646dbe15110a6b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 11 May 2016 15:22:51 +0200 Subject: Fix crashes when incubating objects asynchronously with initial properties This is a regression from commit 94e337fa95425d259e81b4d21f4d0853108553bd where we accidentally ended up not having a calling QML context set anymore when initializing the properties on newly incubated objects as provided by the caller. The QML context is necessary as for example when we set a URL property, the URL can be relative and it will be resolved to the base url of the context when written, such as in in QQmlPropertyPrivate::write. Change-Id: I1d896381fc92f653a7d76f4d82174bca48828f5e Reviewed-by: Lars Knoll --- .../qml/qqmlcomponent/data/callingQmlContext.qml | 13 +++++ .../data/callingQmlContextComponent.qml | 3 ++ tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp | 59 ++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 tests/auto/qml/qqmlcomponent/data/callingQmlContext.qml create mode 100644 tests/auto/qml/qqmlcomponent/data/callingQmlContextComponent.qml (limited to 'tests') diff --git a/tests/auto/qml/qqmlcomponent/data/callingQmlContext.qml b/tests/auto/qml/qqmlcomponent/data/callingQmlContext.qml new file mode 100644 index 0000000000..8193d0f36c --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/callingQmlContext.qml @@ -0,0 +1,13 @@ +import QtQml 2.0 +import qqmlcomponenttest 1.0 +QtObject { + property Component factory + property QtObject incubatedObject + + Component.onCompleted: { + var incubatorState = factory.incubateObject(null, { value: 42 }) + incubatorState.onStatusChanged = function(status) { + incubatedObject = incubatorState.object + } + } +} diff --git a/tests/auto/qml/qqmlcomponent/data/callingQmlContextComponent.qml b/tests/auto/qml/qqmlcomponent/data/callingQmlContextComponent.qml new file mode 100644 index 0000000000..adf491c87e --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/callingQmlContextComponent.qml @@ -0,0 +1,3 @@ +import qqmlcomponenttest 1.0 +CallingContextCheckingClass { +} diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index 85579a6019..680ea720a8 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include "../../shared/util.h" #include "testhttpserver.h" @@ -116,6 +117,7 @@ private slots: void onDestructionCount(); void recursion(); void recursionContinuation(); + void callingContextForInitialProperties(); private: QQmlEngine engine; @@ -523,6 +525,63 @@ void tst_qqmlcomponent::recursionContinuation() QVERIFY(object->property("success").toBool()); } +class CallingContextCheckingClass : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) +public: + CallingContextCheckingClass() + : m_value(0) + {} + + int value() const { return m_value; } + void setValue(int v) { + scopeObject.clear(); + callingContextData.setContextData(0); + + m_value = v; + QJSEngine *jsEngine = qjsEngine(this); + if (!jsEngine) + return; + QV4::ExecutionEngine *v4 = QV8Engine::getV4(jsEngine); + if (!v4) + return; + QV4::Scope scope(v4); + QV4::Scoped qmlContext(scope, v4->qmlContext()); + if (!qmlContext) + return; + callingContextData = qmlContext->qmlContext(); + scopeObject = qmlContext->qmlScope(); + } + + int m_value; + QQmlGuardedContextData callingContextData; + QPointer scopeObject; +}; + +void tst_qqmlcomponent::callingContextForInitialProperties() +{ + qmlRegisterType("qqmlcomponenttest", 1, 0, "CallingContextCheckingClass"); + + QQmlComponent testFactory(&engine, testFileUrl("callingQmlContextComponent.qml")); + + QQmlComponent component(&engine, testFileUrl("callingQmlContext.qml")); + QScopedPointer root(component.beginCreate(engine.rootContext())); + QVERIFY(!root.isNull()); + root->setProperty("factory", QVariant::fromValue(&testFactory)); + component.completeCreate(); + QTRY_VERIFY(qvariant_cast(root->property("incubatedObject"))); + QObject *o = qvariant_cast(root->property("incubatedObject")); + CallingContextCheckingClass *checker = qobject_cast(o); + QVERIFY(checker); + + QVERIFY(!checker->callingContextData.isNull()); + QVERIFY(checker->callingContextData->urlString().endsWith(QStringLiteral("callingQmlContext.qml"))); + + QVERIFY(!checker->scopeObject.isNull()); + QVERIFY(checker->scopeObject->metaObject()->indexOfProperty("incubatedObject") != -1); +} + QTEST_MAIN(tst_qqmlcomponent) #include "tst_qqmlcomponent.moc" -- cgit v1.2.3 From afd01a7341df6ab5629469d9b55ab4f1b195cff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kari=20Hautam=C3=A4ki?= Date: Mon, 20 Apr 2015 15:05:59 +0300 Subject: Don't render when width is zero and elide is not None Works now similarly as with very small text lengths (smaller than elide characted length). Change-Id: I0c4aafbcc50343bb0ec8b5f335045e1048a499fd Task-number: QTBUG-34990 Reviewed-by: Frederik Gladhorn --- tests/auto/quick/qquicktext/data/ellipsisText.qml | 17 +++++++++++++++++ tests/auto/quick/qquicktext/tst_qquicktext.cpp | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/auto/quick/qquicktext/data/ellipsisText.qml (limited to 'tests') diff --git a/tests/auto/quick/qquicktext/data/ellipsisText.qml b/tests/auto/quick/qquicktext/data/ellipsisText.qml new file mode 100644 index 0000000000..37faafcbf3 --- /dev/null +++ b/tests/auto/quick/qquicktext/data/ellipsisText.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 + +Text { + width: 0 + height: 10 + text: "Meaningless text" + elide: Text.ElideRight + + Text { + objectName: "elidedRef" + width: 10 + height: 10 + text: "Meaningless text" + elide: Text.ElideRight + } +} + diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 46ec099501..d0fc36936a 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -147,6 +147,9 @@ private slots: void padding(); + void zeroWidthAndElidedDoesntRender(); + + private: QStringList standard; QStringList richText; @@ -4146,6 +4149,26 @@ void tst_qquicktext::padding() delete root; } +void tst_qquicktext::zeroWidthAndElidedDoesntRender() +{ + // Tests QTBUG-34990 + + QQmlComponent component(&engine, testFile("ellipsisText.qml")); + + QScopedPointer object(component.create()); + + QQuickText *text = qobject_cast(object.data()); + QVERIFY(text); + + QCOMPARE(text->contentWidth(), 0.0); + + QQuickText *reference = text->findChild("elidedRef"); + QVERIFY(reference); + + text->setWidth(10); + QCOMPARE(text->contentWidth(), reference->contentWidth()); +} + QTEST_MAIN(tst_qquicktext) #include "tst_qquicktext.moc" -- cgit v1.2.3 From 607320ca9fb2796a5f6f2578578fd314f7e8b99e Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 23 Mar 2016 13:17:10 +0100 Subject: V4: allow inlining of ExecutionEngine::{qml,js}Engine() All other changes are just to be able to include qv8engine_p.h in qv4engine_p.h Change-Id: I71ba2ec42cdc20d5c7d97a74b99b4d1ada1a5ed8 Reviewed-by: Simon Hausmann --- tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp | 2 ++ tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp | 2 ++ 2 files changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp index 1b2df62b76..3f89913f3b 100644 --- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp @@ -39,6 +39,8 @@ #include #include #include +#include +#include using namespace QV4; using namespace QV4::Debugging; diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index 83bf783cf4..723f575330 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -36,6 +36,8 @@ #include #include #include +#include +#include #include #include "../../shared/util.h" #include "testhttpserver.h" -- cgit v1.2.3 From 70c536b0473529710d36f32e516e6d962a0cb3dc Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 23 May 2016 14:39:01 +0200 Subject: Get rid of QQmlVMEMetaData::AliasData The remaining signal index for the changed signal of the alias target is something that we need only once (when doing the initial alias endpoint connection) and then we can retrieve it from the property cache. Change-Id: Ifbd4625f9af3ca00c9b916eee5c82f58450d54ef Reviewed-by: Lars Knoll --- tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 98a97ebd66..8f1b84940e 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -4134,7 +4134,6 @@ void tst_qqmllanguage::earlyIdObjectAccess() void tst_qqmllanguage::dataAlignment() { QVERIFY(sizeof(QQmlVMEMetaData) % sizeof(int) == 0); - QVERIFY(sizeof(QQmlVMEMetaData::AliasData) % sizeof(int) == 0); } void tst_qqmllanguage::deleteSingletons() -- cgit v1.2.3 From a6814650232825663f33fe4f11a362c397385350 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 23 May 2016 15:20:29 +0200 Subject: Get rid of QQmlVMEMetaData It is unused now and we can remove it as well as its QByteArray based storage. The non-emptyness of the meta-data QByteArray was also used to indicate whether it is necessary to create a VME meta-object when instantiating an object. This bit is now folded into the flag of the QFlagPointer storing the property caches. Change-Id: I3c3604c61ff16a4e76912e68b1c19afdb0f2bd9d Reviewed-by: Lars Knoll --- tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'tests') diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 8f1b84940e..5bb129fbb8 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -248,8 +248,6 @@ private slots: void earlyIdObjectAccess(); - void dataAlignment(); - void deleteSingletons(); void arrayBuffer_data(); @@ -4131,11 +4129,6 @@ void tst_qqmllanguage::earlyIdObjectAccess() QVERIFY(o->property("success").toBool()); } -void tst_qqmllanguage::dataAlignment() -{ - QVERIFY(sizeof(QQmlVMEMetaData) % sizeof(int) == 0); -} - void tst_qqmllanguage::deleteSingletons() { QPointer singleton; -- cgit v1.2.3