summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qfxtextedit
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-09-24 03:21:12 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-09-24 03:29:43 (GMT)
commit9b6a71ec68edf836ab29cc3e5db71b53fe3d9346 (patch)
tree4f5933df38feb96f4c12befc023d0d7a5c2b9b06 /tests/auto/declarative/qfxtextedit
parent3402f53a52d6e1a4bce2a0ff084754399c312b08 (diff)
downloadQt-9b6a71ec68edf836ab29cc3e5db71b53fe3d9346.zip
Qt-9b6a71ec68edf836ab29cc3e5db71b53fe3d9346.tar.gz
Qt-9b6a71ec68edf836ab29cc3e5db71b53fe3d9346.tar.bz2
Add some visual autotests for QFxTextEdit
Includes test for regression against QT-669 (but it doesn't work just yet)
Diffstat (limited to 'tests/auto/declarative/qfxtextedit')
-rw-r--r--tests/auto/declarative/qfxtextedit/data/QT-669-test.qml8
-rw-r--r--tests/auto/declarative/qfxtextedit/data/QT-669.pngbin0 -> 4762 bytes
-rw-r--r--tests/auto/declarative/qfxtextedit/data/QT-669.qml11
-rw-r--r--tests/auto/declarative/qfxtextedit/data/basic-test.qml5
-rw-r--r--tests/auto/declarative/qfxtextedit/data/basic.pngbin0 -> 8051 bytes
-rw-r--r--tests/auto/declarative/qfxtextedit/data/basic.qml12
-rw-r--r--tests/auto/declarative/qfxtextedit/data/colorful-test.qml5
-rw-r--r--tests/auto/declarative/qfxtextedit/data/colorful.pngbin0 -> 9645 bytes
-rw-r--r--tests/auto/declarative/qfxtextedit/data/colorful.qml18
-rw-r--r--tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp41
10 files changed, 100 insertions, 0 deletions
diff --git a/tests/auto/declarative/qfxtextedit/data/QT-669-test.qml b/tests/auto/declarative/qfxtextedit/data/QT-669-test.qml
new file mode 100644
index 0000000..9d6b5e5
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/data/QT-669-test.qml
@@ -0,0 +1,8 @@
+import Qt.VisualTest 4.6
+
+VisualTest {
+ Frame { msec: 0; image: "QT-669.png" }
+ Key { key: Qt.Key_Right; count: 20 }
+ Key { key: Qt.Key_Left; count: 20 }
+ Frame { msec: 100; image: "QT-669.png" }
+}
diff --git a/tests/auto/declarative/qfxtextedit/data/QT-669.png b/tests/auto/declarative/qfxtextedit/data/QT-669.png
new file mode 100644
index 0000000..657fce9
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/data/QT-669.png
Binary files differ
diff --git a/tests/auto/declarative/qfxtextedit/data/QT-669.qml b/tests/auto/declarative/qfxtextedit/data/QT-669.qml
new file mode 100644
index 0000000..b9bf86a
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/data/QT-669.qml
@@ -0,0 +1,11 @@
+import Qt 4.6
+
+Rectangle {
+ color: "green"
+ width:400;
+ height:40;
+ TextEdit {
+ focus: true;
+ text: "Jackdaws love my big sphinx of Quartz"
+ }
+}
diff --git a/tests/auto/declarative/qfxtextedit/data/basic-test.qml b/tests/auto/declarative/qfxtextedit/data/basic-test.qml
new file mode 100644
index 0000000..021bfc5
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/data/basic-test.qml
@@ -0,0 +1,5 @@
+import Qt.VisualTest 4.6
+
+VisualTest {
+ Frame { msec: 0; image: "basic.png" }
+}
diff --git a/tests/auto/declarative/qfxtextedit/data/basic.png b/tests/auto/declarative/qfxtextedit/data/basic.png
new file mode 100644
index 0000000..b3cf1bf
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/data/basic.png
Binary files differ
diff --git a/tests/auto/declarative/qfxtextedit/data/basic.qml b/tests/auto/declarative/qfxtextedit/data/basic.qml
new file mode 100644
index 0000000..db4ec1c
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/data/basic.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+
+Item {
+ width:600;
+ height:100;
+ TextEdit {
+ focus: false;
+ font.pointSize: 14
+ font.bold: false
+ text: "Jackdaws love my big sphinx of Quartz"
+ }
+}
diff --git a/tests/auto/declarative/qfxtextedit/data/colorful-test.qml b/tests/auto/declarative/qfxtextedit/data/colorful-test.qml
new file mode 100644
index 0000000..f148746
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/data/colorful-test.qml
@@ -0,0 +1,5 @@
+import Qt.VisualTest 4.6
+
+VisualTest {
+ Frame { msec: 80; image: "colorful.png" }
+}
diff --git a/tests/auto/declarative/qfxtextedit/data/colorful.png b/tests/auto/declarative/qfxtextedit/data/colorful.png
new file mode 100644
index 0000000..16189e5
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/data/colorful.png
Binary files differ
diff --git a/tests/auto/declarative/qfxtextedit/data/colorful.qml b/tests/auto/declarative/qfxtextedit/data/colorful.qml
new file mode 100644
index 0000000..36d9c66
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/data/colorful.qml
@@ -0,0 +1,18 @@
+import Qt 4.6
+
+Rectangle {
+ color:"lightsteelblue"
+ width:600;
+ height:100;
+ Timer{ interval: 20; running: true; repeat: false; onTriggered: "Txt.selectionEnd = 14" }
+ TextEdit {
+ id: Txt
+ focus: false;
+ font.pointSize: 14
+ font.bold: false
+ color: "red"
+ selectionColor: "yellow"
+ selectedTextColor: "blue"
+ text: "Jackdaws love my big sphinx of Quartz"
+ }
+}
diff --git a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
index e38e0e7..ab55454 100644
--- a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
+++ b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
@@ -6,6 +6,9 @@
#include <QtDeclarative/qmlcomponent.h>
#include <QtDeclarative/qfxtextedit.h>
#include <QFontMetrics>
+#include <QLibraryInfo>
+#include <QProcess>
+#include <QDir>
class tst_qfxtextedit : public QObject
@@ -28,6 +31,8 @@ private slots:
void cursorDelegate();
+ void visualTests_data();
+ void visualTests();
private:
QStringList standard;
QStringList richText;
@@ -41,6 +46,7 @@ private:
QStringList colorStrings;
QmlEngine engine;
+ QString qmlviewerBinary;
};
tst_qfxtextedit::tst_qfxtextedit()
@@ -84,6 +90,16 @@ tst_qfxtextedit::tst_qfxtextedit()
// << "#AA0011DD"
// << "#00F16B11";
//
+
+ QString binaries = QLibraryInfo::location(QLibraryInfo::BinariesPath);
+
+#if defined(Q_WS_MAC)
+ qmlviewerBinary = QDir(binaries).absoluteFilePath("qmlviewer.app/Contents/MacOS/qmlviewer");
+#elif defined(Q_WS_WIN)
+ qmlviewerBinary = QDir(binaries).absoluteFilePath("qmlviewer.exe");
+#else
+ qmlviewerBinary = QDir(binaries).absoluteFilePath("qmlviewer");
+#endif
}
void tst_qfxtextedit::text()
@@ -452,6 +468,31 @@ void tst_qfxtextedit::cursorDelegate()
QVERIFY(!textEditObject->findChild<QFxItem*>("cursorInstance"));
}
+void tst_qfxtextedit::visualTests_data()
+{
+ QTest::addColumn<QString>("qmlFile");
+ QTest::addColumn<QString>("scriptFile");
+ QTest::newRow("basic") << "data/basic.qml" << "data/basic-test";
+ QTest::newRow("colorful") << "data/colorful.qml" << "data/colorful-test";
+ QTest::newRow("QT-669") << "data/QT-669.qml" << "data/QT-669-test";
+}
+
+void tst_qfxtextedit::visualTests()
+{
+ QFETCH(QString, qmlFile);
+ QFETCH(QString, scriptFile);
+
+ QStringList arguments;
+ arguments << "-script" << scriptFile
+ << "-scriptopts" << "play,exitoncomplete,exitonfailure"
+ << qmlFile;
+ QProcess p;
+ p.start(qmlviewerBinary, arguments);
+ QVERIFY(p.waitForFinished());
+ QCOMPARE(p.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(p.exitCode(), 0);
+}
+
QTEST_MAIN(tst_qfxtextedit)
#include "tst_qfxtextedit.moc"