From 2c860b9c4de8a1f423a1a6c10a3460552e959d95 Mon Sep 17 00:00:00 2001 From: Alan Alpert <416365416c@gmail.com> Date: Mon, 30 Mar 2015 18:06:44 -0700 Subject: Remove testing of active window change on hide We don't actually control where the window manager assigns focus if the currently active window is hidden, so don't test for specific behavior. We can now remove the blacklist entry for this test. Change-Id: Ie09fc91c6317f6bb2d4b91000641ef241556fddf Reviewed-by: Frederik Gladhorn --- tests/auto/quick/qquickwindow/BLACKLIST | 2 -- tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 8 -------- 2 files changed, 10 deletions(-) delete mode 100644 tests/auto/quick/qquickwindow/BLACKLIST (limited to 'tests') diff --git a/tests/auto/quick/qquickwindow/BLACKLIST b/tests/auto/quick/qquickwindow/BLACKLIST deleted file mode 100644 index 1201ef12f0..0000000000 --- a/tests/auto/quick/qquickwindow/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[testWindowVisibilityOrder] -osx diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 7c94cf6d17..f638505c72 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -1716,14 +1716,6 @@ void tst_qquickwindow::testWindowVisibilityOrder() QTest::qWaitForWindowExposed(window5); QVERIFY(window4->isVisible()); QVERIFY(window5->isVisible()); - window4->hide(); - window5->hide(); - - window3->hide(); - QTRY_COMPARE(window2 == QGuiApplication::focusWindow(), true); - - window2->hide(); - QTRY_COMPARE(window1 == QGuiApplication::focusWindow(), true); } void tst_qquickwindow::blockClosing() -- cgit v1.2.3 From 8b205fd05dcdc4a0e7ec6b25429f691a0a9099fe Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 27 May 2015 10:52:59 +0200 Subject: Improve support for HTML entities in StyledText This adds support for the non-breaking space character ( ) and properly handling entities that do not end with a semicolon, such as a stray ampersand in a text. Change-Id: I2f157c9aa651b27511809d5a47ac07660949a290 Task-number: QTBUG-44869 Task-number: QTBUG-31816 Task-number: QTBUG-33368 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp index b76218edb9..816440b191 100644 --- a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp +++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp @@ -153,6 +153,8 @@ void tst_qquickstyledtext::textOutput_data() QTest::newRow("space trailing bold") << "this is bold " << "this is bold " << (FormatList() << Format(Format::Bold, 8, 5)) << false; QTest::newRow("img") << "ab" << "a b" << FormatList() << false; QTest::newRow("tag mix") << "dsgfhghjdfgdfgewrqjklhj" << "dsgfhghjdfgdfgewrqjklhj" << (FormatList() << Format(Format::Bold, 2, 3)) << false; + QTest::newRow("named html entities") << "> < & "  " << QLatin1String("> < & \" ") + QChar(QChar::Nbsp) << FormatList() << false; + QTest::newRow("invalid html entities") << "a &hello & a &goodbye;" << "a &hello & a " << FormatList() << false; } void tst_qquickstyledtext::textOutput() -- cgit v1.2.3 From eeee9f1466ffaf17f81d635c2e43dca76ce5b021 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Fri, 3 Jul 2015 10:55:35 +0200 Subject: QSGSimpleTextureNode: Fix ownership of QSGTexture Make sure the QSGSimpleTextureNode deletes the old QSGTexture if a new one is set via setTexture() and the ownsTexture flag is true. [ChangeLog][QtQuick][SceneGraph] QSGSimpleTextureNode will now delete the currently set QSGTexture object, if a new QSGTexture is set and the ownsTexture flag is on. Change-Id: Iabfbccd390e16948d4575baf29e6c8b4a184a404 Reviewed-by: Gunnar Sletta --- tests/auto/quick/nodes/tst_nodestest.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index b49ce34951..c49f01d5a7 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -283,7 +283,7 @@ void NodesTest::textureNodeTextureOwnership() QVERIFY(!texture.isNull()); } - { // Check that it is deleted when we so desire + { // Check that it is deleted on destruction when we so desire QPointer texture(new QSGPlainTexture()); QSGSimpleTextureNode *tn = new QSGSimpleTextureNode(); @@ -294,6 +294,25 @@ void NodesTest::textureNodeTextureOwnership() delete tn; QVERIFY(texture.isNull()); } + + { // Check that it is deleted on update when we so desire + QPointer oldTexture(new QSGPlainTexture()); + QPointer newTexture(new QSGPlainTexture()); + + QSGSimpleTextureNode *tn = new QSGSimpleTextureNode(); + tn->setOwnsTexture(true); + QVERIFY(tn->ownsTexture()); + + tn->setTexture(oldTexture); + QVERIFY(!oldTexture.isNull()); + QVERIFY(!newTexture.isNull()); + + tn->setTexture(newTexture); + QVERIFY(oldTexture.isNull()); + QVERIFY(!newTexture.isNull()); + + delete tn; + } } void NodesTest::textureNodeRect() -- cgit v1.2.3 From 6a21d5e36771bdd3e8b5915402e5cbe663469aba Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 15 Jul 2015 10:24:53 +0300 Subject: Test if the state machine reacts to a QObject signal. Change-Id: I4987e10ac0b31977249ce9ebe00e26de334db30d Reviewed-by: Simon Hausmann --- tests/auto/qml/qml.pro | 3 +- tests/auto/qml/qqmlstatemachine/data/cppsignal.qml | 70 ++++++++++++ .../auto/qml/qqmlstatemachine/qqmlstatemachine.pro | 11 ++ .../qml/qqmlstatemachine/tst_qqmlstatemachine.cpp | 118 +++++++++++++++++++++ 4 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 tests/auto/qml/qqmlstatemachine/data/cppsignal.qml create mode 100644 tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro create mode 100644 tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp (limited to 'tests') diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index a5c3211f0d..430a90b800 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -25,7 +25,8 @@ PUBLICTESTS += \ qtqmlmodules \ qquickfolderlistmodel \ qqmlapplicationengine \ - qqmlsettings + qqmlsettings \ + qqmlstatemachine PRIVATETESTS += \ animation \ diff --git a/tests/auto/qml/qqmlstatemachine/data/cppsignal.qml b/tests/auto/qml/qqmlstatemachine/data/cppsignal.qml new file mode 100644 index 0000000000..3d06d823e2 --- /dev/null +++ b/tests/auto/qml/qqmlstatemachine/data/cppsignal.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Ford Motor Company +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQml 2.0 + +import QtQml.StateMachine 1.0 + +import CppObjectEnum 1.0 + +StateMachine { + id: stateMachine + initialState: state0 + + State { + id: state0 + SignalTransition { + targetState: state1 + signal: _cppObject.mySignal + // signalState is mySignal's parameter + guard: signalState === CppObject.State1 + } + } + + State { + id: state1 + SignalTransition { + targetState: state2 + signal: _cppObject.mySignal + // signalState is mySignal's parameter + guard: signalState === CppObject.State2 + } + onEntered: _cppObject.objectState = CppObject.State1 + } + + FinalState { + id: state2 + onEntered: _cppObject.objectState = CppObject.State2 + } + Component.onCompleted: stateMachine.running = true +} diff --git a/tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro b/tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro new file mode 100644 index 0000000000..002af1d707 --- /dev/null +++ b/tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro @@ -0,0 +1,11 @@ +CONFIG += testcase +TARGET = tst_qqmlstatemachine +osx:CONFIG -= app_bundle + +SOURCES += tst_qqmlstatemachine.cpp + +include (../../shared/util.pri) + +CONFIG += parallel_test +QT += core-private gui-private qml-private quick-private gui testlib +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp new file mode 100644 index 0000000000..0d36b66e3f --- /dev/null +++ b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Ford Motor Company +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include +#include "../../shared/util.h" + +class tst_qqmlstatemachine : public QQmlDataTest +{ + Q_OBJECT +public: + tst_qqmlstatemachine(); + +private slots: + void tst_cppObjectSignal(); +}; + + +class CppObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(ObjectState objectState READ objectState WRITE setObjectState NOTIFY objectStateChanged) + Q_ENUMS(ObjectState) +public: + enum ObjectState { + State0, + State1, + State2 + }; + +public: + CppObject() + : QObject() + , m_objectState(State0) + {} + + ObjectState objectState() const { return m_objectState; } + void setObjectState(ObjectState objectState) { m_objectState = objectState; emit objectStateChanged();} + +signals: + void objectStateChanged(); + void mySignal(int signalState); + +private: + ObjectState m_objectState; +}; + +tst_qqmlstatemachine::tst_qqmlstatemachine() +{ + QVERIFY(-1 != qmlRegisterUncreatableType("CppObjectEnum", 1, 0, "CppObject", QString())); +} + +void tst_qqmlstatemachine::tst_cppObjectSignal() +{ + CppObject cppObject; + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("cppsignal.qml")); + QVERIFY(!component.isError()); + + QQmlContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("_cppObject", &cppObject); + QScopedPointer rootObject(component.create()); + QVERIFY(rootObject != 0); + + // wait for state machine to start + QTRY_VERIFY(rootObject->property("running").toBool()); + + // emit signal from cpp + emit cppObject.mySignal(CppObject::State1); + + // check if the signal was propagated + QTRY_COMPARE(cppObject.objectState(), CppObject::State1); + + // emit signal from cpp + emit cppObject.mySignal(CppObject::State2); + + // check if the signal was propagated + QTRY_COMPARE(cppObject.objectState(), CppObject::State2); + + // wait for state machine to finish + QTRY_VERIFY(!rootObject->property("running").toBool()); +} + + +QTEST_MAIN(tst_qqmlstatemachine) + +#include "tst_qqmlstatemachine.moc" -- cgit v1.2.3 From a169d310e4ecf54ce3577ae46cfc45eb9d308a13 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 15 Jul 2015 15:04:20 +0200 Subject: Doc: replace Mac OS X with OS X Task-number: QTBUG-40759 Change-Id: If21b4551eb95af3370cc21edd7a6721fc06e1346 Reviewed-by: Martin Smith --- .../auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml | 2 +- tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml index 87cba880af..cd0f95bc7a 100644 --- a/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml +++ b/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml @@ -24,7 +24,7 @@ Rectangle { name:"AnimationController" when:windowShown function test_parallelAnimation_data() { - //FIXME:the commented lines fail on MAC OS X + //FIXME:the commented lines fail on OS X return [ {tag:"0.1",progress:0.1, x:5, y:10, color:"#e50019", width:14, height:14}, //{tag:"0.2",progress:0.2, x:10, y:20, color:"#cb0033", width:18, height:18}, diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 88cac92864..d87054ac9e 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -2417,7 +2417,7 @@ void tst_qquicktextinput::navigation() simulateKey(&window, Qt::Key_Left); QVERIFY(input->hasActiveFocus() == true); - // Up and Down should NOT do Home/End, even on Mac OS X (QTBUG-10438). + // Up and Down should NOT do Home/End, even on OS X (QTBUG-10438). input->setCursorPosition(2); QCOMPARE(input->cursorPosition(),2); simulateKey(&window, Qt::Key_Up); -- cgit v1.2.3 From 2d8bf9eed72cff041a235160fe14a7f424475610 Mon Sep 17 00:00:00 2001 From: Nobuaki Sukegawa Date: Tue, 14 Jul 2015 01:04:20 +0900 Subject: Fix trivial bug where ArrayBuffer.isView never returned false Change-Id: I168d2ec54997d057e3d32463c2b153df38073838 Reviewed-by: Simon Hausmann --- tests/manual/v4/typedarrays.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/manual/v4/typedarrays.js b/tests/manual/v4/typedarrays.js index d7a863e573..d52fd6bab0 100644 --- a/tests/manual/v4/typedarrays.js +++ b/tests/manual/v4/typedarrays.js @@ -67,6 +67,15 @@ function assertArrayEquals(a, b) assertEquals(a[i], b[i]) } +function TestIsViewFalse() { + assertTrue(!ArrayBuffer.isView()); + assertTrue(!ArrayBuffer.isView(42)); + assertTrue(!ArrayBuffer.isView('foo')); + assertTrue(!ArrayBuffer.isView(new ArrayBuffer())); +} + +TestIsViewFalse(); + function TestByteLength(param, expectedByteLength) { var ab = new ArrayBuffer(param); assertSame(expectedByteLength, ab.byteLength); -- cgit v1.2.3 From 71c357e416c37c7b7d7cd2efa95635018bd105f5 Mon Sep 17 00:00:00 2001 From: Sune Vuorela Date: Thu, 16 Jul 2015 20:36:31 +0200 Subject: Let unit tests pass if xmlpatterns is not around The blacklist for xmlpatterns tests is not applied unless xmlpatterns specifically has been disabled, but code builds anyways. Fix up the blacklist. Change-Id: I013701e787e8ec28f1282a911270dd7a158d6f01 Reviewed-by: Simon Hausmann --- tests/auto/quick/examples/examples.pro | 2 ++ tests/auto/quick/examples/tst_examples.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/quick/examples/examples.pro b/tests/auto/quick/examples/examples.pro index 6543aa1b2b..3d821fc13d 100644 --- a/tests/auto/quick/examples/examples.pro +++ b/tests/auto/quick/examples/examples.pro @@ -10,3 +10,5 @@ CONFIG += parallel_test #temporary QT += core-private gui-private qml-private quick-private testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +!qtHaveModule(xmlpatterns): DEFINES += QT_NO_XMLPATTERNS + diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 175955d663..90c78ec942 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -104,7 +104,9 @@ tst_examples::tst_examples() excludedDirs << "demos/twitter"; excludedDirs << "demos/flickr"; excludedDirs << "demos/photoviewer"; - excludedDirs << "snippets/qml/xmlrole.qml"; + excludedFiles << "snippets/qml/xmlrole.qml"; + excludedFiles << "particles/itemparticle/particleview.qml"; + excludedFiles << "views/visualdatamodel/slideshow.qml"; #endif } -- cgit v1.2.3 From 96c35a84d30b5b5cdf8feac4959891ad0bfed6a8 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 20 Jul 2015 14:21:08 +0200 Subject: fix readonly metaproperties (revealed by compiler warning) Found thanks to -Wparentheses + gcc 5.1 Change-Id: Iad784a26d268b85f7c67623fd63f0b097a9f29f9 Reviewed-by: Simon Hausmann --- .../auto/qml/qqmlproperty/data/readonlyPrimitiveVsVar.qml | 8 ++++++++ tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 15 +++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/auto/qml/qqmlproperty/data/readonlyPrimitiveVsVar.qml (limited to 'tests') diff --git a/tests/auto/qml/qqmlproperty/data/readonlyPrimitiveVsVar.qml b/tests/auto/qml/qqmlproperty/data/readonlyPrimitiveVsVar.qml new file mode 100644 index 0000000000..253d61d1da --- /dev/null +++ b/tests/auto/qml/qqmlproperty/data/readonlyPrimitiveVsVar.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + readonly property var r_var: 1; + readonly property int r_int: 1; + property var w_var: 1; + property int w_int: 1; +} diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index c4b2325843..a8b06ffa71 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -146,6 +146,7 @@ private slots: void warnOnInvalidBinding(); void registeredCompositeTypeProperty(); void deeplyNestedObject(); + void readOnlyDynamicProperties(); void copy(); private: @@ -2039,6 +2040,20 @@ void tst_qqmlproperty::deeplyNestedObject() QCOMPARE(p.read(), QVariant(14)); } +void tst_qqmlproperty::readOnlyDynamicProperties() +{ + QQmlComponent comp(&engine, testFileUrl("readonlyPrimitiveVsVar.qml")); + QObject *obj = comp.create(); + QVERIFY(obj != 0); + + QVERIFY(!obj->metaObject()->property(obj->metaObject()->indexOfProperty("r_var")).isWritable()); + QVERIFY(!obj->metaObject()->property(obj->metaObject()->indexOfProperty("r_int")).isWritable()); + QVERIFY(obj->metaObject()->property(obj->metaObject()->indexOfProperty("w_var")).isWritable()); + QVERIFY(obj->metaObject()->property(obj->metaObject()->indexOfProperty("w_int")).isWritable()); + + delete obj; +} + void tst_qqmlproperty::initTestCase() { QQmlDataTest::initTestCase(); -- cgit v1.2.3 From 40b9fb8946837a01710814c28fd0f04edba631ad Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 13 Jul 2015 14:57:16 +0200 Subject: Fix possible stack overflow with many property bindings When there are a lot of bindings to the same property (like 20 000), we would get stack overflows because the notify list for the changed signal was traversed recursively. Changing this also speeds up the traversal. I see something like ~40% reduction in the case of layout() for a notify list of around 200 items. Note: To make it possible to traverse the double-linked list backwards, the next-pointer needs to be moved to the beginning of the struct, because the implementation pattern assumes this (node->next->prev = &node->next). I think this code has rotted after it was added, since the prev pointer was never actually used anywhere before. Change-Id: Icdfac50b7c8584a908efa65694c7f5f416cb153b Reviewed-by: Lars Knoll --- tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests') diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp index 81215f7a18..4f1c9ae53e 100644 --- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp +++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp @@ -165,6 +165,7 @@ private slots: void readProperty(); void propertyChange(); void disconnectOnDestroy(); + void lotsOfBindings(); private: void createObjects(); @@ -312,6 +313,39 @@ void tst_qqmlnotifier::disconnectOnDestroy() exportedObject->verifyReceiverCount(); } +class TestObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int a READ a NOTIFY aChanged) + +public: + int a() const { return 0; } + +signals: + void aChanged(); +}; + +void tst_qqmlnotifier::lotsOfBindings() +{ + TestObject o; + QQmlEngine *e = new QQmlEngine; + + e->rootContext()->setContextProperty(QStringLiteral("test"), &o); + + QList components; + for (int i = 0; i < 20000; ++i) { + QQmlComponent *component = new QQmlComponent(e); + component->setData("import QtQuick 2.0; Item { width: test.a; }", QUrl()); + component->create(e->rootContext()); + components.append(component); + } + + o.aChanged(); + + qDeleteAll(components); + delete e; +} + QTEST_MAIN(tst_qqmlnotifier) #include "tst_qqmlnotifier.moc" -- cgit v1.2.3 From c318fceaccb1ee23a567f1bb032df45417217e09 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 29 Jul 2015 13:47:45 +0200 Subject: Fix disappearing selection spanning different scripts Due to the way itemization is currently done in Qt, Cyrillic text (and other writing systems) separated by spaces will become separate items because the spaces are itemized as Script_Common. In the Scenegraph's text node engine, we should merge these items into a single node as long as the same font is used for all the text. But a bug in the engine caused this to fail when the text was selected. The symptom of this was that in some rare cases one of the items would vanish if it were in the middle of a selection. In order to support the bearing of selected text leaning outside the selection rect, I previously added a hack which would add all selected text as unselected text as well in b0783c21fb54b939f07ddf5658cc51113b8014e6. This was an awkward way of doing it and caused said regression. A less intrusive way is just to add the text to the scene graph twice, as this does not interfere with the logic needed to support selecting part of ligatures nor the engine's ability to merge nodes correctly. [ChangeLog][Text] Fixed regression with selections spanning different scripts. Task-number: QTBUG-46829 Change-Id: I0faed76fb2cd1ac0b2e5cc54b81008b5e2550733 Reviewed-by: Gunnar Sletta --- .../data/text/textedit_cyrillic_selected_all.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected_all.qml (limited to 'tests') diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected_all.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected_all.qml new file mode 100644 index 0000000000..9580f28e29 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected_all.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + TextEdit { + id: textEdit + text: "и в у" + anchors.centerIn: parent + Component.onCompleted: textEdit.selectAll() + font.pixelSize: 14 + } +} -- cgit v1.2.3 From d218d8c8538e47cf32a06b4bdd9f60bd16a8cf50 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 29 Jul 2015 14:27:58 +0200 Subject: Fix selecting single character in middle of string The fix for QTBUG-46829 revealed a bug in the code to handle selecting part of ligatures. The ranges were assumed to be [start, end], while they are in fact [start, end>. This would cause the engine to assume the previous node overlapped completely with the selected node and that the node had thus already been added to the graph. Due to the bug in QTBUG-46829, this accidentally worked before, but when that bug was fixed, this bug appeared. Change-Id: I517d260de9f58db4504dd4320b7113fbbe305a81 Reviewed-by: Gunnar Sletta --- .../data/text/textedit_cyrillic_selected.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml (limited to 'tests') diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml new file mode 100644 index 0000000000..849e4b8597 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + TextEdit { + id: textEdit + text: "и в у" + anchors.centerIn: parent + Component.onCompleted: textEdit.select(2, 3) + font.pixelSize: 14 + } +} -- cgit v1.2.3 From d296ebfe6585010a38db0e3043ef5ceaa6a30883 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 28 Jul 2015 13:00:48 +0200 Subject: Fix selections in tables that span over several cells In the code that converts text layouts to subtrees in the scene graph specifically for TextEdit, there was a cutoff to treat text tables as single nodes in the graph (for simplicity). However, this breaks selections, since the ranges spanned by each cell will be interpreted as overlapping, messing up the selection merging logic. We need the same approach here as for any other text frame where we check frame boundaries. [ChangeLog][TextEdit] Fixed issues with selections that spanned several cells in a table. Change-Id: I789041d84b5d163e209488f8f2f1f83a6471389f Task-number: QTBUG-46928 Reviewed-by: Pierre Rossi --- .../data/text/textedit_table_selected.qml | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/manual/scenegraph_lancelot/data/text/textedit_table_selected.qml (limited to 'tests') diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_table_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_table_selected.qml new file mode 100644 index 0000000000..749c37904e --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/textedit_table_selected.qml @@ -0,0 +1,40 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + + TextEdit { + id: textEdit + anchors.centerIn: parent + verticalAlignment: Text.AlignBottom + font.family: "Arial" + font.pixelSize: 16 + textFormat: Text.RichText + Component.onCompleted: textEdit.selectAll() + text: + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
\n" + + "Cell 1\n" + + "
\n" + + "Cell 2\n" + + "
\n" + + "Cell 3\n" + + "
\n" + + "\n" + + "\n" + + } +} -- cgit v1.2.3 From cdc0916f60753f3dd6f97b504a27d49d3567f6b0 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 12 Aug 2015 10:27:07 +0200 Subject: Canvas: add a testcase for QSGSimpleTextureNode crash. Task-number: QTBUG-47714 Change-Id: I8ecf2673ebc5de3d0fe1dec8a67bee81f5d4fb8f Reviewed-by: Gabriel de Dietrich --- .../quick/qquickcanvasitem/data/tst_canvas.qml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml index 5960e53557..93f85107a7 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml @@ -677,5 +677,27 @@ CanvasTestCase { waitForRendering(implicitlySizedItem); comparePixel(implicitlySizedItem.canvas.context, xCenter, yCenter, 0, 0, 0, 255); } + + Component { + id: simpleTextureNodeUsageComponent + + Canvas { + id: canvas + anchors.fill: parent + + onPaint: { + var ctx = canvas.getContext("2d"); + ctx.clearRect(0, 0, 200, 200); + } + } + } + + function test_simpleTextureNodeUsage() { + var canvas = simpleTextureNodeUsageComponent.createObject(container); + verify(canvas); + wait(0); + // Shouldn't crash. + canvas.requestPaint(); + } } } -- cgit v1.2.3