summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp21
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp14
2 files changed, 32 insertions, 3 deletions
diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
index 6bcb4eb..de4ddcc 100644
--- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
+++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
@@ -66,7 +66,6 @@
Q_DECLARE_METATYPE(QDeclarativeDebugWatch::State)
-
class tst_QDeclarativeDebug : public QObject
{
Q_OBJECT
@@ -119,6 +118,18 @@ private slots:
void setBindingInStates();
};
+class NonScriptProperty : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(int nonScriptProp READ nonScriptProp WRITE setNonScriptProp NOTIFY nonScriptPropChanged SCRIPTABLE false)
+public:
+ int nonScriptProp() const { return 0; }
+ void setNonScriptProp(int) {}
+signals:
+ void nonScriptPropChanged();
+};
+QML_DECLARE_TYPE(NonScriptProperty)
+
+
QDeclarativeDebugObjectReference tst_QDeclarativeDebug::findRootObject(int context, bool recursive)
{
QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
@@ -283,6 +294,7 @@ void tst_QDeclarativeDebug::compareProperties(const QDeclarativeDebugPropertyRef
void tst_QDeclarativeDebug::initTestCase()
{
qRegisterMetaType<QDeclarativeDebugWatch::State>();
+ qmlRegisterType<NonScriptProperty>("Test", 1, 0, "NonScriptPropertyElement");
QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!");
QDeclarativeDebugHelper::enableDebugging();
@@ -292,7 +304,8 @@ void tst_QDeclarativeDebug::initTestCase()
QList<QByteArray> qml;
qml << "import QtQuick 1.0\n"
- "Item {"
+ "import Test 1.0\n"
+ "Item {"
"id: root\n"
"width: 10; height: 20; scale: blueRect.scale;"
"Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }"
@@ -308,6 +321,8 @@ void tst_QDeclarativeDebug::initTestCase()
"list[0] = blueRect;\n"
"varObjList = list;\n"
"}\n"
+ "NonScriptPropertyElement {\n"
+ "}\n"
"}";
// add second component to test multiple root contexts
@@ -726,7 +741,7 @@ void tst_QDeclarativeDebug::queryObject()
// check source as defined in main()
QDeclarativeDebugFileReference source = obj.source();
QCOMPARE(source.url(), QUrl::fromLocalFile(""));
- QCOMPARE(source.lineNumber(), 2);
+ QCOMPARE(source.lineNumber(), 3);
QCOMPARE(source.columnNumber(), 1);
// generically test all properties, children and childrens' properties
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index ef32ee3..943b1fa 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -2285,6 +2285,20 @@ void tst_qdeclarativetextinput::preeditAutoScroll()
ic.sendPreeditText(preeditText.mid(0, 3), 1);
QCOMPARE(input.positionAt(0), 0);
QCOMPARE(input.positionAt(input.width()), 5);
+
+ ic.sendEvent(QInputMethodEvent());
+ input.setAutoScroll(true);
+ // Test committing pre-edit text at the start of the string. QTBUG-18789
+ input.setCursorPosition(0);
+ ic.sendPreeditText(input.text(), 5);
+ QCOMPARE(input.positionAt(0), 0);
+
+ QInputMethodEvent event;
+ event.setCommitString(input.text());
+ ic.sendEvent(event);
+
+ QCOMPARE(input.positionAt(0), 0);
+ QCOMPARE(input.positionAt(input.width()), 5);
}
void tst_qdeclarativetextinput::preeditMicroFocus()