From 2a10573f0d67739b3fdec31787016a6a3ec99126 Mon Sep 17 00:00:00 2001 From: Ed Baak Date: Wed, 21 Jul 2010 14:20:43 +1000 Subject: Add target paths for all project files. Qt Creator added these lines for me. --- examples/cppsystemtest/cppsystemtest.pro | 7 +++++++ interpreter/interpreter.pro | 4 ++++ libqsystemtest/libqsystemtest.pro | 4 ++++ libqtslave/libqtslave.pro | 4 ++++ libqtuitest/libqtuitest.pro | 4 ++++ plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro | 4 ++++ .../qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro | 4 ++++ plugins/qtuitest_widgets/qmlwidgets/qmlwidgets.pro | 4 ++++ plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro | 4 ++++ plugins/styles/qtuitest/qtuitest.pro | 4 ++++ qtbindings/qtscript_core/qtscript_core.pro | 7 +++++++ tests/qtuitest/sys_assistant/sys_assistant.pro | 7 +++++++ tests/qtuitest/sys_designer/sys_designer.pro | 7 +++++++ tests/qtuitest/sys_graphicsView/sys_graphicsView.pro | 7 +++++++ tests/qtuitest/sys_input/sys_input.pro | 7 +++++++ tests/qtuitest/sys_linguist/sys_linguist.pro | 7 +++++++ tests/qtuitest/testapps/fileDialogSaveApp/fileDialogSaveApp.pro | 7 +++++++ tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro | 7 +++++++ tests/qtuitest/testapps/testapp1/testapp1.pro | 4 ++++ tests/qtuitest/testapps/testapp2/testapp2.pro | 4 ++++ tests/qtuitest/testapps/testapp3/testapp3.pro | 4 ++++ tests/qtuitest/testapps/testapp4/testapp4.pro | 4 ++++ tests/qtuitest/tst_qalternatestack/tst_qalternatestack.pro | 7 +++++++ tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.pro | 7 +++++++ tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.pro | 7 +++++++ tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.pro | 7 +++++++ tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.pro | 7 +++++++ tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.pro | 7 +++++++ 28 files changed, 157 insertions(+) diff --git a/examples/cppsystemtest/cppsystemtest.pro b/examples/cppsystemtest/cppsystemtest.pro index a435b4c..0a005bf 100644 --- a/examples/cppsystemtest/cppsystemtest.pro +++ b/examples/cppsystemtest/cppsystemtest.pro @@ -25,3 +25,10 @@ mac { CONFIG+=qtestlib debug + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/interpreter/interpreter.pro b/interpreter/interpreter.pro index eb3be3f..c91e4ee 100644 --- a/interpreter/interpreter.pro +++ b/interpreter/interpreter.pro @@ -57,3 +57,7 @@ mac { CONFIG(debug,debug|release): LIBS += -L$$BUILDROOT/lib -lqsystemtest_debug -lqtuitest_debug CONFIG(release,debug|release): LIBS += -L$$BUILDROOT/lib -lqsystemtest -lqtuitest } + + +target.path += \ + /usr/local/bin \ No newline at end of file diff --git a/libqsystemtest/libqsystemtest.pro b/libqsystemtest/libqsystemtest.pro index 97bdb32..f0ff053 100644 --- a/libqsystemtest/libqsystemtest.pro +++ b/libqsystemtest/libqsystemtest.pro @@ -68,3 +68,7 @@ mac { CONFIG(release,debug|release): LIBS += -L$$BUILDROOT/lib -lqtuitest DEFINES+=sighandler_t=sig_t } + + +target.path += \ + /usr/local/lib \ No newline at end of file diff --git a/libqtslave/libqtslave.pro b/libqtslave/libqtslave.pro index 5dfd285..b8b1c47 100644 --- a/libqtslave/libqtslave.pro +++ b/libqtslave/libqtslave.pro @@ -46,3 +46,7 @@ mac { CONFIG(release,debug|release): LIBS += -L$$BUILDROOT/lib -lqtuitest } + + +target.path += \ + /usr/local/lib \ No newline at end of file diff --git a/libqtuitest/libqtuitest.pro b/libqtuitest/libqtuitest.pro index 8207b32..bcd9beb 100644 --- a/libqtuitest/libqtuitest.pro +++ b/libqtuitest/libqtuitest.pro @@ -83,3 +83,7 @@ TARGET=qtuitest TARGET=$$qtLibraryTarget($$TARGET) CONFIG-=debug_and_release_target + + +target.path += \ + /usr/local/lib \ No newline at end of file diff --git a/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro b/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro index 18af6d4..b455eea 100644 --- a/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro +++ b/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro @@ -58,3 +58,7 @@ mac { CONFIG(debug,debug|release): LIBS += -L$$BUILDROOT/lib -lqtuitest_debug CONFIG(release,debug|release): LIBS += -L$$BUILDROOT/lib -lqtuitest } + + +target.path += \ + /usr/local/lib \ No newline at end of file diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro b/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro index 98a9d13..6129f33 100644 --- a/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro +++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro @@ -51,3 +51,7 @@ mac { CONFIG(release,debug|release): LIBS += -L$$BUILDROOT/lib -lqtuitest } + + +target.path += \ + /usr/local/lib \ No newline at end of file diff --git a/plugins/qtuitest_widgets/qmlwidgets/qmlwidgets.pro b/plugins/qtuitest_widgets/qmlwidgets/qmlwidgets.pro index 1920030..d635b3b 100644 --- a/plugins/qtuitest_widgets/qmlwidgets/qmlwidgets.pro +++ b/plugins/qtuitest_widgets/qmlwidgets/qmlwidgets.pro @@ -49,3 +49,7 @@ contains(QT_CONFIG, webkit) { SOURCES+=testdeclarativewebview.cpp HEADERS+=testdeclarativewebview.h } + + +target.path += \ + /usr/local/lib \ No newline at end of file diff --git a/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro b/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro index bef8035..463b25f 100644 --- a/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro +++ b/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro @@ -104,3 +104,7 @@ contains(QT_CONFIG, webkit) { SOURCES+=testwebview.cpp HEADERS+=testwebview.h } + + +target.path += \ + /usr/local/lib \ No newline at end of file diff --git a/plugins/styles/qtuitest/qtuitest.pro b/plugins/styles/qtuitest/qtuitest.pro index 56343fe..747a07e 100644 --- a/plugins/styles/qtuitest/qtuitest.pro +++ b/plugins/styles/qtuitest/qtuitest.pro @@ -42,3 +42,7 @@ win32 { INSTALLS+=target } + + +target.path += \ + /usr/local/lib \ No newline at end of file diff --git a/qtbindings/qtscript_core/qtscript_core.pro b/qtbindings/qtscript_core/qtscript_core.pro index c1da436..5b7f14d 100644 --- a/qtbindings/qtscript_core/qtscript_core.pro +++ b/qtbindings/qtscript_core/qtscript_core.pro @@ -6,3 +6,10 @@ include($$GENERATEDCPP/com_nokia_qt_core/com_nokia_qt_core.pri) symbian { TARGET.EPOCALLOWDLLDATA=1 } + + +target.path += \ + /usr/local/lib + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/sys_assistant/sys_assistant.pro b/tests/qtuitest/sys_assistant/sys_assistant.pro index 8d30486..e57de58 100644 --- a/tests/qtuitest/sys_assistant/sys_assistant.pro +++ b/tests/qtuitest/sys_assistant/sys_assistant.pro @@ -1,2 +1,9 @@ SOURCES=sys_assistant.js CONFIG+=systemtest + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/sys_designer/sys_designer.pro b/tests/qtuitest/sys_designer/sys_designer.pro index 8ceb9fb..11e35e1 100644 --- a/tests/qtuitest/sys_designer/sys_designer.pro +++ b/tests/qtuitest/sys_designer/sys_designer.pro @@ -1,2 +1,9 @@ SOURCES=sys_designer.js CONFIG+=systemtest + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro b/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro index 14ec53e..60f9afe 100644 --- a/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro +++ b/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro @@ -1,3 +1,10 @@ SOURCES=sys_graphicsView.js TESTAPPS=graphicsViewTest CONFIG+=systemtest + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/sys_input/sys_input.pro b/tests/qtuitest/sys_input/sys_input.pro index 55f9413..6599717 100644 --- a/tests/qtuitest/sys_input/sys_input.pro +++ b/tests/qtuitest/sys_input/sys_input.pro @@ -1,3 +1,10 @@ SOURCES=sys_input.js TESTAPPS=testapp1 testapp2 testapp3 CONFIG+=systemtest + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/sys_linguist/sys_linguist.pro b/tests/qtuitest/sys_linguist/sys_linguist.pro index d5537aa..9edffdd 100644 --- a/tests/qtuitest/sys_linguist/sys_linguist.pro +++ b/tests/qtuitest/sys_linguist/sys_linguist.pro @@ -1,2 +1,9 @@ SOURCES=sys_linguist.js CONFIG+=systemtest + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/testapps/fileDialogSaveApp/fileDialogSaveApp.pro b/tests/qtuitest/testapps/fileDialogSaveApp/fileDialogSaveApp.pro index 82bb3dd..ca4194c 100644 --- a/tests/qtuitest/testapps/fileDialogSaveApp/fileDialogSaveApp.pro +++ b/tests/qtuitest/testapps/fileDialogSaveApp/fileDialogSaveApp.pro @@ -10,3 +10,10 @@ mac:DESTDIR=$$BUILDROOT/bin # Input SOURCES += main.cpp + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro b/tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro index 5166947..d1cb25f 100644 --- a/tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro +++ b/tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro @@ -6,3 +6,10 @@ INCLUDEPATH += . HEADERS += mainwindow.h SOURCES += main.cpp mainwindow.cpp mac:DESTDIR=$$BUILDROOT/bin + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/testapps/testapp1/testapp1.pro b/tests/qtuitest/testapps/testapp1/testapp1.pro index f612e8e..6d4d015 100644 --- a/tests/qtuitest/testapps/testapp1/testapp1.pro +++ b/tests/qtuitest/testapps/testapp1/testapp1.pro @@ -18,3 +18,7 @@ win32 { mac { CONFIG-=app_bundle } + + +target.path += \ + /usr/local/bin \ No newline at end of file diff --git a/tests/qtuitest/testapps/testapp2/testapp2.pro b/tests/qtuitest/testapps/testapp2/testapp2.pro index 04c09f0..ee17bd4 100644 --- a/tests/qtuitest/testapps/testapp2/testapp2.pro +++ b/tests/qtuitest/testapps/testapp2/testapp2.pro @@ -15,3 +15,7 @@ win32 { mac { CONFIG-=app_bundle } + + +target.path += \ + /usr/local/bin \ No newline at end of file diff --git a/tests/qtuitest/testapps/testapp3/testapp3.pro b/tests/qtuitest/testapps/testapp3/testapp3.pro index 04c09f0..ee17bd4 100644 --- a/tests/qtuitest/testapps/testapp3/testapp3.pro +++ b/tests/qtuitest/testapps/testapp3/testapp3.pro @@ -15,3 +15,7 @@ win32 { mac { CONFIG-=app_bundle } + + +target.path += \ + /usr/local/bin \ No newline at end of file diff --git a/tests/qtuitest/testapps/testapp4/testapp4.pro b/tests/qtuitest/testapps/testapp4/testapp4.pro index 04c09f0..ee17bd4 100644 --- a/tests/qtuitest/testapps/testapp4/testapp4.pro +++ b/tests/qtuitest/testapps/testapp4/testapp4.pro @@ -15,3 +15,7 @@ win32 { mac { CONFIG-=app_bundle } + + +target.path += \ + /usr/local/bin \ No newline at end of file diff --git a/tests/qtuitest/tst_qalternatestack/tst_qalternatestack.pro b/tests/qtuitest/tst_qalternatestack/tst_qalternatestack.pro index 905e99c..07546a8 100644 --- a/tests/qtuitest/tst_qalternatestack/tst_qalternatestack.pro +++ b/tests/qtuitest/tst_qalternatestack/tst_qalternatestack.pro @@ -8,3 +8,10 @@ CONFIG-=debug_and_release_target SOURCES+= \ tst_qalternatestack.cpp + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.pro b/tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.pro index e915e3b..da914e0 100644 --- a/tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.pro +++ b/tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.pro @@ -7,3 +7,10 @@ CONFIG-=debug_and_release_target SOURCES+= \ tst_qelapsedtimer.cpp + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.pro b/tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.pro index ac0d31d..4398ab6 100644 --- a/tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.pro +++ b/tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.pro @@ -15,3 +15,10 @@ else { SOURCES+=nativeevent_noop.cpp } + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.pro b/tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.pro index 3f6e0b4..54d1ce6 100644 --- a/tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.pro +++ b/tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.pro @@ -17,3 +17,10 @@ HEADERS+= \ symbian { LIBS+=-L$$OUT_PWD/ -lqtuitest } + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.pro b/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.pro index eba25e3..b672977 100644 --- a/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.pro +++ b/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.pro @@ -7,3 +7,10 @@ CONFIG-=debug_and_release_target SOURCES+= \ tst_qtuitestnamespace.cpp + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file diff --git a/tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.pro b/tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.pro index 57742c0..85a8eaa 100644 --- a/tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.pro +++ b/tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.pro @@ -17,3 +17,10 @@ symbian { win32 { LIBS+=$$OUT_PWD/../../lib/qtuitest.lib } + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target \ No newline at end of file -- cgit v1.2.3 From c12221752edf28da0a75a9606c8a2a6712fec378 Mon Sep 17 00:00:00 2001 From: dac Date: Thu, 22 Jul 2010 11:32:08 +1000 Subject: Enable existing manual tests to display correctly --- libqsystemtest/qsystemtest.cpp | 7 +++++++ libqsystemtest/qsystemtest.h | 2 +- libqsystemtest/qsystemtest_p.cpp | 11 ++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libqsystemtest/qsystemtest.cpp b/libqsystemtest/qsystemtest.cpp index 11d6c5b..882164d 100644 --- a/libqsystemtest/qsystemtest.cpp +++ b/libqsystemtest/qsystemtest.cpp @@ -2998,6 +2998,13 @@ QString QSystemTest::stopRecordingEvents() */ void QSystemTest::prompt( const QString &manualSteps ) { + if (manualSteps.contains(QRegExp("<.*>.*"))) + { + // Contains HTML, don't assume it's a series of steps + showPromptDialog(manualSteps); + return; + } + QStringList list = manualSteps.split("\n", QString::SkipEmptyParts); foreach( QString cmd, list) manualTest(cmd); diff --git a/libqsystemtest/qsystemtest.h b/libqsystemtest/qsystemtest.h index 69ece0b..17d9bd1 100644 --- a/libqsystemtest/qsystemtest.h +++ b/libqsystemtest/qsystemtest.h @@ -520,7 +520,7 @@ private: QString m_manual_commands; QStringList m_manual_command_data; QStringList alternative_command_data; - void showPromptDialog(); + void showPromptDialog(const QString& = QString()); bool isConnected(); // the following parameters are used to start an Application_Under_Test diff --git a/libqsystemtest/qsystemtest_p.cpp b/libqsystemtest/qsystemtest_p.cpp index 1cfccc2..82e684f 100644 --- a/libqsystemtest/qsystemtest_p.cpp +++ b/libqsystemtest/qsystemtest_p.cpp @@ -821,10 +821,15 @@ QStringList QSystemTest::processEnvironment( QStringList const& in ) const return out; } -void QSystemTest::showPromptDialog() +void QSystemTest::showPromptDialog( const QString &text ) { - QString promptText = m_manual_commands; - m_manual_commands.clear(); + QString promptText; + if (text.isNull()) { + promptText = m_manual_commands; + m_manual_commands.clear(); + } else { + promptText = text; + } if (promptText.isEmpty()) { recordEvents( "" ); -- cgit v1.2.3 From 0c3794fdee0ab25fa365664a9e64ab14297cd92d Mon Sep 17 00:00:00 2001 From: dac Date: Thu, 22 Jul 2010 14:37:42 +1000 Subject: Rename .js test scripts to have .qtt suffix --- tests/qtuitest/sys_assistant/sys_assistant.js | 231 ------------ tests/qtuitest/sys_assistant/sys_assistant.pro | 2 +- tests/qtuitest/sys_assistant/sys_assistant.qtt | 231 ++++++++++++ tests/qtuitest/sys_designer/sys_designer.js | 419 --------------------- tests/qtuitest/sys_designer/sys_designer.pro | 2 +- tests/qtuitest/sys_designer/sys_designer.qtt | 419 +++++++++++++++++++++ .../qtuitest/sys_graphicsView/sys_graphicsView.js | 55 --- .../qtuitest/sys_graphicsView/sys_graphicsView.pro | 2 +- .../qtuitest/sys_graphicsView/sys_graphicsView.qtt | 55 +++ tests/qtuitest/sys_input/sys_input.js | 399 -------------------- tests/qtuitest/sys_input/sys_input.pro | 2 +- tests/qtuitest/sys_input/sys_input.qtt | 399 ++++++++++++++++++++ tests/qtuitest/sys_linguist/sys_linguist.js | 152 -------- tests/qtuitest/sys_linguist/sys_linguist.pro | 2 +- tests/qtuitest/sys_linguist/sys_linguist.qtt | 152 ++++++++ tests/shared/filedialog.js | 113 ------ tests/shared/filedialog.qtt | 113 ++++++ 17 files changed, 1374 insertions(+), 1374 deletions(-) delete mode 100644 tests/qtuitest/sys_assistant/sys_assistant.js create mode 100644 tests/qtuitest/sys_assistant/sys_assistant.qtt delete mode 100644 tests/qtuitest/sys_designer/sys_designer.js create mode 100644 tests/qtuitest/sys_designer/sys_designer.qtt delete mode 100644 tests/qtuitest/sys_graphicsView/sys_graphicsView.js create mode 100644 tests/qtuitest/sys_graphicsView/sys_graphicsView.qtt delete mode 100644 tests/qtuitest/sys_input/sys_input.js create mode 100644 tests/qtuitest/sys_input/sys_input.qtt delete mode 100644 tests/qtuitest/sys_linguist/sys_linguist.js create mode 100644 tests/qtuitest/sys_linguist/sys_linguist.qtt delete mode 100644 tests/shared/filedialog.js create mode 100644 tests/shared/filedialog.qtt diff --git a/tests/qtuitest/sys_assistant/sys_assistant.js b/tests/qtuitest/sys_assistant/sys_assistant.js deleted file mode 100644 index f2449d4..0000000 --- a/tests/qtuitest/sys_assistant/sys_assistant.js +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of QtUiTest. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -testcase = { - - //TODO: In Progress. Not expected to pass (or even work correctly) yet. - - init: function() { - startApplication("assistant"); - if (getLabels().contains("Updating search index")) { - print("Waiting for search index update to complete..."); - waitFor(60000) { - return (!getLabels().contains("Updating search index")); - } - } - }, - - check_registered_docs: function() { - select("Edit/Preferences...", menuBar()); - select("Documentation", tabBar()); - setLabelOrientation(LabelAbove); - var docs = getText("Registered Documentation:"); - if (!docs.contains("com.trolltech.assistant.") || - !docs.contains("com.trolltech.designer.") || - !docs.contains("com.trolltech.linguist.") || - !docs.contains("com.trolltech.qmake.") || - !docs.contains("com.trolltech.qt.")) { - fail("Documentation has not been registered. Subsequent tests will fail."); - } - }, - - browse_contents: function() { - select("Contents", tabBar()); - var content = helpContent(); - - select("Qt Linguist Manual/Manual", content); - waitFor() { return(getText(tabBar(1)).contains("Qt Linguist Manual")); } - - select("Qt Reference Documentation/Overviews/An Introduction to Model\\/View Programming", content); - waitFor() { return(getText(tabBar(1)).contains("An Introduction to Model/View Programming")); } - - select("Qt Reference Documentation/Classes/QList Class Reference/List of all members", content); - waitFor() { return(getText(tabBar(1)).contains("List of All Members for QList")); } - }, - - browse_index_data: { - countryToString: [ "countryToString", "QLocale Class Reference" ] - }, - - browse_index: function(item, pageTitle) { - select("Index", tabBar()); - var indexWidget = helpIndex(); - - select(item, indexWidget); - select("Open Link", contextMenu()); - waitFor() { return(getText(tabBar(1)).contains(pageTitle)); } - }, - - create_bookmark_data: { - one: [ "sys_assistant", "test_subfolder" ] - }, - - create_bookmark: function(topLevelFolder, subFolder) { - select("Bookmarks", tabBar()); - var bookmarkTree = helpBookmarks(); - - // If there is already a folder with the same name, remove it - if (getList(bookmarkTree).contains(topLevelFolder)) { - select(topLevelFolder, bookmarkTree); - select("Bookmarks/Remove"); - select("Yes"); - } - - // Create a new bookmark - select("Bookmarks/Add"); - var pageName = getText("Bookmark:").replace(/\//g, "\\\\/");; - select("+"); - select("New Folder"); - select("Rename Folder", contextMenu()); - enter(topLevelFolder); - select("New Folder"); - select("Rename Folder", contextMenu()); - enter(subFolder); - select("OK"); - - // Verify that it is in the list - var bookmarkList = getList(bookmarkTree); - verify(bookmarkList.contains(topLevelFolder)); - verify(bookmarkList.contains(topLevelFolder + "/" + subFolder)); - verify(bookmarkList.contains(topLevelFolder + "/" + subFolder + "/" + pageName)); - - // Remove it - select(topLevelFolder, bookmarkTree); - select("Bookmarks/Remove"); - select("Yes"); - - // Verify that it is no longer in the list - var bookmarkList = getList(bookmarkTree); - verify(!bookmarkList.contains(topLevelFolder)); - verify(!bookmarkList.contains(topLevelFolder + "/" + subFolder)); - verify(!bookmarkList.contains(topLevelFolder + "/" + subFolder + "/" + pageName)); - }, - - search_data: { - simpleText: [ "Simple Text", "Simple Text Viewer Example" ], - designerWidgets: [ "Designer Widgets", "Creating Custom Widgets for Qt Designer" ], - includePath: [ "INCLUDEPATH", "qmake Variable Reference" ] - }, - - search: function(query, expectedResult) { - select("View/Search", menuBar()); - select("Search", tabBar(1)); - enter(query, "Search for:"); - select("Search"); - var results = searchResults(); - waitFor() { return(getText(results).contains(expectedResult)); } - select(expectedResult, results); - waitFor() { return(getText(tabBar(1)).contains(expectedResult)); } - verify(getText(helpViewer()).contains(expectedResult)); - }, - - follow_links_data: { - one: [ "Qt Reference Documentation/Overviews/View Classes", "View Classes", - [ ["delegates", "Delegate Classes"], - ["Spin Box Delegate", "Spin Box Delegate Example"], - ["QItemDelegate", "QItemDelegate Class Reference"], - ["QSqlRelationalDelegate","QSqlRelationalDelegate Class Reference"] ] ] - }, - - follow_links: function(browseItem, firstTitle, links) { - - // Select browseItem from the Contents - select("Contents", tabBar()); - var content = helpContent(); - select(browseItem, content); - waitFor() { return(getText(tabBar(1)).contains(firstTitle)); } - - // Get a handle for the Help Viewer widget - var viewer = helpViewer(); //findByProperty( { inherits: "QWebView" } ); - - // Click on each link in turn - for (var i=0; i=0; --i) { - verify(getText(tabBar(1)).contains(links[i][1])); - select("Back"); - } - - // ... and confirm that we're back to the first page - verify(getText(tabBar(1)).contains(firstTitle)); - } - -} - -function contextMenu() -{ - keyClick(Qt.Key_Menu); - var menu = findByProperty( { inherits: "QMenu" } ); - if (menu.isEmpty()) { - fail("Context menu did not appear."); - } - return menu[0]; -} - -function helpViewer() -{ - return findByProperty( { className: "HelpViewer" } ); -} - -function helpContent() -{ - return findByProperty( { className: "QHelpContentWidget" } ); -} - -function helpIndex() -{ - return findByProperty( { className: "QHelpIndexWidget" } ); -} - -function helpBookmarks() -{ - return findByProperty( { child_of: "Bookmarks", inherits: "QTreeView" } ); -} - -function searchResults() -{ - return findByProperty( { className: "QCLuceneResultWidget" } ); -} diff --git a/tests/qtuitest/sys_assistant/sys_assistant.pro b/tests/qtuitest/sys_assistant/sys_assistant.pro index 8d30486..79485c9 100644 --- a/tests/qtuitest/sys_assistant/sys_assistant.pro +++ b/tests/qtuitest/sys_assistant/sys_assistant.pro @@ -1,2 +1,2 @@ -SOURCES=sys_assistant.js +SOURCES=sys_assistant.qtt CONFIG+=systemtest diff --git a/tests/qtuitest/sys_assistant/sys_assistant.qtt b/tests/qtuitest/sys_assistant/sys_assistant.qtt new file mode 100644 index 0000000..f2449d4 --- /dev/null +++ b/tests/qtuitest/sys_assistant/sys_assistant.qtt @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +testcase = { + + //TODO: In Progress. Not expected to pass (or even work correctly) yet. + + init: function() { + startApplication("assistant"); + if (getLabels().contains("Updating search index")) { + print("Waiting for search index update to complete..."); + waitFor(60000) { + return (!getLabels().contains("Updating search index")); + } + } + }, + + check_registered_docs: function() { + select("Edit/Preferences...", menuBar()); + select("Documentation", tabBar()); + setLabelOrientation(LabelAbove); + var docs = getText("Registered Documentation:"); + if (!docs.contains("com.trolltech.assistant.") || + !docs.contains("com.trolltech.designer.") || + !docs.contains("com.trolltech.linguist.") || + !docs.contains("com.trolltech.qmake.") || + !docs.contains("com.trolltech.qt.")) { + fail("Documentation has not been registered. Subsequent tests will fail."); + } + }, + + browse_contents: function() { + select("Contents", tabBar()); + var content = helpContent(); + + select("Qt Linguist Manual/Manual", content); + waitFor() { return(getText(tabBar(1)).contains("Qt Linguist Manual")); } + + select("Qt Reference Documentation/Overviews/An Introduction to Model\\/View Programming", content); + waitFor() { return(getText(tabBar(1)).contains("An Introduction to Model/View Programming")); } + + select("Qt Reference Documentation/Classes/QList Class Reference/List of all members", content); + waitFor() { return(getText(tabBar(1)).contains("List of All Members for QList")); } + }, + + browse_index_data: { + countryToString: [ "countryToString", "QLocale Class Reference" ] + }, + + browse_index: function(item, pageTitle) { + select("Index", tabBar()); + var indexWidget = helpIndex(); + + select(item, indexWidget); + select("Open Link", contextMenu()); + waitFor() { return(getText(tabBar(1)).contains(pageTitle)); } + }, + + create_bookmark_data: { + one: [ "sys_assistant", "test_subfolder" ] + }, + + create_bookmark: function(topLevelFolder, subFolder) { + select("Bookmarks", tabBar()); + var bookmarkTree = helpBookmarks(); + + // If there is already a folder with the same name, remove it + if (getList(bookmarkTree).contains(topLevelFolder)) { + select(topLevelFolder, bookmarkTree); + select("Bookmarks/Remove"); + select("Yes"); + } + + // Create a new bookmark + select("Bookmarks/Add"); + var pageName = getText("Bookmark:").replace(/\//g, "\\\\/");; + select("+"); + select("New Folder"); + select("Rename Folder", contextMenu()); + enter(topLevelFolder); + select("New Folder"); + select("Rename Folder", contextMenu()); + enter(subFolder); + select("OK"); + + // Verify that it is in the list + var bookmarkList = getList(bookmarkTree); + verify(bookmarkList.contains(topLevelFolder)); + verify(bookmarkList.contains(topLevelFolder + "/" + subFolder)); + verify(bookmarkList.contains(topLevelFolder + "/" + subFolder + "/" + pageName)); + + // Remove it + select(topLevelFolder, bookmarkTree); + select("Bookmarks/Remove"); + select("Yes"); + + // Verify that it is no longer in the list + var bookmarkList = getList(bookmarkTree); + verify(!bookmarkList.contains(topLevelFolder)); + verify(!bookmarkList.contains(topLevelFolder + "/" + subFolder)); + verify(!bookmarkList.contains(topLevelFolder + "/" + subFolder + "/" + pageName)); + }, + + search_data: { + simpleText: [ "Simple Text", "Simple Text Viewer Example" ], + designerWidgets: [ "Designer Widgets", "Creating Custom Widgets for Qt Designer" ], + includePath: [ "INCLUDEPATH", "qmake Variable Reference" ] + }, + + search: function(query, expectedResult) { + select("View/Search", menuBar()); + select("Search", tabBar(1)); + enter(query, "Search for:"); + select("Search"); + var results = searchResults(); + waitFor() { return(getText(results).contains(expectedResult)); } + select(expectedResult, results); + waitFor() { return(getText(tabBar(1)).contains(expectedResult)); } + verify(getText(helpViewer()).contains(expectedResult)); + }, + + follow_links_data: { + one: [ "Qt Reference Documentation/Overviews/View Classes", "View Classes", + [ ["delegates", "Delegate Classes"], + ["Spin Box Delegate", "Spin Box Delegate Example"], + ["QItemDelegate", "QItemDelegate Class Reference"], + ["QSqlRelationalDelegate","QSqlRelationalDelegate Class Reference"] ] ] + }, + + follow_links: function(browseItem, firstTitle, links) { + + // Select browseItem from the Contents + select("Contents", tabBar()); + var content = helpContent(); + select(browseItem, content); + waitFor() { return(getText(tabBar(1)).contains(firstTitle)); } + + // Get a handle for the Help Viewer widget + var viewer = helpViewer(); //findByProperty( { inherits: "QWebView" } ); + + // Click on each link in turn + for (var i=0; i=0; --i) { + verify(getText(tabBar(1)).contains(links[i][1])); + select("Back"); + } + + // ... and confirm that we're back to the first page + verify(getText(tabBar(1)).contains(firstTitle)); + } + +} + +function contextMenu() +{ + keyClick(Qt.Key_Menu); + var menu = findByProperty( { inherits: "QMenu" } ); + if (menu.isEmpty()) { + fail("Context menu did not appear."); + } + return menu[0]; +} + +function helpViewer() +{ + return findByProperty( { className: "HelpViewer" } ); +} + +function helpContent() +{ + return findByProperty( { className: "QHelpContentWidget" } ); +} + +function helpIndex() +{ + return findByProperty( { className: "QHelpIndexWidget" } ); +} + +function helpBookmarks() +{ + return findByProperty( { child_of: "Bookmarks", inherits: "QTreeView" } ); +} + +function searchResults() +{ + return findByProperty( { className: "QCLuceneResultWidget" } ); +} diff --git a/tests/qtuitest/sys_designer/sys_designer.js b/tests/qtuitest/sys_designer/sys_designer.js deleted file mode 100644 index 7defc99..0000000 --- a/tests/qtuitest/sys_designer/sys_designer.js +++ /dev/null @@ -1,419 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of QtUiTest. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -testcase = { - - //TODO: In Progress. Not expected to pass (or even work correctly) yet. - - init: function() { - clearCachedWidgets(); - startApplication("designer"); - - if (currentTitle() == translate("QDesignerWorkbench", "Backup Information")) { - select(translate("QDialogButtonBox", "&No")); - } - - select("Widgets/QFrame"); - select("Create"); - - select("Expand all", contextMenu(widgetBoxTree())); - select("List View", contextMenu(widgetBoxTree())); - }, - - test1: function() { - var fc = getGeometry(formWindow()).center(); - - // Create a form layout and add some rows to it... - dragItem("Layouts/Form Layout", widgetBoxTree(), fc); - - select("Frame/formLayout", objectInspector()); - select("Add form layout row...", contextMenu()); - enter("LineEdit1", "Label text:"); - select("QLineEdit", "Field type:"); - select("OK"); - - select("Frame/formLayout", objectInspector()); - select("Add form layout row...", contextMenu()); - enter("ComboBox1", "Label text:"); - select("QComboBox", "Field type:"); - select("OK"); - - // Set the available items in the combobox... - select("Edit Items...", contextMenu("ComboBox1")); - select("New"); - enter("One"); - select("New"); - enter("Two"); - select("New"); - enter("Three"); - select("New"); - enter("Four"); - select("New"); - enter("Five"); - select("OK"); - - // Edit signal/slot connections using the interactive editor... - select("Edit/Edit Signals\\/Slots", mainMenuBar()); - - // The labels don't seem to have buddy widgets set, although they are set - // correctly when previewed. So the combobox ends up being self-labelled - drag(getGeometry("One").center(), getGeometry("LineEdit1").center()); - var sigSlotList = findByProperty( { className: "QListWidget" } ); - select("activated(QString)", sigSlotList[0]); - select("setText(QString)", sigSlotList[1]); - select("OK"); - - // Preview, ensure that changing the combobox value also changes the lineedit value... - select("Form/Preview...", mainMenuBar()); - - select("Three", "ComboBox1"); - compare(getText("LineEdit1"), "Three"); - }, - - test2: function() { - // Add some radio buttons to the form... - var fc = getGeometry(formWindow()).center(); - dragItem("Buttons/Radio Button", widgetBoxTree(), fc); - dragItem("Buttons/Radio Button", widgetBoxTree(), fc); - dragItem("Buttons/Radio Button", widgetBoxTree(), fc); - dragItem("Buttons/Radio Button", widgetBoxTree(), fc); - - // Set widget properties... - select("Frame/radioButton", objectInspector()); - selectProperty("QAbstractButton/text"); - enter("Radio 1"); - - select("Frame/radioButton_2", objectInspector()); - selectProperty("QAbstractButton/text"); - enter("Radio 2"); - - select("Frame/radioButton_3", objectInspector()); - selectProperty("QAbstractButton/text"); - enter("Radio 3"); - - select("Frame/radioButton_4", objectInspector()); - selectProperty("QAbstractButton/text"); - enter("Radio 4"); - - // Set layout... - select("Edit/Select All", mainMenuBar()); - select("Assign to button group/New button group", contextMenu("Radio 1")); - select("Form/Lay Out Vertically", mainMenuBar()); - - // Preview, to ensure only one radio button can be active at a time... - select("Form/Preview...", mainMenuBar()); - - setChecked(true, "Radio 1"); - verify(!isChecked("Radio 2")); - verify(!isChecked("Radio 3")); - verify(!isChecked("Radio 4")); - - setChecked(true, "Radio 2"); - verify(!isChecked("Radio 1")); - verify(!isChecked("Radio 3")); - verify(!isChecked("Radio 4")); - - setChecked(true, "Radio 3"); - verify(!isChecked("Radio 1")); - verify(!isChecked("Radio 2")); - verify(!isChecked("Radio 4")); - - setChecked(true, "Radio 4"); - verify(!isChecked("Radio 1")); - verify(!isChecked("Radio 2")); - verify(!isChecked("Radio 3")); - - // Close the preview window... - invokeMethod(activeWindow(), "close()"); - - // Change the exclusive property of the button group... - select("Frame/buttonGroup", objectInspector()); - selectProperty("QButtonGroup/exclusive"); - setChecked(false); - - // Preview, ensure that all buttons can be set at once... - select("Form/Preview...", mainMenuBar()); - - setChecked(true, "Radio 1"); - setChecked(true, "Radio 2"); - setChecked(true, "Radio 3"); - setChecked(true, "Radio 4"); - verify(isChecked("Radio 1")); - verify(isChecked("Radio 2")); - verify(isChecked("Radio 3")); - verify(isChecked("Radio 4")); - }, - - test3: function() { - var fc = getGeometry(formWindow()).center(); - - // Add some widgets to the form... - dragItem("Input Widgets/Line Edit", widgetBoxTree(), new QPoint(fc.x()+30, fc.y()-20)); - dragItem("Input Widgets/Spin Box", widgetBoxTree(), new QPoint(fc.x()-30, fc.y()+20)); - dragItem("Display Widgets/Label", widgetBoxTree(), new QPoint(fc.x()-30, fc.y()-20)); - dragItem("Display Widgets/Label", widgetBoxTree(), new QPoint(fc.x()+30, fc.y()+20)); - dragItem("Buttons/Push Button", widgetBoxTree(), new QPoint(fc.x()-30, fc.y()+40)); - dragItem("Buttons/Push Button", widgetBoxTree(), new QPoint(fc.x()+30, fc.y()+40)); - - select("Edit/Select All", mainMenuBar()); - select("Form/Lay Out in a Grid", mainMenuBar()); - - // Set widget properties... - select("Frame/gridLayout/label", objectInspector()); - selectProperty("QLabel/text"); - enter("LineEdit1"); - - select("Frame/gridLayout/label_2", objectInspector()); - selectProperty("QLabel/text"); - enter("SpinBox1"); - - select("Frame/gridLayout/pushButton", objectInspector()); - selectProperty("QAbstractButton/text"); - enter("Down"); - - select("Frame/gridLayout/pushButton_2", objectInspector()); - selectProperty("QAbstractButton/text"); - enter("Up"); - - select("Frame/gridLayout/spinBox", objectInspector()); - selectProperty("QSpinBox/maximum"); - enter(100); - - selectProperty("QAbstractSpinBox/specialValueText"); - enter("Infinity"); - - // Set buddies... - select("Edit/Edit Buddies", mainMenuBar()); - drag(getGeometry(findByProperty( { text: "LineEdit1" } )).center(), getGeometry(findByProperty( { className: "QLineEdit"} )).center()); - drag(getGeometry(findByProperty( { text: "SpinBox1" } )).center(), getGeometry(findByProperty( { className: "QSpinBox"} )).center()); - - // Set up signal/slot connections... - connectSignalSlot("spinBox", "valueChanged(QString)", "lineEdit", "setText(QString)"); - connectSignalSlot("pushButton", "clicked()", "spinBox", "stepDown()") - connectSignalSlot("pushButton_2", "clicked()","spinBox" , "stepUp()"); - - // Preview the form, and make sure it behaves as expected... - select("Form/Preview...", mainMenuBar()); - - enter(50, "SpinBox1"); - compare(50, getText("LineEdit1")); - - for (var i=0; i<8; ++i) { - select("Down"); - } - compare(42, getText("LineEdit1")); - - enter(5, "SpinBox1"); - compare(5, getText("LineEdit1")); - - for (var i=0; i<4; ++i) { - select("Down"); - } - compare(1, getText("LineEdit1")); - select("Down"); - compare("Infinity", getText("LineEdit1")); - select("Down"); - compare("Infinity", getText("LineEdit1")); - - enter(95, "SpinBox1"); - compare(95, getText("LineEdit1")); - - for (var i=0; i<4; ++i) { - select("Up"); - } - compare(99, getText("LineEdit1")); - select("Up"); - compare(100, getText("LineEdit1")); - select("Up"); - compare(100, getText("LineEdit1")); - - enter("Goodbye", "LineEdit1"); - compare(100, getText("SpinBox1")); - } - -} - -function dragItem(item, widget, point) -{ - ensureVisible(item, widget); - var center = getCenter(item, widget); - drag(center, point); -} - -function drag(a, b) -{ - var dx = (b.x() - a.x()); - var dy = (b.y() - a.y()); - var steps = 2 + (Math.abs(dx) + Math.abs(dy))/20; - dx = dx/steps; - dy = dy/steps; - var x=a.x(); - var y=a.y(); - mousePress(x, y); - wait(200); - for (var i=0; i", testcase.cachedWidgets.signalSlotView); - enter(sender); - select("", testcase.cachedWidgets.signalSlotView); - enter(signal); - select("", testcase.cachedWidgets.signalSlotView); - enter(receiver); - select("", testcase.cachedWidgets.signalSlotView); - enter(slot); -} \ No newline at end of file diff --git a/tests/qtuitest/sys_designer/sys_designer.pro b/tests/qtuitest/sys_designer/sys_designer.pro index 8ceb9fb..a394b57 100644 --- a/tests/qtuitest/sys_designer/sys_designer.pro +++ b/tests/qtuitest/sys_designer/sys_designer.pro @@ -1,2 +1,2 @@ -SOURCES=sys_designer.js +SOURCES=sys_designer.qtt CONFIG+=systemtest diff --git a/tests/qtuitest/sys_designer/sys_designer.qtt b/tests/qtuitest/sys_designer/sys_designer.qtt new file mode 100644 index 0000000..7defc99 --- /dev/null +++ b/tests/qtuitest/sys_designer/sys_designer.qtt @@ -0,0 +1,419 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +testcase = { + + //TODO: In Progress. Not expected to pass (or even work correctly) yet. + + init: function() { + clearCachedWidgets(); + startApplication("designer"); + + if (currentTitle() == translate("QDesignerWorkbench", "Backup Information")) { + select(translate("QDialogButtonBox", "&No")); + } + + select("Widgets/QFrame"); + select("Create"); + + select("Expand all", contextMenu(widgetBoxTree())); + select("List View", contextMenu(widgetBoxTree())); + }, + + test1: function() { + var fc = getGeometry(formWindow()).center(); + + // Create a form layout and add some rows to it... + dragItem("Layouts/Form Layout", widgetBoxTree(), fc); + + select("Frame/formLayout", objectInspector()); + select("Add form layout row...", contextMenu()); + enter("LineEdit1", "Label text:"); + select("QLineEdit", "Field type:"); + select("OK"); + + select("Frame/formLayout", objectInspector()); + select("Add form layout row...", contextMenu()); + enter("ComboBox1", "Label text:"); + select("QComboBox", "Field type:"); + select("OK"); + + // Set the available items in the combobox... + select("Edit Items...", contextMenu("ComboBox1")); + select("New"); + enter("One"); + select("New"); + enter("Two"); + select("New"); + enter("Three"); + select("New"); + enter("Four"); + select("New"); + enter("Five"); + select("OK"); + + // Edit signal/slot connections using the interactive editor... + select("Edit/Edit Signals\\/Slots", mainMenuBar()); + + // The labels don't seem to have buddy widgets set, although they are set + // correctly when previewed. So the combobox ends up being self-labelled + drag(getGeometry("One").center(), getGeometry("LineEdit1").center()); + var sigSlotList = findByProperty( { className: "QListWidget" } ); + select("activated(QString)", sigSlotList[0]); + select("setText(QString)", sigSlotList[1]); + select("OK"); + + // Preview, ensure that changing the combobox value also changes the lineedit value... + select("Form/Preview...", mainMenuBar()); + + select("Three", "ComboBox1"); + compare(getText("LineEdit1"), "Three"); + }, + + test2: function() { + // Add some radio buttons to the form... + var fc = getGeometry(formWindow()).center(); + dragItem("Buttons/Radio Button", widgetBoxTree(), fc); + dragItem("Buttons/Radio Button", widgetBoxTree(), fc); + dragItem("Buttons/Radio Button", widgetBoxTree(), fc); + dragItem("Buttons/Radio Button", widgetBoxTree(), fc); + + // Set widget properties... + select("Frame/radioButton", objectInspector()); + selectProperty("QAbstractButton/text"); + enter("Radio 1"); + + select("Frame/radioButton_2", objectInspector()); + selectProperty("QAbstractButton/text"); + enter("Radio 2"); + + select("Frame/radioButton_3", objectInspector()); + selectProperty("QAbstractButton/text"); + enter("Radio 3"); + + select("Frame/radioButton_4", objectInspector()); + selectProperty("QAbstractButton/text"); + enter("Radio 4"); + + // Set layout... + select("Edit/Select All", mainMenuBar()); + select("Assign to button group/New button group", contextMenu("Radio 1")); + select("Form/Lay Out Vertically", mainMenuBar()); + + // Preview, to ensure only one radio button can be active at a time... + select("Form/Preview...", mainMenuBar()); + + setChecked(true, "Radio 1"); + verify(!isChecked("Radio 2")); + verify(!isChecked("Radio 3")); + verify(!isChecked("Radio 4")); + + setChecked(true, "Radio 2"); + verify(!isChecked("Radio 1")); + verify(!isChecked("Radio 3")); + verify(!isChecked("Radio 4")); + + setChecked(true, "Radio 3"); + verify(!isChecked("Radio 1")); + verify(!isChecked("Radio 2")); + verify(!isChecked("Radio 4")); + + setChecked(true, "Radio 4"); + verify(!isChecked("Radio 1")); + verify(!isChecked("Radio 2")); + verify(!isChecked("Radio 3")); + + // Close the preview window... + invokeMethod(activeWindow(), "close()"); + + // Change the exclusive property of the button group... + select("Frame/buttonGroup", objectInspector()); + selectProperty("QButtonGroup/exclusive"); + setChecked(false); + + // Preview, ensure that all buttons can be set at once... + select("Form/Preview...", mainMenuBar()); + + setChecked(true, "Radio 1"); + setChecked(true, "Radio 2"); + setChecked(true, "Radio 3"); + setChecked(true, "Radio 4"); + verify(isChecked("Radio 1")); + verify(isChecked("Radio 2")); + verify(isChecked("Radio 3")); + verify(isChecked("Radio 4")); + }, + + test3: function() { + var fc = getGeometry(formWindow()).center(); + + // Add some widgets to the form... + dragItem("Input Widgets/Line Edit", widgetBoxTree(), new QPoint(fc.x()+30, fc.y()-20)); + dragItem("Input Widgets/Spin Box", widgetBoxTree(), new QPoint(fc.x()-30, fc.y()+20)); + dragItem("Display Widgets/Label", widgetBoxTree(), new QPoint(fc.x()-30, fc.y()-20)); + dragItem("Display Widgets/Label", widgetBoxTree(), new QPoint(fc.x()+30, fc.y()+20)); + dragItem("Buttons/Push Button", widgetBoxTree(), new QPoint(fc.x()-30, fc.y()+40)); + dragItem("Buttons/Push Button", widgetBoxTree(), new QPoint(fc.x()+30, fc.y()+40)); + + select("Edit/Select All", mainMenuBar()); + select("Form/Lay Out in a Grid", mainMenuBar()); + + // Set widget properties... + select("Frame/gridLayout/label", objectInspector()); + selectProperty("QLabel/text"); + enter("LineEdit1"); + + select("Frame/gridLayout/label_2", objectInspector()); + selectProperty("QLabel/text"); + enter("SpinBox1"); + + select("Frame/gridLayout/pushButton", objectInspector()); + selectProperty("QAbstractButton/text"); + enter("Down"); + + select("Frame/gridLayout/pushButton_2", objectInspector()); + selectProperty("QAbstractButton/text"); + enter("Up"); + + select("Frame/gridLayout/spinBox", objectInspector()); + selectProperty("QSpinBox/maximum"); + enter(100); + + selectProperty("QAbstractSpinBox/specialValueText"); + enter("Infinity"); + + // Set buddies... + select("Edit/Edit Buddies", mainMenuBar()); + drag(getGeometry(findByProperty( { text: "LineEdit1" } )).center(), getGeometry(findByProperty( { className: "QLineEdit"} )).center()); + drag(getGeometry(findByProperty( { text: "SpinBox1" } )).center(), getGeometry(findByProperty( { className: "QSpinBox"} )).center()); + + // Set up signal/slot connections... + connectSignalSlot("spinBox", "valueChanged(QString)", "lineEdit", "setText(QString)"); + connectSignalSlot("pushButton", "clicked()", "spinBox", "stepDown()") + connectSignalSlot("pushButton_2", "clicked()","spinBox" , "stepUp()"); + + // Preview the form, and make sure it behaves as expected... + select("Form/Preview...", mainMenuBar()); + + enter(50, "SpinBox1"); + compare(50, getText("LineEdit1")); + + for (var i=0; i<8; ++i) { + select("Down"); + } + compare(42, getText("LineEdit1")); + + enter(5, "SpinBox1"); + compare(5, getText("LineEdit1")); + + for (var i=0; i<4; ++i) { + select("Down"); + } + compare(1, getText("LineEdit1")); + select("Down"); + compare("Infinity", getText("LineEdit1")); + select("Down"); + compare("Infinity", getText("LineEdit1")); + + enter(95, "SpinBox1"); + compare(95, getText("LineEdit1")); + + for (var i=0; i<4; ++i) { + select("Up"); + } + compare(99, getText("LineEdit1")); + select("Up"); + compare(100, getText("LineEdit1")); + select("Up"); + compare(100, getText("LineEdit1")); + + enter("Goodbye", "LineEdit1"); + compare(100, getText("SpinBox1")); + } + +} + +function dragItem(item, widget, point) +{ + ensureVisible(item, widget); + var center = getCenter(item, widget); + drag(center, point); +} + +function drag(a, b) +{ + var dx = (b.x() - a.x()); + var dy = (b.y() - a.y()); + var steps = 2 + (Math.abs(dx) + Math.abs(dy))/20; + dx = dx/steps; + dy = dy/steps; + var x=a.x(); + var y=a.y(); + mousePress(x, y); + wait(200); + for (var i=0; i", testcase.cachedWidgets.signalSlotView); + enter(sender); + select("", testcase.cachedWidgets.signalSlotView); + enter(signal); + select("", testcase.cachedWidgets.signalSlotView); + enter(receiver); + select("", testcase.cachedWidgets.signalSlotView); + enter(slot); +} \ No newline at end of file diff --git a/tests/qtuitest/sys_graphicsView/sys_graphicsView.js b/tests/qtuitest/sys_graphicsView/sys_graphicsView.js deleted file mode 100644 index 9e23617..0000000 --- a/tests/qtuitest/sys_graphicsView/sys_graphicsView.js +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of QtUiTest. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -testcase = { - - //TODO: In Progress. Not expected to pass (or even work correctly) yet. - - launch_app: function() { - startApplication("graphicsViewTest"); - - print(getLabels()); - verifyImage("test1", "here is some text"); - verifyImage("test2", "and here is some more"); - prompt(activeWidgetInfo()); - } -} \ No newline at end of file diff --git a/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro b/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro index 14ec53e..4cae852 100644 --- a/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro +++ b/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro @@ -1,3 +1,3 @@ -SOURCES=sys_graphicsView.js +SOURCES=sys_graphicsView.qtt TESTAPPS=graphicsViewTest CONFIG+=systemtest diff --git a/tests/qtuitest/sys_graphicsView/sys_graphicsView.qtt b/tests/qtuitest/sys_graphicsView/sys_graphicsView.qtt new file mode 100644 index 0000000..9e23617 --- /dev/null +++ b/tests/qtuitest/sys_graphicsView/sys_graphicsView.qtt @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +testcase = { + + //TODO: In Progress. Not expected to pass (or even work correctly) yet. + + launch_app: function() { + startApplication("graphicsViewTest"); + + print(getLabels()); + verifyImage("test1", "here is some text"); + verifyImage("test2", "and here is some more"); + prompt(activeWidgetInfo()); + } +} \ No newline at end of file diff --git a/tests/qtuitest/sys_input/sys_input.js b/tests/qtuitest/sys_input/sys_input.js deleted file mode 100644 index 51f7301..0000000 --- a/tests/qtuitest/sys_input/sys_input.js +++ /dev/null @@ -1,399 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of QtUiTest. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -testcase = { - - runAsManualTest: function() { - if (!runAsManualTest()) - skip( "This test only makes sense when executed in -force-manual mode" ); - - manualTest( "Do something" ); - startApplication("foobar"); - prompt( "This should all nicely fold into one big prompt" ); - prompt( "Line 1\nLine 2\nLine 3" ); - verify( isVisible( "blah" ) ); - verify( isVisible( activeWindow() ) ); - compare( getText(focusWidget()), "this text" ); - compare( "this text", getText(focusWidget()) ); - compare( getSelectedText(tabBar()), getText(focusWidget()) ); - select( "foo", tabBar() ); - compare( getSelectedText(tabBar()), "First Tab" ); - compare( getSelectedValue("Name"), "a reference value" ); - compare( getValue("Address"), "Elysium road" ); - compare( "Elysium road", getValue("Address") ); - compare( getList( "Friends"), getList( "Other Friends") ); - mouseClick( getCenter( "foo", "bar" ) ); - var l = getLabels( "app" ); - verify(l.contains("Name"), "Verify that labels for 'app' contain 'Name'"); - setClipboardText( l ); - compare( getClipboardText(), "foobar" ); - compare( currentTitle(), "Contacts" ); - compare( getWindowTitles(), "A\nB\nC" ); - activateWindow( "mainwindow" ); - verify( getenv( "PATH" ).contains( "/home/user/foobar" ) ); - verify( checkOS( "linux" ) ); - verifyImage( "task_completed", "", - "Verify that the current task is shown with a green tick indicating completion" ); - verify( compareImage( "expected", "actual" )); - verify( getData("srcFile") == "blah" ); - verify( getImageSize( "srcFile" ) == "12345" ); - getFile("/tmp/foo.conf", "$HOME/Settings/foo.conf" ); - putFile("testdata/my_settings.conf", "$HOME/Settings/foo.conf"); - putFile("testdata/my_file", "$HOME/my_file", 12 ); //QFile.WriteOwner | QFile.ReadOwner | QFile.ReadOther); - }, - - runAutoTest: function() { - if (runAsManualTest()) - skip( "This test only makes sense when NOT executed in -force-manual mode" ); - - startApplication("testapp1"); - manualTest( "step 1"); - manualTest( "step 2"); - manualTest( "step 3"); - - compare(currentTitle(), "testapp1"); - - manualTest( "step4" ); - manualTest( "step5" ); - manualTest( "step6" ); - }, - - activate_tabBar: function() { - startApplication("testapp1"); - - select( "First Tab", tabBar() ); - compare( getSelectedText(tabBar()), "First Tab" ); - - select( "Cow Tab", tabBar() ); - compare( getSelectedText(tabBar()), "Cow Tab" ); - - select( "First Tab", tabBar() ); - compare( getSelectedText(tabBar()), "First Tab" ); - - select( "Awesome Tab", tabBar() ); - compare( getSelectedText(tabBar()), "Awesome Tab" ); - }, - - enter_single_data: { - numeric: "0", - asterisk: "*", - percent: "%", - question: "?", - comma: ",", - lower1: "a", - upper: "B", - lower2: "z" - }, - - enter_single: function(character) { - startApplication("testapp1"); - select( "First Tab", tabBar() ); - enter(character, "Status"); - compare(getText("Status"), character); - - }, - - enter_text: function(text) { - startApplication("testapp1"); - - select( "First Tab", tabBar() ); - enter(text, "LineEdit1"); - compare( getText("Status"), "LineEdit1 text changed" ); - compare( getText("LineEdit1"), text ); - - enter("clear", "LineEdit2"); - compare( getText("Status"), "LineEdit2 text changed" ); - compare( getText("LineEdit2"), "clear" ); - - if (mousePreferred()) { - mouseClick("LineEdit1"); - keyClick(Qt.Key_Home); - mouseClick("LineEdit2"); - } - enter("overwrite", "LineEdit1"); - compare( getText("LineEdit1"), "overwrite" ); - }, - - enter_text_data: { - mixed_case: [ "MiXeD CASe" ], - punctuation: [ "!@#$%^&*()-=_+[]{}\|;:',./<>?`~" ], - allsorts: [ "$100! How Much?" ], - with_numbers: [ "1 2 3SD770 4 25 312" ], - in_dict: [ "hello kitty" ], - not_in_dict: [ "jtnerlnjas mtrnen" ], - long_str: [ "this is a really long string to test we can overwrite properly" ], - - // Test for bug: "Jimmy" sometimes gives "Jinny" in predictive keyboard. - jimmy: [ "Jimmy jimmy" ] - }, - - enter_QTextEdit: function(text) { - startApplication("testapp3"); - - select("Text", tabBar()); - - enter(text, "Text"); - compare( getText("Text"), text ); - - enter("overwrite", "Text"); - compare( getText("Text"), "overwrite" ); - }, - - enter_QTextEdit_data: { - single_line: [ "This is a single line" ], - //multi_lines: [ "This is\nmultiple lines of\n\ntext" ] - alotta_text: [ "This is a lot of text to ensure we get a scroll bar happening yes this is a lot of text to ensure we get a scroll bar happening yes" ] - }, - - enter_QTimeEdit: function(time, shouldPass) { - startApplication("testapp1"); - - select("Awesome Tab", tabBar()); - - if (!shouldPass) expectFail("Bad time given"); - enter(time, "Time"); - - compare( getValue("Time"), time ); - }, - - enter_QTimeEdit_data: { - simple1: [ new QTime(16, 55, 00), true ], - simple2: [ new QTime(14, 10, 38), true ], - sdigit1: [ new QTime(1, 33, 10), true ], - sdigit2: [ new QTime(19, 7, 11), true ], - sdigit3: [ new QTime(22, 21, 1), true ], - - bad1: [ new QTime(25, 21, 1), false ], - bad2: [ new QTime(22, 88, 1), false ], - bad3: [ new QTime(21, 21, -1), false ] - }, - - // enter() with QDateEdit fields. - enter_QDateEdit: function(date) { - startApplication("testapp1"); - - select("Awesome Tab", tabBar()); - - enter(date, "Date"); - - compare( getValue("Date"), date ); - - }, - - enter_QDateEdit_data: { - simple1: [ new Date(2000, 6, 15) ], - december: [ new Date(2000, 12, 15) ], - end_of_month: [ new Date(2002, 6, 30) ], - simple2: [ new Date(2004, 10, 11) ] - }, - - // Explicit mouse clicks on widgets - mouseClick: function() { - startApplication("testapp1"); - select( "Cow Tab", tabBar() ); - compare( getSelectedText(tabBar()), "Cow Tab" ); - - mouseClick("CowButton1"); - compare( getText("CowStatus"), "CowButton1 clicked" ); - - mouseClick("CowButton2"); - compare( getText("CowStatus"), "CowButton2 clicked" ); - - mouseClick("CowButton16"); - compare( getText("CowStatus"), "CowButton16 clicked" ); - - mouseClick("CowButton0"); - compare( getText("CowStatus"), "CowButton0 clicked" ); - }, - - activate_button: function() { - startApplication("testapp1"); - - select("First Tab", tabBar()); - compare( getSelectedText(tabBar()), "First Tab" ); - - select("Button1"); - compare( getText("Status"), "Button1 clicked" ); - select("Button2"); - compare( getText("Status"), "Button2 clicked" ); - }, - - activate_combobox: function() { - startApplication("testapp1"); - - select( "Cow Tab", tabBar() ); - - select( "Woof", "Cow Goes?" ); - compare( getText("CowStatus"), "Cow Goes? changed" ); - compare( getSelectedText("Cow Goes?"), "Woof" ); - - // To clear 'Status' - select( "CowButton0" ); - compare( getText("CowStatus"), "CowButton0 clicked" ); - - select( "Moo", "Cow Goes?" ); - compare( getText("CowStatus"), "Cow Goes? changed" ); - compare( getSelectedText("Cow Goes?"), "Moo" ); - }, - - activate_editable_combobox: function() { - startApplication("testapp1"); - - select( "First Tab", tabBar() ); - - select( "Yellow", "Colour" ); - compare( getText("Status"), "Colour changed" ); - compare( getSelectedText("Colour"), "Yellow" ); - - // To clear 'Status' - select("Button1"); - compare( getText("Status"), "Button1 clicked" ); - - select( "Blue", "Colour" ); - compare( getText("Status"), "Colour changed" ); - compare( getSelectedText("Colour"), "Blue" ); - }, - - scroll_scrollarea_vertical: function() { - startApplication("testapp1"); - - select( "Cow Tab", tabBar() ); - - select( "CowButton0" ); - compare( getText("CowStatus"), "CowButton0 clicked" ); - - // Scroll down to the bottom - select( "CowButton15" ); - compare( getText("CowStatus"), "CowButton15 clicked" ); - - // Scroll up to the top - select( "CowButton0" ); - compare( getText("CowStatus"), "CowButton0 clicked" ); - }, - - scroll_combobox: function() { - startApplication("testapp1"); - - select( "Cow Tab", tabBar() ); - - select( "Woof", "Cow Goes?" ); - compare( getText("CowStatus"), "Cow Goes? changed" ); - compare( getSelectedText("Cow Goes?"), "Woof" ); - - // This item is the last one in the combobox - select( "Choo choo!", "Cow Goes?" ); - compare( getText("CowStatus"), "Cow Goes? changed" ); - compare( getSelectedText("Cow Goes?"), "Choo choo!" ); - }, - - setChecked_checkbox: function() { - startApplication("testapp1"); - - select( "Awesome Tab", tabBar() ); - - select( "Clear" ); - compare( getText("Status"), "'Clear' clicked" ); - - setChecked( true, "Checkbox" ); - compare( getText("Status"), "'Checkbox' clicked" ); - verify( isChecked("Checkbox") ); - - select( "Clear" ); - compare( getText("Status"), "'Clear' clicked" ); - - setChecked( false, "Checkbox" ); - compare( getText("Status"), "'Checkbox' clicked" ); - verify( !isChecked("Checkbox") ); - - select( "Clear" ); - compare( getText("Status"), "'Clear' clicked" ); - - setChecked( true, "Checkbox" ); - compare( getText("Status"), "'Checkbox' clicked" ); - verify( isChecked("Checkbox") ); - }, - - select_groupbox_subitem: function() { - startApplication("testapp2"); - - setChecked(true, "Checkable"); - select("Checkable/Groupie"); - compare("'Groupie' clicked", getText("Status")); - - setChecked(false, "Checkable"); - expectFail("Can't select disabled button"); - select("Checkable/Groupie"); - }, - - select_from_popup: function() { - startApplication("testapp2"); - select( "Tab Two", tabBar() ); - - select("Popup"); - select("&No"); - compare("No", getText("Popup response")); - - select("Popup"); - select("&Yes"); - compare("Yes", getText("Popup response")); - }, - - enter_invisible: function() { - startApplication("testapp2"); - select( "Tab Two", tabBar() ); - - setChecked(true, "Checkbox"); - enter("hello world", "Silly 1"); - - setChecked(false, "Checkbox"); - expectFail("Can't enter text into non-visible widget"); - enter("hello again world", "Silly 2"); - }, - - select_menu: function() { - startApplication("testapp2"); - select( "Tab Free", tabBar() ); - - select("Menu Item #3", "Menu"); - compare("Menu Item #3", getText("Menu")); - } -} diff --git a/tests/qtuitest/sys_input/sys_input.pro b/tests/qtuitest/sys_input/sys_input.pro index 55f9413..270dca3 100644 --- a/tests/qtuitest/sys_input/sys_input.pro +++ b/tests/qtuitest/sys_input/sys_input.pro @@ -1,3 +1,3 @@ -SOURCES=sys_input.js +SOURCES=sys_input.qtt TESTAPPS=testapp1 testapp2 testapp3 CONFIG+=systemtest diff --git a/tests/qtuitest/sys_input/sys_input.qtt b/tests/qtuitest/sys_input/sys_input.qtt new file mode 100644 index 0000000..51f7301 --- /dev/null +++ b/tests/qtuitest/sys_input/sys_input.qtt @@ -0,0 +1,399 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +testcase = { + + runAsManualTest: function() { + if (!runAsManualTest()) + skip( "This test only makes sense when executed in -force-manual mode" ); + + manualTest( "Do something" ); + startApplication("foobar"); + prompt( "This should all nicely fold into one big prompt" ); + prompt( "Line 1\nLine 2\nLine 3" ); + verify( isVisible( "blah" ) ); + verify( isVisible( activeWindow() ) ); + compare( getText(focusWidget()), "this text" ); + compare( "this text", getText(focusWidget()) ); + compare( getSelectedText(tabBar()), getText(focusWidget()) ); + select( "foo", tabBar() ); + compare( getSelectedText(tabBar()), "First Tab" ); + compare( getSelectedValue("Name"), "a reference value" ); + compare( getValue("Address"), "Elysium road" ); + compare( "Elysium road", getValue("Address") ); + compare( getList( "Friends"), getList( "Other Friends") ); + mouseClick( getCenter( "foo", "bar" ) ); + var l = getLabels( "app" ); + verify(l.contains("Name"), "Verify that labels for 'app' contain 'Name'"); + setClipboardText( l ); + compare( getClipboardText(), "foobar" ); + compare( currentTitle(), "Contacts" ); + compare( getWindowTitles(), "A\nB\nC" ); + activateWindow( "mainwindow" ); + verify( getenv( "PATH" ).contains( "/home/user/foobar" ) ); + verify( checkOS( "linux" ) ); + verifyImage( "task_completed", "", + "Verify that the current task is shown with a green tick indicating completion" ); + verify( compareImage( "expected", "actual" )); + verify( getData("srcFile") == "blah" ); + verify( getImageSize( "srcFile" ) == "12345" ); + getFile("/tmp/foo.conf", "$HOME/Settings/foo.conf" ); + putFile("testdata/my_settings.conf", "$HOME/Settings/foo.conf"); + putFile("testdata/my_file", "$HOME/my_file", 12 ); //QFile.WriteOwner | QFile.ReadOwner | QFile.ReadOther); + }, + + runAutoTest: function() { + if (runAsManualTest()) + skip( "This test only makes sense when NOT executed in -force-manual mode" ); + + startApplication("testapp1"); + manualTest( "step 1"); + manualTest( "step 2"); + manualTest( "step 3"); + + compare(currentTitle(), "testapp1"); + + manualTest( "step4" ); + manualTest( "step5" ); + manualTest( "step6" ); + }, + + activate_tabBar: function() { + startApplication("testapp1"); + + select( "First Tab", tabBar() ); + compare( getSelectedText(tabBar()), "First Tab" ); + + select( "Cow Tab", tabBar() ); + compare( getSelectedText(tabBar()), "Cow Tab" ); + + select( "First Tab", tabBar() ); + compare( getSelectedText(tabBar()), "First Tab" ); + + select( "Awesome Tab", tabBar() ); + compare( getSelectedText(tabBar()), "Awesome Tab" ); + }, + + enter_single_data: { + numeric: "0", + asterisk: "*", + percent: "%", + question: "?", + comma: ",", + lower1: "a", + upper: "B", + lower2: "z" + }, + + enter_single: function(character) { + startApplication("testapp1"); + select( "First Tab", tabBar() ); + enter(character, "Status"); + compare(getText("Status"), character); + + }, + + enter_text: function(text) { + startApplication("testapp1"); + + select( "First Tab", tabBar() ); + enter(text, "LineEdit1"); + compare( getText("Status"), "LineEdit1 text changed" ); + compare( getText("LineEdit1"), text ); + + enter("clear", "LineEdit2"); + compare( getText("Status"), "LineEdit2 text changed" ); + compare( getText("LineEdit2"), "clear" ); + + if (mousePreferred()) { + mouseClick("LineEdit1"); + keyClick(Qt.Key_Home); + mouseClick("LineEdit2"); + } + enter("overwrite", "LineEdit1"); + compare( getText("LineEdit1"), "overwrite" ); + }, + + enter_text_data: { + mixed_case: [ "MiXeD CASe" ], + punctuation: [ "!@#$%^&*()-=_+[]{}\|;:',./<>?`~" ], + allsorts: [ "$100! How Much?" ], + with_numbers: [ "1 2 3SD770 4 25 312" ], + in_dict: [ "hello kitty" ], + not_in_dict: [ "jtnerlnjas mtrnen" ], + long_str: [ "this is a really long string to test we can overwrite properly" ], + + // Test for bug: "Jimmy" sometimes gives "Jinny" in predictive keyboard. + jimmy: [ "Jimmy jimmy" ] + }, + + enter_QTextEdit: function(text) { + startApplication("testapp3"); + + select("Text", tabBar()); + + enter(text, "Text"); + compare( getText("Text"), text ); + + enter("overwrite", "Text"); + compare( getText("Text"), "overwrite" ); + }, + + enter_QTextEdit_data: { + single_line: [ "This is a single line" ], + //multi_lines: [ "This is\nmultiple lines of\n\ntext" ] + alotta_text: [ "This is a lot of text to ensure we get a scroll bar happening yes this is a lot of text to ensure we get a scroll bar happening yes" ] + }, + + enter_QTimeEdit: function(time, shouldPass) { + startApplication("testapp1"); + + select("Awesome Tab", tabBar()); + + if (!shouldPass) expectFail("Bad time given"); + enter(time, "Time"); + + compare( getValue("Time"), time ); + }, + + enter_QTimeEdit_data: { + simple1: [ new QTime(16, 55, 00), true ], + simple2: [ new QTime(14, 10, 38), true ], + sdigit1: [ new QTime(1, 33, 10), true ], + sdigit2: [ new QTime(19, 7, 11), true ], + sdigit3: [ new QTime(22, 21, 1), true ], + + bad1: [ new QTime(25, 21, 1), false ], + bad2: [ new QTime(22, 88, 1), false ], + bad3: [ new QTime(21, 21, -1), false ] + }, + + // enter() with QDateEdit fields. + enter_QDateEdit: function(date) { + startApplication("testapp1"); + + select("Awesome Tab", tabBar()); + + enter(date, "Date"); + + compare( getValue("Date"), date ); + + }, + + enter_QDateEdit_data: { + simple1: [ new Date(2000, 6, 15) ], + december: [ new Date(2000, 12, 15) ], + end_of_month: [ new Date(2002, 6, 30) ], + simple2: [ new Date(2004, 10, 11) ] + }, + + // Explicit mouse clicks on widgets + mouseClick: function() { + startApplication("testapp1"); + select( "Cow Tab", tabBar() ); + compare( getSelectedText(tabBar()), "Cow Tab" ); + + mouseClick("CowButton1"); + compare( getText("CowStatus"), "CowButton1 clicked" ); + + mouseClick("CowButton2"); + compare( getText("CowStatus"), "CowButton2 clicked" ); + + mouseClick("CowButton16"); + compare( getText("CowStatus"), "CowButton16 clicked" ); + + mouseClick("CowButton0"); + compare( getText("CowStatus"), "CowButton0 clicked" ); + }, + + activate_button: function() { + startApplication("testapp1"); + + select("First Tab", tabBar()); + compare( getSelectedText(tabBar()), "First Tab" ); + + select("Button1"); + compare( getText("Status"), "Button1 clicked" ); + select("Button2"); + compare( getText("Status"), "Button2 clicked" ); + }, + + activate_combobox: function() { + startApplication("testapp1"); + + select( "Cow Tab", tabBar() ); + + select( "Woof", "Cow Goes?" ); + compare( getText("CowStatus"), "Cow Goes? changed" ); + compare( getSelectedText("Cow Goes?"), "Woof" ); + + // To clear 'Status' + select( "CowButton0" ); + compare( getText("CowStatus"), "CowButton0 clicked" ); + + select( "Moo", "Cow Goes?" ); + compare( getText("CowStatus"), "Cow Goes? changed" ); + compare( getSelectedText("Cow Goes?"), "Moo" ); + }, + + activate_editable_combobox: function() { + startApplication("testapp1"); + + select( "First Tab", tabBar() ); + + select( "Yellow", "Colour" ); + compare( getText("Status"), "Colour changed" ); + compare( getSelectedText("Colour"), "Yellow" ); + + // To clear 'Status' + select("Button1"); + compare( getText("Status"), "Button1 clicked" ); + + select( "Blue", "Colour" ); + compare( getText("Status"), "Colour changed" ); + compare( getSelectedText("Colour"), "Blue" ); + }, + + scroll_scrollarea_vertical: function() { + startApplication("testapp1"); + + select( "Cow Tab", tabBar() ); + + select( "CowButton0" ); + compare( getText("CowStatus"), "CowButton0 clicked" ); + + // Scroll down to the bottom + select( "CowButton15" ); + compare( getText("CowStatus"), "CowButton15 clicked" ); + + // Scroll up to the top + select( "CowButton0" ); + compare( getText("CowStatus"), "CowButton0 clicked" ); + }, + + scroll_combobox: function() { + startApplication("testapp1"); + + select( "Cow Tab", tabBar() ); + + select( "Woof", "Cow Goes?" ); + compare( getText("CowStatus"), "Cow Goes? changed" ); + compare( getSelectedText("Cow Goes?"), "Woof" ); + + // This item is the last one in the combobox + select( "Choo choo!", "Cow Goes?" ); + compare( getText("CowStatus"), "Cow Goes? changed" ); + compare( getSelectedText("Cow Goes?"), "Choo choo!" ); + }, + + setChecked_checkbox: function() { + startApplication("testapp1"); + + select( "Awesome Tab", tabBar() ); + + select( "Clear" ); + compare( getText("Status"), "'Clear' clicked" ); + + setChecked( true, "Checkbox" ); + compare( getText("Status"), "'Checkbox' clicked" ); + verify( isChecked("Checkbox") ); + + select( "Clear" ); + compare( getText("Status"), "'Clear' clicked" ); + + setChecked( false, "Checkbox" ); + compare( getText("Status"), "'Checkbox' clicked" ); + verify( !isChecked("Checkbox") ); + + select( "Clear" ); + compare( getText("Status"), "'Clear' clicked" ); + + setChecked( true, "Checkbox" ); + compare( getText("Status"), "'Checkbox' clicked" ); + verify( isChecked("Checkbox") ); + }, + + select_groupbox_subitem: function() { + startApplication("testapp2"); + + setChecked(true, "Checkable"); + select("Checkable/Groupie"); + compare("'Groupie' clicked", getText("Status")); + + setChecked(false, "Checkable"); + expectFail("Can't select disabled button"); + select("Checkable/Groupie"); + }, + + select_from_popup: function() { + startApplication("testapp2"); + select( "Tab Two", tabBar() ); + + select("Popup"); + select("&No"); + compare("No", getText("Popup response")); + + select("Popup"); + select("&Yes"); + compare("Yes", getText("Popup response")); + }, + + enter_invisible: function() { + startApplication("testapp2"); + select( "Tab Two", tabBar() ); + + setChecked(true, "Checkbox"); + enter("hello world", "Silly 1"); + + setChecked(false, "Checkbox"); + expectFail("Can't enter text into non-visible widget"); + enter("hello again world", "Silly 2"); + }, + + select_menu: function() { + startApplication("testapp2"); + select( "Tab Free", tabBar() ); + + select("Menu Item #3", "Menu"); + compare("Menu Item #3", getText("Menu")); + } +} diff --git a/tests/qtuitest/sys_linguist/sys_linguist.js b/tests/qtuitest/sys_linguist/sys_linguist.js deleted file mode 100644 index da1aa41..0000000 --- a/tests/qtuitest/sys_linguist/sys_linguist.js +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of QtUiTest. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - - -include("filedialog.js"); - -testcase = { - - //TODO: In Progress. Not expected to pass (or even work correctly) yet. - - init: function() { - // Start the application - startApplication("linguist"); - - // Open file - select("File/Open...", menuBar()); - FileDialog.openFile(baseDataPath() + "test_fr.ts"); - - // Make sure all views are shown - setChecked(true, "View/Views/Context", menuBar()); - setChecked(true, "View/Views/Strings", menuBar()); - setChecked(true, "View/Views/Phrases and guesses", menuBar()); - setChecked(true, "View/Views/Sources and Forms", menuBar()); - setChecked(true, "View/Views/Warnings", menuBar()); - - // Switch on all validation - setChecked(true, "Validation/Accelerators", menuBar()); - setChecked(true, "Validation/Ending Punctuation", menuBar()); - setChecked(true, "Validation/Phrase matches", menuBar()); - setChecked(true, "Validation/Place Marker Matches", menuBar()); - - // Switch off Length Variants - setChecked(false, "View/Length Variants", menuBar()); - - // Labels are above their buddy widgets - setLabelOrientation(LabelAbove); - }, - - check_translation_data: { - blue: [ "Colours", "blue", "bleu" ], - third: [ "Ordinals", "third", "troisième" ], - nine: [ "Numbers", "nine", "neuf" ] - }, - - check_translation: function(context, sourceText, translated) { - select( context, "Context" ); - select( sourceText, "Strings" ); - compare(getText("Source text"), sourceText); - compare(getText("French translation"), translated); - }, - - check_warnings_data: { - warn1: [ "Placemarkers", "Read error reading from %1: %2", - "Translation does not refer to the same place markers as in the source text." ], - warn2: [ "Accelerators", "&hello world", "Accelerator possibly missing in translation." ] - }, - - check_warnings: function(context, sourceText, warning) { - select( context, "Context" ); - select( sourceText, "Strings" ); - compare(getText("Source text"), sourceText); - verify(getList("Warnings").contains(warning)); - }, - - missing_translations: function() { - select( "Translation/Next Unfinished" ); - var list = new Array(); - var val = getSelectedValue("Context")[1] + " : " + getText("Source text"); - var first = val; - - do { - list.push(val); - select( "Translation/Next Unfinished" ); - var val = getSelectedValue("Context")[1] + " : " + getText("Source text"); - } while (val != first); - - verify(list.contains("Numbers : four")); - verify(list.contains("Ordinals : sixth")); - verify(list.contains("Colours : a mauvy shade of pinky russet")); - }, - - check_statistics: function() { - //TODO: Should also check word count, however this is not easy to do - // in JavaScript for Unicode strings. - - var sourceChars = 0; - var translatedChars = 0; - var sourceNonSpaceChars = 0; - var translatedNonSpaceChars = 0; - var first = getSelectedValue("Context")[1] + " : " + getText("Source text"); - - do { - var sourceText = getText("Source text"); - var translatedText = getText("French translation"); - sourceChars += sourceText.length; - translatedChars += translatedText.length; - - sourceNonSpaceChars += sourceText.replace(/\s/g, "").length; - translatedNonSpaceChars += translatedText.replace(/\s/g, "").length; - select( "Translation/Next" ); - var val = getSelectedValue("Context")[1] + " : " + getText("Source text"); - } while (val != first); - - select("View/Statistics", menuBar()); - var labels = getLabels(); - - compare(sourceNonSpaceChars, labels[labels.indexOf("Characters:")+1]); - compare(translatedNonSpaceChars, labels[labels.indexOf("Characters:")+2]); - compare(sourceChars, labels[labels.indexOf("Characters (with spaces):")+1]); - compare(translatedChars, labels[labels.indexOf("Characters (with spaces):")+2]); - } - -} \ No newline at end of file diff --git a/tests/qtuitest/sys_linguist/sys_linguist.pro b/tests/qtuitest/sys_linguist/sys_linguist.pro index d5537aa..3d5e676 100644 --- a/tests/qtuitest/sys_linguist/sys_linguist.pro +++ b/tests/qtuitest/sys_linguist/sys_linguist.pro @@ -1,2 +1,2 @@ -SOURCES=sys_linguist.js +SOURCES=sys_linguist.qtt CONFIG+=systemtest diff --git a/tests/qtuitest/sys_linguist/sys_linguist.qtt b/tests/qtuitest/sys_linguist/sys_linguist.qtt new file mode 100644 index 0000000..a098cc5 --- /dev/null +++ b/tests/qtuitest/sys_linguist/sys_linguist.qtt @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + + +include("filedialog.qtt"); + +testcase = { + + //TODO: In Progress. Not expected to pass (or even work correctly) yet. + + init: function() { + // Start the application + startApplication("linguist"); + + // Open file + select("File/Open...", menuBar()); + FileDialog.openFile(baseDataPath() + "test_fr.ts"); + + // Make sure all views are shown + setChecked(true, "View/Views/Context", menuBar()); + setChecked(true, "View/Views/Strings", menuBar()); + setChecked(true, "View/Views/Phrases and guesses", menuBar()); + setChecked(true, "View/Views/Sources and Forms", menuBar()); + setChecked(true, "View/Views/Warnings", menuBar()); + + // Switch on all validation + setChecked(true, "Validation/Accelerators", menuBar()); + setChecked(true, "Validation/Ending Punctuation", menuBar()); + setChecked(true, "Validation/Phrase matches", menuBar()); + setChecked(true, "Validation/Place Marker Matches", menuBar()); + + // Switch off Length Variants + setChecked(false, "View/Length Variants", menuBar()); + + // Labels are above their buddy widgets + setLabelOrientation(LabelAbove); + }, + + check_translation_data: { + blue: [ "Colours", "blue", "bleu" ], + third: [ "Ordinals", "third", "troisième" ], + nine: [ "Numbers", "nine", "neuf" ] + }, + + check_translation: function(context, sourceText, translated) { + select( context, "Context" ); + select( sourceText, "Strings" ); + compare(getText("Source text"), sourceText); + compare(getText("French translation"), translated); + }, + + check_warnings_data: { + warn1: [ "Placemarkers", "Read error reading from %1: %2", + "Translation does not refer to the same place markers as in the source text." ], + warn2: [ "Accelerators", "&hello world", "Accelerator possibly missing in translation." ] + }, + + check_warnings: function(context, sourceText, warning) { + select( context, "Context" ); + select( sourceText, "Strings" ); + compare(getText("Source text"), sourceText); + verify(getList("Warnings").contains(warning)); + }, + + missing_translations: function() { + select( "Translation/Next Unfinished" ); + var list = new Array(); + var val = getSelectedValue("Context")[1] + " : " + getText("Source text"); + var first = val; + + do { + list.push(val); + select( "Translation/Next Unfinished" ); + var val = getSelectedValue("Context")[1] + " : " + getText("Source text"); + } while (val != first); + + verify(list.contains("Numbers : four")); + verify(list.contains("Ordinals : sixth")); + verify(list.contains("Colours : a mauvy shade of pinky russet")); + }, + + check_statistics: function() { + //TODO: Should also check word count, however this is not easy to do + // in JavaScript for Unicode strings. + + var sourceChars = 0; + var translatedChars = 0; + var sourceNonSpaceChars = 0; + var translatedNonSpaceChars = 0; + var first = getSelectedValue("Context")[1] + " : " + getText("Source text"); + + do { + var sourceText = getText("Source text"); + var translatedText = getText("French translation"); + sourceChars += sourceText.length; + translatedChars += translatedText.length; + + sourceNonSpaceChars += sourceText.replace(/\s/g, "").length; + translatedNonSpaceChars += translatedText.replace(/\s/g, "").length; + select( "Translation/Next" ); + var val = getSelectedValue("Context")[1] + " : " + getText("Source text"); + } while (val != first); + + select("View/Statistics", menuBar()); + var labels = getLabels(); + + compare(sourceNonSpaceChars, labels[labels.indexOf("Characters:")+1]); + compare(translatedNonSpaceChars, labels[labels.indexOf("Characters:")+2]); + compare(sourceChars, labels[labels.indexOf("Characters (with spaces):")+1]); + compare(translatedChars, labels[labels.indexOf("Characters (with spaces):")+2]); + } + +} diff --git a/tests/shared/filedialog.js b/tests/shared/filedialog.js deleted file mode 100644 index 0a4f904..0000000 --- a/tests/shared/filedialog.js +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of QtUiTest. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -FileDialog = { - - dialog: function() { - return findByProperty( { className: "QFileDialog" } ); - }, - - openFile: function(path) { - var viewMode = getProperty(FileDialog.dialog(), "viewMode"); - var lookIn = findByProperty( { objectName: "lookInCombo" } ); - if (viewMode == 1) { - var view = findByProperty( { objectName: "listView" } ); - } else { - view = findByProperty( { objectName: "treeView" } ); - } - - // The "Look in:" QFileDialogComboBox gets populated in showPopup, so it is - // necessary to make the popup appear before we can use it... - mouseClick(lookIn); - - // FIXME: Unix only. Should make this work cross-platform - select("/", lookIn); - - var pathSplit = path.split("/"); - for (var i=1; i Date: Fri, 23 Jul 2010 09:49:19 +1000 Subject: Tweak code so that we can import it in creator-qtest - AND - continue to support a command line version of qtuitestrunner. --- examples/cppsystemtest/cppsystemtest.pro | 3 +- interpreter/qscriptsystemtest.cpp | 86 +++++ interpreter/qscriptsystemtest.h | 12 +- libqsystemtest/qabstracttest.cpp | 8 + libqsystemtest/qabstracttest.h | 7 +- libqsystemtest/qsystemtest.cpp | 28 +- libqsystemtest/qsystemtest.h | 8 +- libqtslave/qtestslave.cpp | 7 +- qtuitest-host.pri | 67 ++++ tests/qtuitest/sys_input/sys_input.js | 399 --------------------- tests/qtuitest/sys_input/sys_input.pro | 6 +- tests/qtuitest/sys_input/sys_input.qtt | 399 +++++++++++++++++++++ .../tst_qtuitestnamespace.cpp | 2 +- 13 files changed, 615 insertions(+), 417 deletions(-) create mode 100644 qtuitest-host.pri delete mode 100644 tests/qtuitest/sys_input/sys_input.js create mode 100644 tests/qtuitest/sys_input/sys_input.qtt diff --git a/examples/cppsystemtest/cppsystemtest.pro b/examples/cppsystemtest/cppsystemtest.pro index 0a005bf..faeac4b 100644 --- a/examples/cppsystemtest/cppsystemtest.pro +++ b/examples/cppsystemtest/cppsystemtest.pro @@ -26,9 +26,8 @@ mac { CONFIG+=qtestlib debug - target.path += \ /usr/local/bin INSTALLS += \ - target \ No newline at end of file + target diff --git a/interpreter/qscriptsystemtest.cpp b/interpreter/qscriptsystemtest.cpp index 93b0725..2dbe531 100644 --- a/interpreter/qscriptsystemtest.cpp +++ b/interpreter/qscriptsystemtest.cpp @@ -489,6 +489,89 @@ bool QScriptSystemTest::setQueryError( const QString &errString ) return ret; } +#ifdef QTCREATOR_QTEST +int QScriptSystemTest::runTest(const QString &fname, const QStringList ¶meters, + const QStringList &environment) +{ + m_env = environment; + qDebug() << "Running " << fname; + filename = fname; + + QFile file(filename); + if (!file.open(QFile::ReadOnly)) { + qDebug() << "Can't open " << filename; + return -1; + } + + QTextStream stream(&file); + QString script = stream.readAll(); + + ScriptPreprocessor().preprocess(script); + + setupEnums(&m_engine); + + // include() imports scripts directly into the parent script. + m_engine.globalObject().setProperty + ("include", m_engine.newFunction(includeFunction, 1)); + m_engine.globalObject().setProperty + ("setFlags", m_engine.newFunction(setFlags, 3)); + + + m_engine.globalObject().setProperty("_dateToString", m_engine.newFunction(dateToString)); + m_engine.evaluate("_old_date_toString = Date.prototype.toString;" + "Date.prototype.toString = function() {" + " if (arguments[0] == undefined)" + " return _old_date_toString.apply(this, arguments);" + " return _dateToString.apply(this, arguments);" + "}"); + + m_engine.globalObject().setProperty("ParentTestObject", m_engine.newQObject(this)); + m_engine.globalObject().setProperty("ParentTestMetaObject", m_engine.newQMetaObject(metaObject())); + + loadBuiltins(m_engine); + importIntoGlobalNamespace(m_engine, "ParentTestObject"); + + // Allow shebangs without giving syntax errors. + if (script.startsWith("#!")) script.prepend("//"); + script.prepend("with(ParentTestMetaObject){"); + script.append("\n}"); + + QtScriptTest tc(filename, script, &m_engine); + testObject = &tc; + + qScriptRegisterMetaType(&m_engine, variantToScriptValue, variantFromScriptValue); + qScriptRegisterSequenceMetaType >(&m_engine); + + // Only set up the test data path if not explicitly set by user + if (!QCoreApplication::arguments().contains("-data")) { + setupTestDataPath(qPrintable(filename)); + } + + enableQueryWarnings(false); + + // If we get here, the syntax of the script is definitely OK + // (a syntax error causes a qFatal in the QtScriptTest ctor). + if (m_checkOnly) + return 0; + + // If an IDE is connected, set the agent to enable script debugging + if (testIDE() && testIDE()->isConnected()) { + m_engine.setAgent(m_agent); + } + + int retval = QTest::qExec(&tc, parameters); + + testObject = 0; + + // After a full test run, QTestLib sometimes returns 0 or sometimes returns + // the number of test failures, depending on how it was compiled. In both + // cases, a negative number denotes an error. + // We don't want test failures to affect the exit code. + return (retval < 0) ? retval : 0; +} +#endif + +#ifndef QTCREATOR_QTEST int QScriptSystemTest::runTest(int argc, char *argv[]) { if (argc > 1) filename = argv[1]; @@ -574,6 +657,7 @@ int QScriptSystemTest::runTest(int argc, char *argv[]) // We don't want test failures to affect the exit code. return (retval < 0) ? retval : 0; } +#endif /*! \internal @@ -630,6 +714,7 @@ QVariantMap QScriptSystemTest::sendRaw(const QString& event, const QScriptValue& return ret; } +#ifndef QTCREATOR_QTEST /*! \internal Print any special usage information which should be shown when test is launched @@ -644,6 +729,7 @@ void QScriptSystemTest::printUsage(int argc, char *argv[]) const " contains any syntax errors.\n" ); } +#endif /*! \internal diff --git a/interpreter/qscriptsystemtest.h b/interpreter/qscriptsystemtest.h index b7b185c..7244db3 100644 --- a/interpreter/qscriptsystemtest.h +++ b/interpreter/qscriptsystemtest.h @@ -65,6 +65,11 @@ public: void scriptPositionChange(qint64, int, int); void scriptContextChange(bool); +#ifdef QTCREATOR_QTEST + virtual int runTest(const QString &fname, const QStringList ¶meters, + const QStringList &environment); +#endif + public slots: virtual bool fail(QString const &message); virtual void expectFail( const QString &reason ); @@ -86,13 +91,14 @@ protected: virtual bool setQueryError( const QTestMessage &message ); virtual bool setQueryError( const QString &errString ); +#ifndef QTCREATOR_QTEST virtual int runTest(int argc, char *argv[]); + virtual void printUsage(int,char*[]) const; +#endif + virtual void processCommandLine(int&, char*[]); virtual bool isFailExpected(); - virtual void processCommandLine(int&, char*[]); - virtual void printUsage(int,char*[]) const; - virtual void processMessage(const QTestMessage& message); diff --git a/libqsystemtest/qabstracttest.cpp b/libqsystemtest/qabstracttest.cpp index 0b0a5a5..bf6ea0b 100644 --- a/libqsystemtest/qabstracttest.cpp +++ b/libqsystemtest/qabstracttest.cpp @@ -305,6 +305,7 @@ QString QAbstractTest::currentTestFunction( bool fullName ) const return fullName ? (testCaseName() + "::" + QTest::currentTestFunction()) : (QTest::currentTestFunction()); } +#ifndef QTCREATOR_QTEST /* \internal Executes all test functions as specified on the command line, while running the @@ -337,7 +338,9 @@ int QAbstractTest::exec( int argc, char* argv[], char* filename ) delete[] _argv; return ret; } +#endif +#ifndef QTCREATOR_QTEST /* \internal Print a usage message. @@ -383,6 +386,7 @@ void QAbstractTest::printUsage( int argc, char* argv[] ) const " of the directory containing the test source file, then in $HOME/.qtest\n" , (argc) ? argv[0] : "test"); } +#endif /* \internal @@ -451,8 +455,10 @@ void QAbstractTest::processCommandLine( int &argc, char* argv[] ) !strcasecmp(argv[i], "-h") ) { argv[i] = 0; offset++; +#ifndef QTCREATOR_QTEST printUsage(argc-offset, argv); exit(0); +#endif // Silently ignore a few system test specific arguments. // For compatibility, we'll silently ignore these so that @@ -495,6 +501,7 @@ void handle_segfault(int signum) } #endif +# ifndef QTCREATOR_QTEST /* \internal Run test with arguments \a argc, \a argv, and return an exit code. @@ -511,6 +518,7 @@ int QAbstractTest::runTest(int argc, char *argv[]) return QTest::qExec( this, argc, argv ); return -1; } +#endif /*! \internal diff --git a/libqsystemtest/qabstracttest.h b/libqsystemtest/qabstracttest.h index 69ee0ee..10a2a14 100644 --- a/libqsystemtest/qabstracttest.h +++ b/libqsystemtest/qabstracttest.h @@ -46,7 +46,7 @@ #include #include -#include +#include "qtuitestglobal.h" #include class QSYSTEMTEST_EXPORT Autotest_QLog { @@ -109,7 +109,9 @@ public: , QObject *parent = 0); virtual ~QAbstractTest(); +# ifndef QTCREATOR_QTEST int exec( int argc, char* argv[], char* filename = 0 ); +# endif #endif public slots: @@ -129,9 +131,12 @@ public slots: #ifndef Q_QDOC protected: +# ifndef QTCREATOR_QTEST virtual int runTest(int argc, char *argv[]); virtual void printUsage( int argc, char *argv[] ) const; +# endif virtual void processCommandLine( int &argc, char *argv[] ); + virtual void setupTestDataPath(const char *filename); #endif diff --git a/libqsystemtest/qsystemtest.cpp b/libqsystemtest/qsystemtest.cpp index bc3fa36..ab164b2 100644 --- a/libqsystemtest/qsystemtest.cpp +++ b/libqsystemtest/qsystemtest.cpp @@ -2261,9 +2261,14 @@ void QSystemTest::startApplication( const QString &application, const QStringLis } TestProcess* proc = new TestProcess(this); - proc->test = this; +#ifdef QTCREATOR_QTEST + proc->setEnvironment(m_env); +#else proc->env = m_env; proc->env << QString("QTUITEST_PORT=%1").arg(m_aut_port); +#endif + + proc->test = this; #ifdef Q_OS_MAC args << QString("-style=qtuitest"); @@ -2291,7 +2296,7 @@ void QSystemTest::startApplication( const QString &application, const QStringLis } // Give it a little time for the slave to come up. - wait(3000); + wait(100); if (!connectToAut(timeout)) { fail(QString("Could not connect to process '%1'.").arg(app)); @@ -2563,7 +2568,13 @@ bool QSystemTest::runsOnDevice() */ void QSystemTest::wait(int msecs) { - QTest::qWait(msecs); +// QTest::qWait(msecs); + QTime t; + t.start(); + while (t.elapsed() < msecs) { + qApp->processEvents(); + } + qDebug() << "waited" << t.elapsed() << " ms"; } /*! @@ -2965,6 +2976,7 @@ void QSystemTest::abortTest() #endif } +#ifndef QTCREATOR_QTEST /*! \internal Print any special usage information which should be shown when test is launched @@ -3003,6 +3015,7 @@ void QSystemTest::printUsage(int argc, char *argv[]) const , DEFAULT_AUT_PORT ); } +#endif #ifndef Q_QDOC /* @@ -3196,6 +3209,7 @@ bool QSystemTest::setQueryError( const QTestMessage &message ) return false; // query is NOT successfull } +#ifndef QTCREATOR_QTEST /*! \internal Launch AUT and run the test. @@ -3206,6 +3220,7 @@ int QSystemTest::runTest(int argc, char *argv[]) { return QAbstractTest::runTest(argc, argv); } +#endif /*! \internal @@ -3220,6 +3235,7 @@ bool QSystemTest::connectToAut(int timeout) if (!m_test_app) m_test_app = new QSystemTestMaster( this ); + bool first_time = true; QTime t; t.start(); while (t.elapsed() < timeout && !isConnected()) { @@ -3227,9 +3243,11 @@ bool QSystemTest::connectToAut(int timeout) m_test_app->waitForConnected(2000); if (!m_test_app->isConnected()) { if (m_test_app->error() == QAbstractSocket::ConnectionRefusedError) { - qLog(QtUitest) << qPrintable(QString("Connection refused while trying to connect to test app on %1:%2").arg(m_aut_host).arg(m_aut_port)) ; + if (first_time) { + qLog(QtUitest) << qPrintable(QString("Connection refused while trying to connect to test app on %1:%2. Retrying ... ").arg(m_aut_host).arg(m_aut_port)) ; + first_time = false; + } } - QTest::qWait(100); } } diff --git a/libqsystemtest/qsystemtest.h b/libqsystemtest/qsystemtest.h index be42041..dedc6b2 100644 --- a/libqsystemtest/qsystemtest.h +++ b/libqsystemtest/qsystemtest.h @@ -390,9 +390,11 @@ protected slots: void abortTest(); protected: +#ifndef QTCREATOR_QTEST virtual void printUsage(int,char*[]) const; - virtual void processCommandLine(int&,char*[]); virtual int runTest(int,char*[]); +#endif + virtual void processCommandLine(int&,char*[]); virtual void applicationStandardOutput(QList const&); virtual void applicationStandardError(QList const&); @@ -466,6 +468,9 @@ signals: void appGainedFocus(QString const &appName); void appBecameIdle(QString const &appName); +protected: + QStringList m_env; + private: friend class QSystemTestMaster; friend class QSystemTestPrivate; @@ -528,7 +533,6 @@ private: bool m_demo_mode; bool m_verbose_perf; bool m_verbose; - QStringList m_env; QTestRemote m_qtest_ide; QMap appNameToBinary; bool m_strict_mode; diff --git a/libqtslave/qtestslave.cpp b/libqtslave/qtestslave.cpp index 502d398..2a41936 100644 --- a/libqtslave/qtestslave.cpp +++ b/libqtslave/qtestslave.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #ifndef QT_NO_CLIPBOARD # include @@ -107,7 +108,11 @@ public: : eventRecordingEnabled(false), p(parent), recorder(this) - {} + { + // Play a sound as a audible confirmation that an app is started with QtUITest plugin loaded + QString fname = QDir::homePath() + QDir::separator() + "qtuitest.wav"; + if (QFile::exists(fname)) QSound::play(fname); + } bool event(QEvent *e); bool waitForIdle(int timeout = 10000); diff --git a/qtuitest-host.pri b/qtuitest-host.pri new file mode 100644 index 0000000..b2f7f87 --- /dev/null +++ b/qtuitest-host.pri @@ -0,0 +1,67 @@ +SOURCES +=\ + $$QTUITEST_SRC/interpreter/qscriptsystemtest.cpp \ + $$QTUITEST_SRC/interpreter/qtscript_bindings.cpp \ + $$QTUITEST_SRC/interpreter/qtuitestengineagent.cpp \ + $$QTUITEST_SRC/interpreter/scriptpreprocessor.cpp + +HEADERS +=\ + $$QTUITEST_SRC/interpreter/qscriptsystemtest.h \ + $$QTUITEST_SRC/interpreter/scriptpreprocessor.h \ + $$QTUITEST_SRC/interpreter/qtuitestengineagent.h \ + $$QTUITEST_SRC/interpreter/qtscript_bindings.h + +RESOURCES += $$QTUITEST_SRC/interpreter/scripts.qrc +DEFINES += QTUITESTRUNNER_TARGET +INCLUDEPATH += $$QTUITEST_SRC/libqsystemtest $$QTUITEST_SRC/interpreter $$QTUITEST_SRC $$QTUITEST_SRC/libqtuitest +#VPATH+=$$PWD +QT+=script network +CONFIG+=qtestlib + +# stuff to include libqsystemtest +DEFINES += QSYSTEMTEST_TARGET + +FORMS +=\ + $$QTUITEST_SRC/libqsystemtest/manualverificationdlg.ui \ + $$QTUITEST_SRC/libqsystemtest/failuredlg.ui \ + $$QTUITEST_SRC/libqsystemtest/recorddlg.ui + +SEMI_PRIVATE_HEADERS += \ + $$QTUITEST_SRC/libqsystemtest/qsystemtestmaster_p.h \ + $$QTUITEST_SRC/libqsystemtest/qtestremote_p.h \ + $$QTUITEST_SRC/libqsystemtest/qtestverifydlg_p.h + +HEADERS +=\ +# $$QTUITEST_SRC/libqsystemtest/gracefulquit.h \ + $$QTUITEST_SRC/libqsystemtest/qabstracttest.h \ + $$QTUITEST_SRC/libqsystemtest/qsystemtest.h + +SOURCES +=\ + # $$QTUITEST_SRC/libqsystemtest/gracefulquit.cpp \ + $$QTUITEST_SRC/libqsystemtest/qabstracttest.cpp \ + $$QTUITEST_SRC/libqsystemtest/qtestremote.cpp \ + $$QTUITEST_SRC/libqsystemtest/qtestverifydlg.cpp \ + $$QTUITEST_SRC/libqsystemtest/qsystemtest.cpp \ + $$QTUITEST_SRC/libqsystemtest/qsystemtest_p.cpp \ + $$QTUITEST_SRC/libqsystemtest/qsystemtestmaster.cpp + +HEADERS*=$$SEMI_PRIVATE_HEADERS $$PRIVATE_HEADERS + +symbian { + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData + # SOURCES-=$$QTUITEST_SRC/libqsystemtest/gracefulquit.cpp + # HEADERS-=$$QTUITEST_SRC/libqsystemtest/gracefulquit.h + LIBS+=-L$$OUT_PWD -lws32 -leuser -lcone +} + +win32 { + # SOURCES-=$$QTUITEST_SRC/libqsystemtest/gracefulquit.cpp + # HEADERS-=$$QTUITEST_SRC/libqsystemtest/gracefulquit.h + !equals(QMAKE_CXX, "g++") { + DEFINES+=strcasecmp=_stricmp + } +} + +mac { + DEFINES+=sighandler_t=sig_t +} diff --git a/tests/qtuitest/sys_input/sys_input.js b/tests/qtuitest/sys_input/sys_input.js deleted file mode 100644 index 51f7301..0000000 --- a/tests/qtuitest/sys_input/sys_input.js +++ /dev/null @@ -1,399 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of QtUiTest. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -testcase = { - - runAsManualTest: function() { - if (!runAsManualTest()) - skip( "This test only makes sense when executed in -force-manual mode" ); - - manualTest( "Do something" ); - startApplication("foobar"); - prompt( "This should all nicely fold into one big prompt" ); - prompt( "Line 1\nLine 2\nLine 3" ); - verify( isVisible( "blah" ) ); - verify( isVisible( activeWindow() ) ); - compare( getText(focusWidget()), "this text" ); - compare( "this text", getText(focusWidget()) ); - compare( getSelectedText(tabBar()), getText(focusWidget()) ); - select( "foo", tabBar() ); - compare( getSelectedText(tabBar()), "First Tab" ); - compare( getSelectedValue("Name"), "a reference value" ); - compare( getValue("Address"), "Elysium road" ); - compare( "Elysium road", getValue("Address") ); - compare( getList( "Friends"), getList( "Other Friends") ); - mouseClick( getCenter( "foo", "bar" ) ); - var l = getLabels( "app" ); - verify(l.contains("Name"), "Verify that labels for 'app' contain 'Name'"); - setClipboardText( l ); - compare( getClipboardText(), "foobar" ); - compare( currentTitle(), "Contacts" ); - compare( getWindowTitles(), "A\nB\nC" ); - activateWindow( "mainwindow" ); - verify( getenv( "PATH" ).contains( "/home/user/foobar" ) ); - verify( checkOS( "linux" ) ); - verifyImage( "task_completed", "", - "Verify that the current task is shown with a green tick indicating completion" ); - verify( compareImage( "expected", "actual" )); - verify( getData("srcFile") == "blah" ); - verify( getImageSize( "srcFile" ) == "12345" ); - getFile("/tmp/foo.conf", "$HOME/Settings/foo.conf" ); - putFile("testdata/my_settings.conf", "$HOME/Settings/foo.conf"); - putFile("testdata/my_file", "$HOME/my_file", 12 ); //QFile.WriteOwner | QFile.ReadOwner | QFile.ReadOther); - }, - - runAutoTest: function() { - if (runAsManualTest()) - skip( "This test only makes sense when NOT executed in -force-manual mode" ); - - startApplication("testapp1"); - manualTest( "step 1"); - manualTest( "step 2"); - manualTest( "step 3"); - - compare(currentTitle(), "testapp1"); - - manualTest( "step4" ); - manualTest( "step5" ); - manualTest( "step6" ); - }, - - activate_tabBar: function() { - startApplication("testapp1"); - - select( "First Tab", tabBar() ); - compare( getSelectedText(tabBar()), "First Tab" ); - - select( "Cow Tab", tabBar() ); - compare( getSelectedText(tabBar()), "Cow Tab" ); - - select( "First Tab", tabBar() ); - compare( getSelectedText(tabBar()), "First Tab" ); - - select( "Awesome Tab", tabBar() ); - compare( getSelectedText(tabBar()), "Awesome Tab" ); - }, - - enter_single_data: { - numeric: "0", - asterisk: "*", - percent: "%", - question: "?", - comma: ",", - lower1: "a", - upper: "B", - lower2: "z" - }, - - enter_single: function(character) { - startApplication("testapp1"); - select( "First Tab", tabBar() ); - enter(character, "Status"); - compare(getText("Status"), character); - - }, - - enter_text: function(text) { - startApplication("testapp1"); - - select( "First Tab", tabBar() ); - enter(text, "LineEdit1"); - compare( getText("Status"), "LineEdit1 text changed" ); - compare( getText("LineEdit1"), text ); - - enter("clear", "LineEdit2"); - compare( getText("Status"), "LineEdit2 text changed" ); - compare( getText("LineEdit2"), "clear" ); - - if (mousePreferred()) { - mouseClick("LineEdit1"); - keyClick(Qt.Key_Home); - mouseClick("LineEdit2"); - } - enter("overwrite", "LineEdit1"); - compare( getText("LineEdit1"), "overwrite" ); - }, - - enter_text_data: { - mixed_case: [ "MiXeD CASe" ], - punctuation: [ "!@#$%^&*()-=_+[]{}\|;:',./<>?`~" ], - allsorts: [ "$100! How Much?" ], - with_numbers: [ "1 2 3SD770 4 25 312" ], - in_dict: [ "hello kitty" ], - not_in_dict: [ "jtnerlnjas mtrnen" ], - long_str: [ "this is a really long string to test we can overwrite properly" ], - - // Test for bug: "Jimmy" sometimes gives "Jinny" in predictive keyboard. - jimmy: [ "Jimmy jimmy" ] - }, - - enter_QTextEdit: function(text) { - startApplication("testapp3"); - - select("Text", tabBar()); - - enter(text, "Text"); - compare( getText("Text"), text ); - - enter("overwrite", "Text"); - compare( getText("Text"), "overwrite" ); - }, - - enter_QTextEdit_data: { - single_line: [ "This is a single line" ], - //multi_lines: [ "This is\nmultiple lines of\n\ntext" ] - alotta_text: [ "This is a lot of text to ensure we get a scroll bar happening yes this is a lot of text to ensure we get a scroll bar happening yes" ] - }, - - enter_QTimeEdit: function(time, shouldPass) { - startApplication("testapp1"); - - select("Awesome Tab", tabBar()); - - if (!shouldPass) expectFail("Bad time given"); - enter(time, "Time"); - - compare( getValue("Time"), time ); - }, - - enter_QTimeEdit_data: { - simple1: [ new QTime(16, 55, 00), true ], - simple2: [ new QTime(14, 10, 38), true ], - sdigit1: [ new QTime(1, 33, 10), true ], - sdigit2: [ new QTime(19, 7, 11), true ], - sdigit3: [ new QTime(22, 21, 1), true ], - - bad1: [ new QTime(25, 21, 1), false ], - bad2: [ new QTime(22, 88, 1), false ], - bad3: [ new QTime(21, 21, -1), false ] - }, - - // enter() with QDateEdit fields. - enter_QDateEdit: function(date) { - startApplication("testapp1"); - - select("Awesome Tab", tabBar()); - - enter(date, "Date"); - - compare( getValue("Date"), date ); - - }, - - enter_QDateEdit_data: { - simple1: [ new Date(2000, 6, 15) ], - december: [ new Date(2000, 12, 15) ], - end_of_month: [ new Date(2002, 6, 30) ], - simple2: [ new Date(2004, 10, 11) ] - }, - - // Explicit mouse clicks on widgets - mouseClick: function() { - startApplication("testapp1"); - select( "Cow Tab", tabBar() ); - compare( getSelectedText(tabBar()), "Cow Tab" ); - - mouseClick("CowButton1"); - compare( getText("CowStatus"), "CowButton1 clicked" ); - - mouseClick("CowButton2"); - compare( getText("CowStatus"), "CowButton2 clicked" ); - - mouseClick("CowButton16"); - compare( getText("CowStatus"), "CowButton16 clicked" ); - - mouseClick("CowButton0"); - compare( getText("CowStatus"), "CowButton0 clicked" ); - }, - - activate_button: function() { - startApplication("testapp1"); - - select("First Tab", tabBar()); - compare( getSelectedText(tabBar()), "First Tab" ); - - select("Button1"); - compare( getText("Status"), "Button1 clicked" ); - select("Button2"); - compare( getText("Status"), "Button2 clicked" ); - }, - - activate_combobox: function() { - startApplication("testapp1"); - - select( "Cow Tab", tabBar() ); - - select( "Woof", "Cow Goes?" ); - compare( getText("CowStatus"), "Cow Goes? changed" ); - compare( getSelectedText("Cow Goes?"), "Woof" ); - - // To clear 'Status' - select( "CowButton0" ); - compare( getText("CowStatus"), "CowButton0 clicked" ); - - select( "Moo", "Cow Goes?" ); - compare( getText("CowStatus"), "Cow Goes? changed" ); - compare( getSelectedText("Cow Goes?"), "Moo" ); - }, - - activate_editable_combobox: function() { - startApplication("testapp1"); - - select( "First Tab", tabBar() ); - - select( "Yellow", "Colour" ); - compare( getText("Status"), "Colour changed" ); - compare( getSelectedText("Colour"), "Yellow" ); - - // To clear 'Status' - select("Button1"); - compare( getText("Status"), "Button1 clicked" ); - - select( "Blue", "Colour" ); - compare( getText("Status"), "Colour changed" ); - compare( getSelectedText("Colour"), "Blue" ); - }, - - scroll_scrollarea_vertical: function() { - startApplication("testapp1"); - - select( "Cow Tab", tabBar() ); - - select( "CowButton0" ); - compare( getText("CowStatus"), "CowButton0 clicked" ); - - // Scroll down to the bottom - select( "CowButton15" ); - compare( getText("CowStatus"), "CowButton15 clicked" ); - - // Scroll up to the top - select( "CowButton0" ); - compare( getText("CowStatus"), "CowButton0 clicked" ); - }, - - scroll_combobox: function() { - startApplication("testapp1"); - - select( "Cow Tab", tabBar() ); - - select( "Woof", "Cow Goes?" ); - compare( getText("CowStatus"), "Cow Goes? changed" ); - compare( getSelectedText("Cow Goes?"), "Woof" ); - - // This item is the last one in the combobox - select( "Choo choo!", "Cow Goes?" ); - compare( getText("CowStatus"), "Cow Goes? changed" ); - compare( getSelectedText("Cow Goes?"), "Choo choo!" ); - }, - - setChecked_checkbox: function() { - startApplication("testapp1"); - - select( "Awesome Tab", tabBar() ); - - select( "Clear" ); - compare( getText("Status"), "'Clear' clicked" ); - - setChecked( true, "Checkbox" ); - compare( getText("Status"), "'Checkbox' clicked" ); - verify( isChecked("Checkbox") ); - - select( "Clear" ); - compare( getText("Status"), "'Clear' clicked" ); - - setChecked( false, "Checkbox" ); - compare( getText("Status"), "'Checkbox' clicked" ); - verify( !isChecked("Checkbox") ); - - select( "Clear" ); - compare( getText("Status"), "'Clear' clicked" ); - - setChecked( true, "Checkbox" ); - compare( getText("Status"), "'Checkbox' clicked" ); - verify( isChecked("Checkbox") ); - }, - - select_groupbox_subitem: function() { - startApplication("testapp2"); - - setChecked(true, "Checkable"); - select("Checkable/Groupie"); - compare("'Groupie' clicked", getText("Status")); - - setChecked(false, "Checkable"); - expectFail("Can't select disabled button"); - select("Checkable/Groupie"); - }, - - select_from_popup: function() { - startApplication("testapp2"); - select( "Tab Two", tabBar() ); - - select("Popup"); - select("&No"); - compare("No", getText("Popup response")); - - select("Popup"); - select("&Yes"); - compare("Yes", getText("Popup response")); - }, - - enter_invisible: function() { - startApplication("testapp2"); - select( "Tab Two", tabBar() ); - - setChecked(true, "Checkbox"); - enter("hello world", "Silly 1"); - - setChecked(false, "Checkbox"); - expectFail("Can't enter text into non-visible widget"); - enter("hello again world", "Silly 2"); - }, - - select_menu: function() { - startApplication("testapp2"); - select( "Tab Free", tabBar() ); - - select("Menu Item #3", "Menu"); - compare("Menu Item #3", getText("Menu")); - } -} diff --git a/tests/qtuitest/sys_input/sys_input.pro b/tests/qtuitest/sys_input/sys_input.pro index 6599717..ada46f4 100644 --- a/tests/qtuitest/sys_input/sys_input.pro +++ b/tests/qtuitest/sys_input/sys_input.pro @@ -1,10 +1,10 @@ -SOURCES=sys_input.js +SOURCES=sys_input.qtt TESTAPPS=testapp1 testapp2 testapp3 CONFIG+=systemtest - target.path += \ /usr/local/bin INSTALLS += \ - target \ No newline at end of file + target + diff --git a/tests/qtuitest/sys_input/sys_input.qtt b/tests/qtuitest/sys_input/sys_input.qtt new file mode 100644 index 0000000..51f7301 --- /dev/null +++ b/tests/qtuitest/sys_input/sys_input.qtt @@ -0,0 +1,399 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +testcase = { + + runAsManualTest: function() { + if (!runAsManualTest()) + skip( "This test only makes sense when executed in -force-manual mode" ); + + manualTest( "Do something" ); + startApplication("foobar"); + prompt( "This should all nicely fold into one big prompt" ); + prompt( "Line 1\nLine 2\nLine 3" ); + verify( isVisible( "blah" ) ); + verify( isVisible( activeWindow() ) ); + compare( getText(focusWidget()), "this text" ); + compare( "this text", getText(focusWidget()) ); + compare( getSelectedText(tabBar()), getText(focusWidget()) ); + select( "foo", tabBar() ); + compare( getSelectedText(tabBar()), "First Tab" ); + compare( getSelectedValue("Name"), "a reference value" ); + compare( getValue("Address"), "Elysium road" ); + compare( "Elysium road", getValue("Address") ); + compare( getList( "Friends"), getList( "Other Friends") ); + mouseClick( getCenter( "foo", "bar" ) ); + var l = getLabels( "app" ); + verify(l.contains("Name"), "Verify that labels for 'app' contain 'Name'"); + setClipboardText( l ); + compare( getClipboardText(), "foobar" ); + compare( currentTitle(), "Contacts" ); + compare( getWindowTitles(), "A\nB\nC" ); + activateWindow( "mainwindow" ); + verify( getenv( "PATH" ).contains( "/home/user/foobar" ) ); + verify( checkOS( "linux" ) ); + verifyImage( "task_completed", "", + "Verify that the current task is shown with a green tick indicating completion" ); + verify( compareImage( "expected", "actual" )); + verify( getData("srcFile") == "blah" ); + verify( getImageSize( "srcFile" ) == "12345" ); + getFile("/tmp/foo.conf", "$HOME/Settings/foo.conf" ); + putFile("testdata/my_settings.conf", "$HOME/Settings/foo.conf"); + putFile("testdata/my_file", "$HOME/my_file", 12 ); //QFile.WriteOwner | QFile.ReadOwner | QFile.ReadOther); + }, + + runAutoTest: function() { + if (runAsManualTest()) + skip( "This test only makes sense when NOT executed in -force-manual mode" ); + + startApplication("testapp1"); + manualTest( "step 1"); + manualTest( "step 2"); + manualTest( "step 3"); + + compare(currentTitle(), "testapp1"); + + manualTest( "step4" ); + manualTest( "step5" ); + manualTest( "step6" ); + }, + + activate_tabBar: function() { + startApplication("testapp1"); + + select( "First Tab", tabBar() ); + compare( getSelectedText(tabBar()), "First Tab" ); + + select( "Cow Tab", tabBar() ); + compare( getSelectedText(tabBar()), "Cow Tab" ); + + select( "First Tab", tabBar() ); + compare( getSelectedText(tabBar()), "First Tab" ); + + select( "Awesome Tab", tabBar() ); + compare( getSelectedText(tabBar()), "Awesome Tab" ); + }, + + enter_single_data: { + numeric: "0", + asterisk: "*", + percent: "%", + question: "?", + comma: ",", + lower1: "a", + upper: "B", + lower2: "z" + }, + + enter_single: function(character) { + startApplication("testapp1"); + select( "First Tab", tabBar() ); + enter(character, "Status"); + compare(getText("Status"), character); + + }, + + enter_text: function(text) { + startApplication("testapp1"); + + select( "First Tab", tabBar() ); + enter(text, "LineEdit1"); + compare( getText("Status"), "LineEdit1 text changed" ); + compare( getText("LineEdit1"), text ); + + enter("clear", "LineEdit2"); + compare( getText("Status"), "LineEdit2 text changed" ); + compare( getText("LineEdit2"), "clear" ); + + if (mousePreferred()) { + mouseClick("LineEdit1"); + keyClick(Qt.Key_Home); + mouseClick("LineEdit2"); + } + enter("overwrite", "LineEdit1"); + compare( getText("LineEdit1"), "overwrite" ); + }, + + enter_text_data: { + mixed_case: [ "MiXeD CASe" ], + punctuation: [ "!@#$%^&*()-=_+[]{}\|;:',./<>?`~" ], + allsorts: [ "$100! How Much?" ], + with_numbers: [ "1 2 3SD770 4 25 312" ], + in_dict: [ "hello kitty" ], + not_in_dict: [ "jtnerlnjas mtrnen" ], + long_str: [ "this is a really long string to test we can overwrite properly" ], + + // Test for bug: "Jimmy" sometimes gives "Jinny" in predictive keyboard. + jimmy: [ "Jimmy jimmy" ] + }, + + enter_QTextEdit: function(text) { + startApplication("testapp3"); + + select("Text", tabBar()); + + enter(text, "Text"); + compare( getText("Text"), text ); + + enter("overwrite", "Text"); + compare( getText("Text"), "overwrite" ); + }, + + enter_QTextEdit_data: { + single_line: [ "This is a single line" ], + //multi_lines: [ "This is\nmultiple lines of\n\ntext" ] + alotta_text: [ "This is a lot of text to ensure we get a scroll bar happening yes this is a lot of text to ensure we get a scroll bar happening yes" ] + }, + + enter_QTimeEdit: function(time, shouldPass) { + startApplication("testapp1"); + + select("Awesome Tab", tabBar()); + + if (!shouldPass) expectFail("Bad time given"); + enter(time, "Time"); + + compare( getValue("Time"), time ); + }, + + enter_QTimeEdit_data: { + simple1: [ new QTime(16, 55, 00), true ], + simple2: [ new QTime(14, 10, 38), true ], + sdigit1: [ new QTime(1, 33, 10), true ], + sdigit2: [ new QTime(19, 7, 11), true ], + sdigit3: [ new QTime(22, 21, 1), true ], + + bad1: [ new QTime(25, 21, 1), false ], + bad2: [ new QTime(22, 88, 1), false ], + bad3: [ new QTime(21, 21, -1), false ] + }, + + // enter() with QDateEdit fields. + enter_QDateEdit: function(date) { + startApplication("testapp1"); + + select("Awesome Tab", tabBar()); + + enter(date, "Date"); + + compare( getValue("Date"), date ); + + }, + + enter_QDateEdit_data: { + simple1: [ new Date(2000, 6, 15) ], + december: [ new Date(2000, 12, 15) ], + end_of_month: [ new Date(2002, 6, 30) ], + simple2: [ new Date(2004, 10, 11) ] + }, + + // Explicit mouse clicks on widgets + mouseClick: function() { + startApplication("testapp1"); + select( "Cow Tab", tabBar() ); + compare( getSelectedText(tabBar()), "Cow Tab" ); + + mouseClick("CowButton1"); + compare( getText("CowStatus"), "CowButton1 clicked" ); + + mouseClick("CowButton2"); + compare( getText("CowStatus"), "CowButton2 clicked" ); + + mouseClick("CowButton16"); + compare( getText("CowStatus"), "CowButton16 clicked" ); + + mouseClick("CowButton0"); + compare( getText("CowStatus"), "CowButton0 clicked" ); + }, + + activate_button: function() { + startApplication("testapp1"); + + select("First Tab", tabBar()); + compare( getSelectedText(tabBar()), "First Tab" ); + + select("Button1"); + compare( getText("Status"), "Button1 clicked" ); + select("Button2"); + compare( getText("Status"), "Button2 clicked" ); + }, + + activate_combobox: function() { + startApplication("testapp1"); + + select( "Cow Tab", tabBar() ); + + select( "Woof", "Cow Goes?" ); + compare( getText("CowStatus"), "Cow Goes? changed" ); + compare( getSelectedText("Cow Goes?"), "Woof" ); + + // To clear 'Status' + select( "CowButton0" ); + compare( getText("CowStatus"), "CowButton0 clicked" ); + + select( "Moo", "Cow Goes?" ); + compare( getText("CowStatus"), "Cow Goes? changed" ); + compare( getSelectedText("Cow Goes?"), "Moo" ); + }, + + activate_editable_combobox: function() { + startApplication("testapp1"); + + select( "First Tab", tabBar() ); + + select( "Yellow", "Colour" ); + compare( getText("Status"), "Colour changed" ); + compare( getSelectedText("Colour"), "Yellow" ); + + // To clear 'Status' + select("Button1"); + compare( getText("Status"), "Button1 clicked" ); + + select( "Blue", "Colour" ); + compare( getText("Status"), "Colour changed" ); + compare( getSelectedText("Colour"), "Blue" ); + }, + + scroll_scrollarea_vertical: function() { + startApplication("testapp1"); + + select( "Cow Tab", tabBar() ); + + select( "CowButton0" ); + compare( getText("CowStatus"), "CowButton0 clicked" ); + + // Scroll down to the bottom + select( "CowButton15" ); + compare( getText("CowStatus"), "CowButton15 clicked" ); + + // Scroll up to the top + select( "CowButton0" ); + compare( getText("CowStatus"), "CowButton0 clicked" ); + }, + + scroll_combobox: function() { + startApplication("testapp1"); + + select( "Cow Tab", tabBar() ); + + select( "Woof", "Cow Goes?" ); + compare( getText("CowStatus"), "Cow Goes? changed" ); + compare( getSelectedText("Cow Goes?"), "Woof" ); + + // This item is the last one in the combobox + select( "Choo choo!", "Cow Goes?" ); + compare( getText("CowStatus"), "Cow Goes? changed" ); + compare( getSelectedText("Cow Goes?"), "Choo choo!" ); + }, + + setChecked_checkbox: function() { + startApplication("testapp1"); + + select( "Awesome Tab", tabBar() ); + + select( "Clear" ); + compare( getText("Status"), "'Clear' clicked" ); + + setChecked( true, "Checkbox" ); + compare( getText("Status"), "'Checkbox' clicked" ); + verify( isChecked("Checkbox") ); + + select( "Clear" ); + compare( getText("Status"), "'Clear' clicked" ); + + setChecked( false, "Checkbox" ); + compare( getText("Status"), "'Checkbox' clicked" ); + verify( !isChecked("Checkbox") ); + + select( "Clear" ); + compare( getText("Status"), "'Clear' clicked" ); + + setChecked( true, "Checkbox" ); + compare( getText("Status"), "'Checkbox' clicked" ); + verify( isChecked("Checkbox") ); + }, + + select_groupbox_subitem: function() { + startApplication("testapp2"); + + setChecked(true, "Checkable"); + select("Checkable/Groupie"); + compare("'Groupie' clicked", getText("Status")); + + setChecked(false, "Checkable"); + expectFail("Can't select disabled button"); + select("Checkable/Groupie"); + }, + + select_from_popup: function() { + startApplication("testapp2"); + select( "Tab Two", tabBar() ); + + select("Popup"); + select("&No"); + compare("No", getText("Popup response")); + + select("Popup"); + select("&Yes"); + compare("Yes", getText("Popup response")); + }, + + enter_invisible: function() { + startApplication("testapp2"); + select( "Tab Two", tabBar() ); + + setChecked(true, "Checkbox"); + enter("hello world", "Silly 1"); + + setChecked(false, "Checkbox"); + expectFail("Can't enter text into non-visible widget"); + enter("hello again world", "Silly 2"); + }, + + select_menu: function() { + startApplication("testapp2"); + select( "Tab Free", tabBar() ); + + select("Menu Item #3", "Menu"); + compare("Menu Item #3", getText("Menu")); + } +} diff --git a/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.cpp b/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.cpp index 64b5a32..d40723e 100644 --- a/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.cpp +++ b/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include -- cgit v1.2.3 From f8279460c968463838002c8c78b4b2d11f403cbb Mon Sep 17 00:00:00 2001 From: dac Date: Fri, 23 Jul 2010 10:23:34 +1000 Subject: Fix startApplication failing to start test apps on Windows. --- libqsystemtest/qsystemtest_p.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libqsystemtest/qsystemtest_p.cpp b/libqsystemtest/qsystemtest_p.cpp index 82e684f..7bc78ea 100644 --- a/libqsystemtest/qsystemtest_p.cpp +++ b/libqsystemtest/qsystemtest_p.cpp @@ -744,7 +744,7 @@ QString QSystemTest::PATH() { QStringList env = QProcess::systemEnvironment(); foreach (QString line, env) { - if (line.startsWith("PATH")) + if (line.startsWith("PATH=", Qt::CaseInsensitive)) return line.mid(line.indexOf("=")+1); } return ""; @@ -772,6 +772,7 @@ QString QSystemTest::which( const QString &appName ) if (QFile::exists(mac_name)) return mac_name; #endif #if defined Q_OS_WIN32 + if (QFile::exists(fname+".exe")) return fname+".exe"; if (QFile::exists(fname+".bat")) return fname+".bat"; #endif } -- cgit v1.2.3