aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2016-11-15 16:40:38 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2016-11-15 16:44:16 +0100
commitb7a8b5a284bdf306a45b11e1c5ce308be007d1de (patch)
tree35ebcf4b3440abb24df67b579e00847417d42c19
parent441e6bbdb01733c0f9860ce881b61f5907d2d2f8 (diff)
parent365a3ac6ae50eb53253eca92bfdf4c527b3a5c05 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: src/qml/jsruntime/qv4string.cpp The conflict resolution for qv4tsring.cpp is to essentially omit the change of commit 64714ea431f2fd355ed27edc69dba4e992511e75 as the code in 5.8 already uses the add/mul_overflow functions. This merge also reverts commit f4ac007f4a19bc095ff15d415a6629986de78e49 as we can deal with dead store elimination now. Change-Id: Iee08c87cbe1a2ff23a73ce621d56262b4e007c56
-rw-r--r--examples/quick/demos/stocqt/content/StockListModel.qml66
-rw-r--r--examples/quick/demos/stocqt/content/StockListView.qml60
-rw-r--r--examples/quick/shared/shared.h1
-rw-r--r--src/imports/testlib/TestCase.qml6
-rw-r--r--src/particles/qquickimageparticle.cpp6
-rw-r--r--src/qml/jsruntime/qv4string.cpp1
-rw-r--r--src/qml/types/qqmlconnections.cpp4
-rw-r--r--src/qmltest/quicktestevent.cpp1
-rw-r--r--src/quick/items/qquicktextedit.cpp3
-rw-r--r--src/quick/items/qquicktextnode.cpp8
-rw-r--r--src/quick/items/qquickwindow.cpp6
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp3
-rw-r--r--sync.profile11
-rw-r--r--tests/auto/qml/qjsvalue/tst_qjsvalue.cpp27
-rw-r--r--tests/auto/qml/qjsvalue/tst_qjsvalue.h2
-rw-r--r--tests/auto/qml/qqmlconnections/data/test-connection-implicit.qml9
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp27
-rw-r--r--tests/auto/quick/qquicktextedit/data/cursorHeight.qml20
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp38
19 files changed, 211 insertions, 88 deletions
diff --git a/examples/quick/demos/stocqt/content/StockListModel.qml b/examples/quick/demos/stocqt/content/StockListModel.qml
index be00e7bb1c..9b48124bda 100644
--- a/examples/quick/demos/stocqt/content/StockListModel.qml
+++ b/examples/quick/demos/stocqt/content/StockListModel.qml
@@ -42,6 +42,72 @@ import QtQuick 2.0
ListModel {
id: stocks
+
+ // pre-fetch data for all entries
+ Component.onCompleted: {
+ for (var idx = 0; idx < count; ++idx) {
+ getCloseValue(idx)
+ }
+ }
+
+ function requestUrl(stockId) {
+ var endDate = new Date(""); // today
+ var startDate = new Date()
+ startDate.setDate(startDate.getDate() - 5);
+
+ var request = "http://ichart.finance.yahoo.com/table.csv?";
+ request += "s=" + stockId;
+ request += "&g=d";
+ request += "&a=" + startDate.getMonth();
+ request += "&b=" + startDate.getDate();
+ request += "&c=" + startDate.getFullYear();
+ request += "&d=" + endDate.getMonth();
+ request += "&e=" + endDate.getDate();
+ request += "&f=" + endDate.getFullYear();
+ request += "&g=d";
+ request += "&ignore=.csv";
+ return request;
+ }
+
+ function getCloseValue(index) {
+ var req = requestUrl(get(index).stockId);
+
+ if (!req)
+ return;
+
+ var xhr = new XMLHttpRequest;
+
+ xhr.open("GET", req, true);
+
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.LOADING || xhr.readyState === XMLHttpRequest.DONE) {
+ var records = xhr.responseText.split('\n');
+ if (records.length > 0 && xhr.status == 200) {
+ var r = records[1].split(',');
+ var today = parseFloat(r[4]);
+ setProperty(index, "value", today.toFixed(2));
+
+ r = records[2].split(',');
+ var yesterday = parseFloat(r[4]);
+ var change = today - yesterday;
+ if (change >= 0.0)
+ setProperty(index, "change", "+" + change.toFixed(2));
+ else
+ setProperty(index, "change", change.toFixed(2));
+
+ var changePercentage = (change / yesterday) * 100.0;
+ if (changePercentage >= 0.0)
+ setProperty(index, "changePercentage", "+" + changePercentage.toFixed(2) + "%");
+ else
+ setProperty(index, "changePercentage", changePercentage.toFixed(2) + "%");
+ } else {
+ var unknown = "n/a";
+ set(index, {"value": unknown, "change": unknown, "changePercentage": unknown});
+ }
+ }
+ }
+ xhr.send()
+ }
// Uncomment to test invalid entries
// ListElement {name: "The Qt Company"; stockId: "TQTC"; value: "999.0"; change: "0.0"; changePercentage: "0.0"}
diff --git a/examples/quick/demos/stocqt/content/StockListView.qml b/examples/quick/demos/stocqt/content/StockListView.qml
index 59f36b42cc..d2bd52a69d 100644
--- a/examples/quick/demos/stocqt/content/StockListView.qml
+++ b/examples/quick/demos/stocqt/content/StockListView.qml
@@ -64,65 +64,6 @@ Rectangle {
model: StockListModel{}
currentIndex: -1 // Don't pre-select any item
- function requestUrl(stockId) {
- var endDate = new Date(""); //today
- var startDate = new Date()
- startDate.setDate(startDate.getDate() - 5);
-
- var request = "http://ichart.finance.yahoo.com/table.csv?";
- request += "s=" + stockId;
- request += "&g=d";
- request += "&a=" + startDate.getMonth();
- request += "&b=" + startDate.getDate();
- request += "&c=" + startDate.getFullYear();
- request += "&d=" + endDate.getMonth();
- request += "&e=" + endDate.getDate();
- request += "&f=" + endDate.getFullYear();
- request += "&g=d";
- request += "&ignore=.csv";
- return request;
- }
-
- function getCloseValue(index) {
- var req = requestUrl(model.get(index).stockId);
-
- if (!req)
- return;
-
- var xhr = new XMLHttpRequest;
-
- xhr.open("GET", req, true);
-
- xhr.onreadystatechange = function() {
- if (xhr.readyState === XMLHttpRequest.LOADING || xhr.readyState === XMLHttpRequest.DONE) {
- var records = xhr.responseText.split('\n');
- if (records.length > 0 && xhr.status == 200) {
- var r = records[1].split(',');
- var today = parseFloat(r[4]);
- model.setProperty(index, "value", today.toFixed(2));
-
- r = records[2].split(',');
- var yesterday = parseFloat(r[4]);
- var change = today - yesterday;
- if (change >= 0.0)
- model.setProperty(index, "change", "+" + change.toFixed(2));
- else
- model.setProperty(index, "change", change.toFixed(2));
-
- var changePercentage = (change / yesterday) * 100.0;
- if (changePercentage >= 0.0)
- model.setProperty(index, "changePercentage", "+" + changePercentage.toFixed(2) + "%");
- else
- model.setProperty(index, "changePercentage", changePercentage.toFixed(2) + "%");
- } else {
- var unknown = "n/a";
- model.set(index, {"value": unknown, "change": unknown, "changePercentage": unknown});
- }
- }
- }
- xhr.send()
- }
-
onCurrentIndexChanged: {
if (currentItem) {
root.currentStockId = model.get(currentIndex).stockId;
@@ -175,7 +116,6 @@ Rectangle {
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: value
- Component.onCompleted: view.getCloseValue(index);
}
Text {
diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h
index d8fb80b97e..0eed618d9d 100644
--- a/examples/quick/shared/shared.h
+++ b/examples/quick/shared/shared.h
@@ -44,6 +44,7 @@
#include <QQuickView> //Not using QQmlApplicationEngine because many examples don't have a Window{}
#define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \
{\
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);\
QGuiApplication app(argc,argv);\
app.setOrganizationName("QtProject");\
app.setOrganizationDomain("qt-project.org");\
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 683200a259..d22ec7c44f 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -221,7 +221,7 @@ Item {
\qmlproperty string TestCase::name
This property defines the name of the test case for result reporting.
- The default is the empty string.
+ The default value is an empty string.
\code
TestCase {
@@ -835,7 +835,7 @@ Item {
\c{QEXPECT_FAIL(tag, message, Abort)} in C++.
If the test is not data-driven, then \a tag must be set to
- the empty string.
+ an empty string.
\sa expectFailContinue()
*/
@@ -861,7 +861,7 @@ Item {
\c{QEXPECT_FAIL(tag, message, Continue)} in C++.
If the test is not data-driven, then \a tag must be set to
- the empty string.
+ an empty string.
\sa expectFail()
*/
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index c68153aca8..e6b921792f 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -1292,14 +1292,16 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
// OS X 10.8.3 introduced a bug in the AMD drivers, for at least the 2011 macbook pros,
// causing point sprites who read gl_PointCoord in the frag shader to come out as
// green-red blobs.
- if (perfLevel < Deformable && strstr((char *) glGetString(GL_VENDOR), "ATI")) {
+ const GLubyte *glVendor = QOpenGLContext::currentContext()->functions()->glGetString(GL_VENDOR);
+ if (perfLevel < Deformable && glVendor && strstr((char *) glVendor, "ATI")) {
perfLevel = Deformable;
}
#endif
#ifdef Q_OS_LINUX
// Nouveau drivers can potentially freeze a machine entirely when taking the point-sprite path.
- if (perfLevel < Deformable && strstr((const char *) glGetString(GL_VENDOR), "nouveau"))
+ const GLubyte *glVendor = QOpenGLContext::currentContext()->functions()->glGetString(GL_VENDOR);
+ if (perfLevel < Deformable && glVendor && strstr((const char *) glVendor, "nouveau"))
perfLevel = Deformable;
#endif
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index 3365ffe637..1efd8cb714 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -46,6 +46,7 @@
#include "qv4stringobject_p.h"
#endif
#include <QtCore/QHash>
+#include <QtCore/private/qnumeric_p.h>
using namespace QV4;
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index 84782114ac..755345cc1b 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -165,9 +165,9 @@ private:
void QQmlConnections::setTarget(QObject *obj)
{
Q_D(QQmlConnections);
- d->targetSet = true; // even if setting to 0, it is *set*
- if (d->target == obj)
+ if (d->targetSet && d->target == obj)
return;
+ d->targetSet = true; // even if setting to 0, it is *set*
foreach (QQmlBoundSignal *s, d->boundsignals) {
// It is possible that target is being changed due to one of our signal
// handlers -> use deleteLater().
diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp
index 679201732a..32cc5eefd7 100644
--- a/src/qmltest/quicktestevent.cpp
+++ b/src/qmltest/quicktestevent.cpp
@@ -183,6 +183,7 @@ namespace QtQuickTest
case MouseMove:
// with move event the button is NoButton, but 'buttons' holds the currently pressed buttons
me = QMouseEvent(QEvent::MouseMove, pos, window->mapToGlobal(pos), Qt::NoButton, button, stateKey);
+ me.setTimestamp(++lastMouseTimestamp);
break;
default:
QTEST_ASSERT(false);
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index c81544cbdb..3389a608bf 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -892,7 +892,7 @@ void QQuickTextEdit::setWrapMode(WrapMode mode)
/*!
\qmlproperty int QtQuick::TextEdit::lineCount
- Returns the total number of lines in the textEdit item.
+ Returns the total number of lines in the TextEdit item.
*/
int QQuickTextEdit::lineCount() const
{
@@ -2350,6 +2350,7 @@ void QQuickTextEdit::moveCursorDelegate()
QRectF cursorRect = cursorRectangle();
d->cursorItem->setX(cursorRect.x());
d->cursorItem->setY(cursorRect.y());
+ d->cursorItem->setHeight(cursorRect.height());
}
void QQuickTextEdit::updateSelection()
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 8716f98bff..6cfc1d0313 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -160,18 +160,14 @@ void QQuickTextNode::addImage(const QRectF &rect, const QImage &image)
QSGRenderContext *sg = QQuickItemPrivate::get(m_ownerElement)->sceneGraphRenderContext();
QSGInternalImageNode *node = sg->sceneGraphContext()->createInternalImageNode();
QSGTexture *texture = sg->createTexture(image);
- if (m_ownerElement->smooth()) {
+ if (m_ownerElement->smooth())
texture->setFiltering(QSGTexture::Linear);
- texture->setMipmapFiltering(QSGTexture::Linear);
- }
m_textures.append(texture);
node->setTargetRect(rect);
node->setInnerTargetRect(rect);
node->setTexture(texture);
- if (m_ownerElement->smooth()) {
+ if (m_ownerElement->smooth())
node->setFiltering(QSGTexture::Linear);
- node->setMipmapFiltering(QSGTexture::Linear);
- }
appendChildNode(node);
node->update();
}
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index a0a07f43cc..1297dded8c 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -3125,10 +3125,12 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
if (itemPriv->paintNode && itemPriv->paintNode->parent() == 0) {
QSGNode *before = qquickitem_before_paintNode(itemPriv);
- if (before)
+ if (before && before->parent()) {
+ Q_ASSERT(before->parent() == itemPriv->childContainerNode());
itemPriv->childContainerNode()->insertChildNodeAfter(itemPriv->paintNode, before);
- else
+ } else {
itemPriv->childContainerNode()->prependChildNode(itemPriv->paintNode);
+ }
}
} else if (itemPriv->paintNode) {
delete itemPriv->paintNode;
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 40c3293c7b..b6abb55bd3 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -117,8 +117,9 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel)
if (image.width() < m_atlas_size_limit && image.height() < m_atlas_size_limit) {
if (!m_atlas)
m_atlas = new Atlas(m_atlas_size);
+ // t may be null for atlas allocation failure
t = m_atlas->create(image);
- if (!hasAlphaChannel && t->hasAlphaChannel())
+ if (t && !hasAlphaChannel && t->hasAlphaChannel())
t->setHasAlphaChannel(false);
}
return t;
diff --git a/sync.profile b/sync.profile
index 46280ade96..6cab0ae358 100644
--- a/sync.profile
+++ b/sync.profile
@@ -13,14 +13,3 @@
);
%deprecatedheaders = (
);
-# Module dependencies.
-# Every module that is required to build this module should have one entry.
-# Each of the module version specifiers can take one of the following values:
-# - A specific Git revision.
-# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
-# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch)
-#
-%dependencies = (
- "qtbase" => "",
- "qtxmlpatterns" => "",
-);
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
index d28bbc1ffa..12c33909cf 100644
--- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
+++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
@@ -1372,6 +1372,33 @@ void tst_QJSValue::hasProperty_changePrototype()
QVERIFY(obj.hasOwnProperty("foo"));
}
+void tst_QJSValue::hasProperty_QTBUG56830_data()
+{
+ QTest::addColumn<QString>("key");
+ QTest::addColumn<QString>("lookup");
+
+ QTest::newRow("bugreport-1") << QStringLiteral("240000000000") << QStringLiteral("3776798720");
+ QTest::newRow("bugreport-2") << QStringLiteral("240000000001") << QStringLiteral("3776798721");
+ QTest::newRow("biggest-ok-before-bug") << QStringLiteral("238609294221") << QStringLiteral("2386092941");
+ QTest::newRow("smallest-bugged") << QStringLiteral("238609294222") << QStringLiteral("2386092942");
+ QTest::newRow("biggest-bugged") << QStringLiteral("249108103166") << QStringLiteral("12884901886");
+ QTest::newRow("smallest-ok-after-bug") << QStringLiteral("249108103167") << QStringLiteral("12884901887");
+}
+
+void tst_QJSValue::hasProperty_QTBUG56830()
+{
+ QFETCH(QString, key);
+ QFETCH(QString, lookup);
+
+ QJSEngine eng;
+ const QJSValue value(42);
+
+ QJSValue obj = eng.newObject();
+ obj.setProperty(key, value);
+ QVERIFY(obj.hasProperty(key));
+ QVERIFY(!obj.hasProperty(lookup));
+}
+
void tst_QJSValue::deleteProperty_basic()
{
QJSEngine eng;
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.h b/tests/auto/qml/qjsvalue/tst_qjsvalue.h
index 6ed880c865..b8b9f4403c 100644
--- a/tests/auto/qml/qjsvalue/tst_qjsvalue.h
+++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.h
@@ -92,6 +92,8 @@ private slots:
void hasProperty_basic();
void hasProperty_globalObject();
void hasProperty_changePrototype();
+ void hasProperty_QTBUG56830_data();
+ void hasProperty_QTBUG56830();
void deleteProperty_basic();
void deleteProperty_globalObject();
diff --git a/tests/auto/qml/qqmlconnections/data/test-connection-implicit.qml b/tests/auto/qml/qqmlconnections/data/test-connection-implicit.qml
new file mode 100644
index 0000000000..d5aa0f102a
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/test-connection-implicit.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ width: 50
+
+ property bool tested: false
+
+ Connections { onWidthChanged: tested = true }
+}
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
index 615de0885a..b3ac1ce958 100644
--- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
+++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
@@ -52,6 +52,7 @@ private slots:
void rewriteErrors();
void singletonTypeTarget();
void enableDisable_QTBUG_36350();
+ void clearImplicitTarget();
private:
QQmlEngine engine;
@@ -352,6 +353,32 @@ void tst_qqmlconnections::enableDisable_QTBUG_36350()
delete item;
}
+//QTBUG-56499
+void tst_qqmlconnections::clearImplicitTarget()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("test-connection-implicit.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
+
+ QVERIFY(item != 0);
+
+ // normal case: fire Connections
+ item->setWidth(100.);
+ QCOMPARE(item->property("tested").toBool(), true);
+
+ item->setProperty("tested", false);
+ // clear the implicit target
+ QQmlConnections *connections = item->findChild<QQmlConnections*>();
+ QVERIFY(connections);
+ connections->setTarget(0);
+
+ // target cleared: no longer fire Connections
+ item->setWidth(150.);
+ QCOMPARE(item->property("tested").toBool(), false);
+
+ delete item;
+}
+
QTEST_MAIN(tst_qqmlconnections)
#include "tst_qqmlconnections.moc"
diff --git a/tests/auto/quick/qquicktextedit/data/cursorHeight.qml b/tests/auto/quick/qquicktextedit/data/cursorHeight.qml
new file mode 100644
index 0000000000..b831a9eb6f
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/cursorHeight.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 300
+ height: 300
+ color: "white"
+
+ TextEdit {
+ objectName: "textEditObject"
+ width: 300
+ height: 300
+ text: "<span style=\"font-size:20pt;\">Blah</span><br>blah"
+ textFormat: TextEdit.RichText
+ cursorDelegate: Rectangle {
+ objectName: "cursorInstance"
+ color: "red"
+ width: 2
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index 5ed0e9eea7..5d30cc8c94 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -140,6 +140,7 @@ private slots:
void cursorVisible();
void delegateLoading_data();
void delegateLoading();
+ void cursorDelegateHeight();
void navigation();
void readOnly();
#ifndef QT_NO_CLIPBOARD
@@ -2848,6 +2849,43 @@ void tst_qquicktextedit::delegateLoading()
//QVERIFY(!delegate);
}
+void tst_qquicktextedit::cursorDelegateHeight()
+{
+ QQuickView view(testFileUrl("cursorHeight.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject");
+ QVERIFY(textEditObject);
+ // Delegate creation is deferred until focus in or cursor visibility is forced.
+ QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance"));
+ QVERIFY(!textEditObject->isCursorVisible());
+
+ // Test that the delegate gets created.
+ textEditObject->setFocus(true);
+ QVERIFY(textEditObject->isCursorVisible());
+ QQuickItem* delegateObject = textEditObject->findChild<QQuickItem*>("cursorInstance");
+ QVERIFY(delegateObject);
+
+ const int largerHeight = textEditObject->cursorRectangle().height();
+
+ textEditObject->setCursorPosition(0);
+ QCOMPARE(delegateObject->x(), textEditObject->cursorRectangle().x());
+ QCOMPARE(delegateObject->y(), textEditObject->cursorRectangle().y());
+ QCOMPARE(delegateObject->height(), textEditObject->cursorRectangle().height());
+
+ // Move the cursor to the next line, which has a smaller font.
+ textEditObject->setCursorPosition(5);
+ QCOMPARE(delegateObject->x(), textEditObject->cursorRectangle().x());
+ QCOMPARE(delegateObject->y(), textEditObject->cursorRectangle().y());
+ QVERIFY(textEditObject->cursorRectangle().height() < largerHeight);
+ QCOMPARE(delegateObject->height(), textEditObject->cursorRectangle().height());
+
+ // Test that the delegate gets deleted
+ textEditObject->setCursorDelegate(0);
+ QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance"));
+}
+
/*
TextEdit element should only handle left/right keys until the cursor reaches
the extent of the text, then they should ignore the keys.