diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-11-03 03:04:03 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-11-03 03:04:03 (GMT) |
commit | 5f19daab6baba7d09853058355a66090a3781430 (patch) | |
tree | 203b5a1abbf8c72c448845b399e5708a82ce9cfa /tests/auto/declarative | |
parent | 1e8034a10d2496d7fb7aa987357333c6e2c3258d (diff) | |
download | Qt-5f19daab6baba7d09853058355a66090a3781430.zip Qt-5f19daab6baba7d09853058355a66090a3781430.tar.gz Qt-5f19daab6baba7d09853058355a66090a3781430.tar.bz2 |
Support Visual (interactive) tests without using images for confirmation.
Diffstat (limited to 'tests/auto/declarative')
3 files changed, 517 insertions, 26 deletions
diff --git a/tests/auto/declarative/visual/selftest_noimages/data/selftest_noimages.qml b/tests/auto/declarative/visual/selftest_noimages/data/selftest_noimages.qml new file mode 100644 index 0000000..3104906 --- /dev/null +++ b/tests/auto/declarative/visual/selftest_noimages/data/selftest_noimages.qml @@ -0,0 +1,470 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + } + Frame { + msec: 32 + } + Frame { + msec: 48 + } + Frame { + msec: 64 + } + Frame { + msec: 80 + } + Frame { + msec: 96 + } + Frame { + msec: 112 + } + Frame { + msec: 128 + } + Frame { + msec: 144 + } + Frame { + msec: 160 + } + Frame { + msec: 176 + } + Frame { + msec: 192 + } + Frame { + msec: 208 + } + Frame { + msec: 224 + } + Frame { + msec: 240 + } + Frame { + msec: 256 + } + Frame { + msec: 272 + } + Frame { + msec: 288 + } + Frame { + msec: 304 + } + Frame { + msec: 320 + } + Frame { + msec: 336 + } + Frame { + msec: 352 + } + Frame { + msec: 368 + } + Frame { + msec: 384 + } + Frame { + msec: 400 + } + Frame { + msec: 416 + } + Frame { + msec: 432 + } + Frame { + msec: 448 + } + Frame { + msec: 464 + } + Frame { + msec: 480 + } + Frame { + msec: 496 + } + Frame { + msec: 512 + } + Frame { + msec: 528 + } + Frame { + msec: 544 + } + Frame { + msec: 560 + } + Frame { + msec: 576 + } + Frame { + msec: 592 + } + Frame { + msec: 608 + } + Frame { + msec: 624 + } + Frame { + msec: 640 + } + Frame { + msec: 656 + } + Frame { + msec: 672 + } + Frame { + msec: 688 + } + Frame { + msec: 704 + } + Frame { + msec: 720 + } + Frame { + msec: 736 + } + Frame { + msec: 752 + } + Frame { + msec: 768 + } + Frame { + msec: 784 + } + Frame { + msec: 800 + } + Frame { + msec: 816 + } + Frame { + msec: 832 + } + Frame { + msec: 848 + } + Frame { + msec: 864 + } + Frame { + msec: 880 + } + Frame { + msec: 896 + } + Frame { + msec: 912 + } + Frame { + msec: 928 + } + Frame { + msec: 944 + } + Frame { + msec: 960 + } + Frame { + msec: 976 + } + Frame { + msec: 992 + } + Frame { + msec: 1008 + } + Frame { + msec: 1024 + } + Frame { + msec: 1040 + } + Frame { + msec: 1056 + } + Frame { + msec: 1072 + } + Frame { + msec: 1088 + } + Frame { + msec: 1104 + } + Frame { + msec: 1120 + } + Frame { + msec: 1136 + } + Frame { + msec: 1152 + } + Frame { + msec: 1168 + } + Frame { + msec: 1184 + } + Frame { + msec: 1200 + } + Frame { + msec: 1216 + } + Frame { + msec: 1232 + } + Frame { + msec: 1248 + } + Frame { + msec: 1264 + } + Frame { + msec: 1280 + } + Frame { + msec: 1296 + } + Frame { + msec: 1312 + } + Frame { + msec: 1328 + } + Frame { + msec: 1344 + } + Frame { + msec: 1360 + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 77; y: 7 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1376 + } + Frame { + msec: 1392 + } + Frame { + msec: 1408 + } + Frame { + msec: 1424 + } + Frame { + msec: 1440 + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 77; y: 7 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1456 + } + Frame { + msec: 1472 + } + Frame { + msec: 1488 + } + Frame { + msec: 1504 + } + Frame { + msec: 1520 + } + Frame { + msec: 1536 + } + Frame { + msec: 1552 + } + Frame { + msec: 1568 + } + Frame { + msec: 1584 + } + Frame { + msec: 1600 + } + Frame { + msec: 1616 + } + Frame { + msec: 1632 + } + Frame { + msec: 1648 + } + Frame { + msec: 1664 + } + Frame { + msec: 1680 + } + Frame { + msec: 1696 + } + Frame { + msec: 1712 + } + Frame { + msec: 1728 + } + Frame { + msec: 1744 + } + Frame { + msec: 1760 + } + Frame { + msec: 1776 + } + Frame { + msec: 1792 + } + Frame { + msec: 1808 + } + Frame { + msec: 1824 + } + Frame { + msec: 1840 + } + Frame { + msec: 1856 + } + Frame { + msec: 1872 + } + Frame { + msec: 1888 + } + Frame { + msec: 1904 + } + Frame { + msec: 1920 + } + Frame { + msec: 1936 + } + Frame { + msec: 1952 + } + Frame { + msec: 1968 + } + Frame { + msec: 1984 + } + Frame { + msec: 2000 + } + Frame { + msec: 2016 + } + Frame { + msec: 2032 + } + Frame { + msec: 2048 + } + Frame { + msec: 2064 + } + Frame { + msec: 2080 + } + Frame { + msec: 2096 + } + Frame { + msec: 2112 + } + Frame { + msec: 2128 + } + Frame { + msec: 2144 + } + Frame { + msec: 2160 + } + Frame { + msec: 2176 + } + Frame { + msec: 2192 + } + Frame { + msec: 2208 + } + Frame { + msec: 2224 + } + Frame { + msec: 2240 + } + Frame { + msec: 2256 + } + Frame { + msec: 2272 + } + Frame { + msec: 2288 + } + Frame { + msec: 2304 + } + Frame { + msec: 2320 + } + Frame { + msec: 2336 + } + Frame { + msec: 2352 + } + Frame { + msec: 2368 + } + Frame { + msec: 2384 + } +} diff --git a/tests/auto/declarative/visual/selftest_noimages/selftest_noimages.qml b/tests/auto/declarative/visual/selftest_noimages/selftest_noimages.qml new file mode 100644 index 0000000..21a19bc --- /dev/null +++ b/tests/auto/declarative/visual/selftest_noimages/selftest_noimages.qml @@ -0,0 +1,9 @@ +import Qt 4.6 +Text { + property string error: "not pressed" + text: (new Date()).valueOf() + MouseRegion { + anchors.fill: parent + onPressed: error="" + } +} diff --git a/tests/auto/declarative/visual/tst_visual.cpp b/tests/auto/declarative/visual/tst_visual.cpp index a79b6f9..0cd712b 100644 --- a/tests/auto/declarative/visual/tst_visual.cpp +++ b/tests/auto/declarative/visual/tst_visual.cpp @@ -47,7 +47,7 @@ #include <QProcess> #include <QFile> -enum Mode { Record, Play, TestVisuals, UpdateVisuals, UpdatePlatformVisuals, Test }; +enum Mode { Record, RecordNoVisuals, Play, TestVisuals, RemoveVisuals, UpdateVisuals, UpdatePlatformVisuals, Test }; static QString testdir; class tst_visual : public QObject @@ -115,7 +115,7 @@ void tst_visual::visual() QStringList arguments; arguments << "-script" << testdata - << "-scriptopts" << "play,testimages,exitoncomplete,exitonfailure" + << "-scriptopts" << "play,testimages,testerror,exitoncomplete,exitonfailure" << file; QProcess p; p.start(qmlviewer, arguments); @@ -208,38 +208,44 @@ void action(Mode mode, const QString &file) QString testdata = tst_visual::toTestScript(file,mode); - if (Record == mode) { - QStringList arguments; - arguments << "-script" << testdata + QStringList arguments; + switch (mode) { + case Test: + // Don't run qmlviewer + break; + case Record: + arguments << "-script" << testdata + << "-scriptopts" << "record,testimages,saveonexit" + << file; + break; + case RecordNoVisuals: + arguments << "-script" << testdata << "-scriptopts" << "record,saveonexit" << file; - QProcess p; - p.setProcessChannelMode(QProcess::ForwardedChannels); - p.start(tst_visual::viewer(), arguments); - p.waitForFinished(); - } else if (Play == mode) { - QStringList arguments; - arguments << "-script" << testdata - << "-scriptopts" << "play,testimages,exitoncomplete" + break; + case Play: + arguments << "-script" << testdata + << "-scriptopts" << "play,testimages,testerror,exitoncomplete" << file; - QProcess p; - p.setProcessChannelMode(QProcess::ForwardedChannels); - p.start(tst_visual::viewer(), arguments); - p.waitForFinished(); - } else if (TestVisuals == mode) { - QStringList arguments; + break; + case TestVisuals: arguments << "-script" << testdata << "-scriptopts" << "play" << file; - QProcess p; - p.setProcessChannelMode(QProcess::ForwardedChannels); - p.start(tst_visual::viewer(), arguments); - p.waitForFinished(); - } else if (UpdateVisuals == mode || UpdatePlatformVisuals == mode) { - QStringList arguments; - arguments << "-script" << testdata + break; + case UpdateVisuals: + case UpdatePlatformVisuals: + arguments << "-script" << testdata + << "-scriptopts" << "play,record,testimages,exitoncomplete,saveonexit" + << file; + break; + case RemoveVisuals: + arguments << "-script" << testdata << "-scriptopts" << "play,record,exitoncomplete,saveonexit" << file; + break; + } + if (!arguments.isEmpty()) { QProcess p; p.setProcessChannelMode(QProcess::ForwardedChannels); p.start(tst_visual::viewer(), arguments); @@ -278,9 +284,15 @@ int main(int argc, char **argv) } else if (arg == "-record" && (ii + 1) < argc) { mode = Record; file = argv[++ii]; + } else if (arg == "-recordnovisuals" && (ii + 1) < argc) { + mode = RecordNoVisuals; + file = argv[++ii]; } else if (arg == "-testvisuals" && (ii + 1) < argc) { mode = TestVisuals; file = argv[++ii]; + } else if (arg == "-removevisuals" && (ii + 1) < argc) { + mode = RemoveVisuals; + file = argv[++ii]; } else if (arg == "-updatevisuals" && (ii + 1) < argc) { mode = UpdateVisuals; file = argv[++ii]; |