diff options
Diffstat (limited to 'tests')
51 files changed, 3425 insertions, 0 deletions
diff --git a/tests/AllTests.qml b/tests/AllTests.qml new file mode 100644 index 0000000..cdae596 --- /dev/null +++ b/tests/AllTests.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +TestCollection { + id: suite + name: 'All tests' + description: 'Tests all the cases' + + InterpreterTests {} + RemoteTests {} + +} diff --git a/tests/InterpreterTests.qml b/tests/InterpreterTests.qml new file mode 100644 index 0000000..db3ab8c --- /dev/null +++ b/tests/InterpreterTests.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +import "interpreter" + +TestCollection { + name: 'interpreter only tests' + description: name + + CoreTests {} + RunnerTests {} +} diff --git a/tests/MyConfig.qml b/tests/MyConfig.qml new file mode 100644 index 0000000..905d8a4 --- /dev/null +++ b/tests/MyConfig.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtSystemTest 1.0 + +Config { + Remote { + id: sut + host: 'localhost' + port: 5656 + } +} + + diff --git a/tests/RemoteTests.qml b/tests/RemoteTests.qml new file mode 100644 index 0000000..094b5bc --- /dev/null +++ b/tests/RemoteTests.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +import "remote" + +TestCollection { + name: 'remote (qtuitestd) tests' + description: name + + RunProcessTests {} + RemoteApiTests{} + AssistantTest{} + TestAppWidgetTest{} + QstObjectApiTests{} +} diff --git a/tests/interpreter/CoreTests.qml b/tests/interpreter/CoreTests.qml new file mode 100644 index 0000000..108f50f --- /dev/null +++ b/tests/interpreter/CoreTests.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import "core" + +TestCollection { + name: 'core api test' + description: name + Test { + name: 'Js api: currentFile'; description: name + + property string expectedFileName: 'CoreTests.qml' + function run() { + var path = core().Js.Engine.currentFile(); + var fileName = path.substring(path.lastIndexOf('/')+1); + expect(fileName).toBe(expectedFileName); + } + } + + ExpectApiTests{} + SleepTest{} + ClassTest{} + FailApiTest{} + ItemHandlerTests{} + ApplicationRegistryTests{} +} diff --git a/tests/interpreter/RunnerTests.qml b/tests/interpreter/RunnerTests.qml new file mode 100644 index 0000000..6046ca2 --- /dev/null +++ b/tests/interpreter/RunnerTests.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +import "runner" + +TestCollection { + name: 'runner logic tests'; description: name + + EmptyTest{} + EmptyTests{} + SkipTest{} + FailTest{} + UntestedTest{} + UntestedTests{} + DefaultConfigTest{} +} + diff --git a/tests/interpreter/core/ApplicationRegistryTests.qml b/tests/interpreter/core/ApplicationRegistryTests.qml new file mode 100644 index 0000000..67c215b --- /dev/null +++ b/tests/interpreter/core/ApplicationRegistryTests.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import "application" + +TestCollection { + name: 'Application object test'; description: name + + RegisterUnregisterAppTest{} + DefaultApplicationTest{} + CustomApplicationTest{} +} diff --git a/tests/interpreter/core/ClassTest.qml b/tests/interpreter/core/ClassTest.qml new file mode 100644 index 0000000..56f3c86 --- /dev/null +++ b/tests/interpreter/core/ClassTest.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +TestCollection { + id: root + name: 'Javascript Class api test' + description: name + + function _() { + // dummy + // used instead of property var in Qt5 + } + + function setup() { + var Class = core().Class; + var Shape = Class.create(function(name) { + return { + name: function(){ return name; }, + + setName: function setName(value) { name = value; } + }; + }); + _.Class = Class; + _.Shape = Shape; + } + + Test { + name: 'construct objects'; description: name + function run() { + var Shape = _.Shape; + + var x = null; + expect(x).toBe(null); + + x = new Shape('x'); + expect(x).not.toBe(null); + expect(x).instanceOf(Shape); + } + } + + Test { + name: 'invoke methods'; description: name + function run() { + var x = new _.Shape('x'); + expect(x.name()).toBe('x'); + x.setName('y'); + expect(x.name()).toBe('y'); + } + + } + + Test { + name: 'extend objects'; description: name + function run() { + var Circle = _.Shape.extend(function(r) { + this._super('Circle'); + return { + radius: function(){ return r; } + }; + }); + + var c = new Circle(10); + expect(c).instanceOf(_.Shape); + expect(c).instanceOf(Circle); + expect(c.name()).toBe('Circle'); + expect(c.radius()).toBe(10); + } + } + + Test { + name: 'private calls public'; description: name + + function setup() { + var Class = _.Class; + var Base = Class.create(function() { + + function bar() { + return this.overrideMe(); + } + function foo() { + return bar.call(this); + } + return { + overrideMe: function() { return 'Base'}, + foo: foo + }; + }); + _.base = new Base(); + } + function run() { + expect(_.base.foo()).toBe('Base'); + } + } +} diff --git a/tests/interpreter/core/ExpectApiTests.qml b/tests/interpreter/core/ExpectApiTests.qml new file mode 100644 index 0000000..488d14f --- /dev/null +++ b/tests/interpreter/core/ExpectApiTests.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +TestCollection { + name: 'expect api tests'; description: name + + Test { + name: 'expect.not'; description: name; + function run() { + expect(undefined).toBe(undefined); + expect(null).not.toBe(undefined); + } + } +} + + diff --git a/tests/interpreter/core/FailApiTest.qml b/tests/interpreter/core/FailApiTest.qml new file mode 100644 index 0000000..a9eba0f --- /dev/null +++ b/tests/interpreter/core/FailApiTest.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + name: 'fail api test'; description: name + + function run() { + var error, + topOfStack, + msg = 'A fail message'; + + var Core = core(); + var Engine = Core.Js.Engine; + var currentFile = Core.Js.Engine.currentFile(); + + try { + var beforeFail = Engine.currentLine(); + throw new Core.Qtt.Fail(msg); + } catch(e) { + error = e; + topOfStack = e.stack.first(); + } + + expect(error).instanceOf(Core.Qtt.Error); + expect(error).instanceOf(Core.Qtt.Fail); + + expect(error.message).toBe(msg); + expect(error.type).toBe('Fail'); + expect(error.status).toBe(Core.Qtt.Status.Failed); + + expect(topOfStack.fileName).toBe(currentFile); + expect(topOfStack.lineNumber).toBe(beforeFail+1); + } + +} + diff --git a/tests/interpreter/core/ItemHandlerTests.qml b/tests/interpreter/core/ItemHandlerTests.qml new file mode 100644 index 0000000..f904d4b --- /dev/null +++ b/tests/interpreter/core/ItemHandlerTests.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import "itemhandlers" + +TestCollection { + name: 'item handler tests'; description: name + + RegisterUnregisterHandlerTest{} + DefaultItemHandlerTest{} + CustomItemHandlerTest{} +} diff --git a/tests/interpreter/core/LocalProcessTest.qml b/tests/interpreter/core/LocalProcessTest.qml new file mode 100644 index 0000000..f324d44 --- /dev/null +++ b/tests/interpreter/core/LocalProcessTest.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtSystemTest 1.0 + +Test { + name: 'process'; description: name + property int timeout: 3000 + property LocalProcess process: LocalProcess { + outputMode: LocalProcess.PropertyOutput + } + + function run() { + process.start("bc"); + process.write("p = 3 + 4\n"); + process.write("p\n"); + expect(process.waitForReadyRead(timeout)).toBe(true); + expect(process.standardOutput).toBe('7\n') + process.write("2 * p\n") + process.closeWriteChannel(); + expect(process.waitForFinished(timeout)).toBe(true); + + expect(process.standardOutput).toBe('7\n14\n') + expect(process.exitCode).toBe(0); + } +} diff --git a/tests/interpreter/core/SleepTest.qml b/tests/interpreter/core/SleepTest.qml new file mode 100644 index 0000000..0483061 --- /dev/null +++ b/tests/interpreter/core/SleepTest.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + name: 'sleep'; description: name + property int interval: 50 + + function run() { + var beforeSleep = +(new Date()); + sleep(interval); + var afterSleep = +(new Date()); + expect(afterSleep - beforeSleep).toBeBetween(interval*0.95, interval*1.05); + } +} diff --git a/tests/interpreter/core/application/CustomApplicationTest.qml b/tests/interpreter/core/application/CustomApplicationTest.qml new file mode 100644 index 0000000..177f261 --- /dev/null +++ b/tests/interpreter/core/application/CustomApplicationTest.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + id: root + name: 'custom app handler'; description: name + + function _() {} + + property string appId: 'MyApp' + property string filePath: className + '.qml' + property string className: 'MyApplication' + + + function setup() { + var registry = core().ApplicationRegistry; + registry.register(appId, filePath); + var p = registry.applicationForKey(appId); + expect(p).not.toBe(undefined); + _.registry = registry; + } + + function run() { + var registry = _.registry; + var component = registry.applicationForKey(appId); + var app = component.createObject(root); + var handler = app.toString().split('_').first(); + expect(handler).toBe(className); + + expect(app.name).toBe(className); + expect(app.item()).toBe(className); + } + + function cleanup() { + var registry = _.registry; + registry.unregister(appId); + } +} diff --git a/tests/interpreter/core/application/DefaultApplicationTest.qml b/tests/interpreter/core/application/DefaultApplicationTest.qml new file mode 100644 index 0000000..277765b --- /dev/null +++ b/tests/interpreter/core/application/DefaultApplicationTest.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + id: root + name: 'Default application handler'; description: name + + function _() {} + property string defaultHandler: 'Application' + + function setup() { + var factory = core().ApplicationRegistry; + expect(factory).not.toBe(undefined); + _.factory = factory; + } + + function run() { + var + key = 'foobar', + factory = _.factory, + file, + component, + appObject, + className + ; + + file = factory.fileForKey(key); + expect(file.endsWith('/'+ defaultHandler + '.qml')).toBe(true); + + component = factory.applicationForKey(key); + expect(component).not.toBe(undefined); + expect(component).not.toBe(null); + + + appObject = component.createObject(root); + expect(appObject).not.toBe(undefined); + expect(appObject).not.toBe(null); + + className = appObject.toString().split('_').first(); + expect(className).toBe(defaultHandler); + } +} diff --git a/tests/interpreter/core/application/MyApplication.js b/tests/interpreter/core/application/MyApplication.js new file mode 100644 index 0000000..07aa821 --- /dev/null +++ b/tests/interpreter/core/application/MyApplication.js @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +.pragma library +.import QtSystemTest 1.0 as Qst + +(function() { + var Apps = Qst.Core.ApplicationRegistry; + Apps.register('myapp', 'MyApplication.qml'); +})(); diff --git a/tests/interpreter/core/application/MyApplication.qml b/tests/interpreter/core/application/MyApplication.qml new file mode 100644 index 0000000..befd0b7 --- /dev/null +++ b/tests/interpreter/core/application/MyApplication.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Application { + property string name: 'MyApplication' + function item() { + return name; + } +} diff --git a/tests/interpreter/core/application/RegisterUnregisterAppTest.qml b/tests/interpreter/core/application/RegisterUnregisterAppTest.qml new file mode 100644 index 0000000..e3771e9 --- /dev/null +++ b/tests/interpreter/core/application/RegisterUnregisterAppTest.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + id: root + name: 'register and unregister item handler'; description: name + + function _() {} + property string defaultHandler: 'Application' + + property string key: 'myapp' + property string className: 'MyApplication' + property string filePath: className + '.qml' + + + function setup() { + var factory = core().ApplicationRegistry; + expect(factory).not.toBe(undefined); + _.factory = factory; + } + + function expectAppHandler(handlerClassName) { + var + factory = _.factory, + file, + component, + appObject, + className + ; + + file = factory.fileForKey(key); + expect(file.endsWith('/'+ handlerClassName + '.qml')).toBe(true); + + component = factory.applicationForKey(key); + expect(component).not.toBe(undefined); + expect(component).not.toBe(null); + + + appObject = component.createObject(root); + expect(appObject).not.toBe(undefined); + expect(appObject).not.toBe(null); + + className = appObject.toString().split('_').first(); + expect(className).toBe(handlerClassName); + } + + function run() { + var factory = _.factory; + expectAppHandler(defaultHandler); + factory.register(key, filePath); + expectAppHandler(className); + factory.unregister(key); + expectAppHandler(defaultHandler); + } +} diff --git a/tests/interpreter/core/itemhandlers/CustomItemHandlerTest.qml b/tests/interpreter/core/itemhandlers/CustomItemHandlerTest.qml new file mode 100644 index 0000000..8daae69 --- /dev/null +++ b/tests/interpreter/core/itemhandlers/CustomItemHandlerTest.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + id: root + name: 'custom item handler'; description: name + + property string className: 'QstPushButton' + property string filePath: className + '.qml' + + function _() {} + + property Application app: Application { + function __inheritanceTree() { return [className, 'QObject']; } + } + + function setup() { + _.factory = core().ItemFactory + _.factory.register(className, filePath); + } + + function run() { + var pushButton = app.__handlerForObject({_type_: className}); + + var handler = pushButton.toString().split('_').first(); + expect(handler).toBe(className); + + expect(pushButton.name).toBe(className); + expect(pushButton.reallyAButton).toBe(true); + } + + function cleanup() { + _.factory.unregister(className); + } +} diff --git a/tests/interpreter/core/itemhandlers/DefaultItemHandlerTest.qml b/tests/interpreter/core/itemhandlers/DefaultItemHandlerTest.qml new file mode 100644 index 0000000..d33947d --- /dev/null +++ b/tests/interpreter/core/itemhandlers/DefaultItemHandlerTest.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + id: root + name: 'default item handler'; description: name + + property string className: 'foo' + function _() {} + + property Application app: Application { + function __inheritanceTree() { return [className, 'QObject']; } + } + + function setup() { + } + + + function run() { + var component = _.component; + var handler = app.__handlerForObject({_type_: className}); + expect(handler).not.toBe(undefined); + expect(handler.__internals._type_).toBe(className); + var qmlType = handler.toString().split('_').first(); + expect(qmlType).toBe('QstObject'); + } +} diff --git a/tests/interpreter/core/itemhandlers/QstPushButton.qml b/tests/interpreter/core/itemhandlers/QstPushButton.qml new file mode 100644 index 0000000..fd38271 --- /dev/null +++ b/tests/interpreter/core/itemhandlers/QstPushButton.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +QstObject { + handles: 'QstPushButton' + property string name: 'QstPushButton' + property bool reallyAButton: true + + function press() { + } +} diff --git a/tests/interpreter/core/itemhandlers/RegisterUnregisterHandlerTest.qml b/tests/interpreter/core/itemhandlers/RegisterUnregisterHandlerTest.qml new file mode 100644 index 0000000..85c1618 --- /dev/null +++ b/tests/interpreter/core/itemhandlers/RegisterUnregisterHandlerTest.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + id: root + name: 'register and unregister item handler'; description: name + + function _() {} + property string className: 'QstPushButton' + property string filePath: className + '.qml' + + + property Application app: Application { + function __inheritanceTree() { return [className, 'QObject']; } + } + + function setup() { + _.factory = core().ItemFactory; + expect(_.factory).not.toBe(undefined); + } + + function expectItemHandler( handlerClassName) { + var factory = _.factory; + var handler, handlerClass; + + handler = app.__handlerForObject({ _type_: className }); + expect(handler).not.toBe(undefined); + expect(handler.__internals._type_).toBe(className); + + handlerClass = handler.toString().split('_').first(); + expect(handlerClass).toBe(handlerClassName); + } + + function run() { + var factory = _.factory; + expectItemHandler('QstObject'); + factory.register(className, filePath); + expectItemHandler(className); + factory.unregister(className); + expectItemHandler('QstObject'); + } +} diff --git a/tests/interpreter/loggers/data/ExpectTests.qml b/tests/interpreter/loggers/data/ExpectTests.qml new file mode 100644 index 0000000..d854e5f --- /dev/null +++ b/tests/interpreter/loggers/data/ExpectTests.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtSystemTest 1.0 + +TestCollection { + name: 'expect tests'; description: 'A expectation tests' + + Test { + name: 'toBe'; description: 'to be' + + function run() { + expect(3).toBe(3); + expect(2 + 2).toBe(3); // for large values of 3 + } + } + + Test { + name: 'not.toBe'; description: 'not to be' + + function run() { + expect('Claudius').not.toBe('Polonius'); + expect('Claudius').not.toBe('Claudius'); + } + } + + Test { + name: 'instanceof'; description: 'expect to be instance of' + + function run() { + var message = new String('Hello World'); + expect(message).instanceOf(String); + expect(message).not.instanceOf(Number); + expect(message).instanceOf(Number); + } + } + + Test { + name: 'between'; description: 'expect to be between' + + function run() { + expect(2 + 2).toBeBetween(3,5); + expect(2 + 2).toBeBetween(4,6); + } + } + +} diff --git a/tests/interpreter/loggers/data/FailTest.qml b/tests/interpreter/loggers/data/FailTest.qml new file mode 100644 index 0000000..fee4713 --- /dev/null +++ b/tests/interpreter/loggers/data/FailTest.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtSystemTest 1.0 + +Test { + name: 'fail'; description: 'failure test' + + function run() { + fail('reason for failure'); + } +} + diff --git a/tests/interpreter/loggers/data/PassTest.qml b/tests/interpreter/loggers/data/PassTest.qml new file mode 100644 index 0000000..352efb1 --- /dev/null +++ b/tests/interpreter/loggers/data/PassTest.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtSystemTest 1.0 + +Test { + name: 'pass'; description: 'pass test' + + function run() { + log('need to actually test something to be a pass'); + expect(3).toBe(3); + } +} diff --git a/tests/interpreter/loggers/data/SkipTest.qml b/tests/interpreter/loggers/data/SkipTest.qml new file mode 100644 index 0000000..732e4b6 --- /dev/null +++ b/tests/interpreter/loggers/data/SkipTest.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtSystemTest 1.0 + +Test { + name: 'skip'; description: 'skip test' + + function run() { + skip('Skip this test'); + fail('reason for failure'); + } +} + diff --git a/tests/interpreter/loggers/data/SubTests.qml b/tests/interpreter/loggers/data/SubTests.qml new file mode 100644 index 0000000..fed8ba6 --- /dev/null +++ b/tests/interpreter/loggers/data/SubTests.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtSystemTest 1.0 + +TestCollection { + name: 'subcollection'; description: 'A sub collection of tests' + + PassTest {} + SkipTest {} + FailTest {} + ExpectTests {} +} diff --git a/tests/interpreter/loggers/data/Tests.qml b/tests/interpreter/loggers/data/Tests.qml new file mode 100644 index 0000000..016f255 --- /dev/null +++ b/tests/interpreter/loggers/data/Tests.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtSystemTest 1.0 + +TestCollection { + name: 'collection'; description: 'A collection of tests' + + SubTests { + name: 'collection 1' + } + SubTests { + name: 'collection 2' + } + SubTests { + name: 'collection 3' + } +} diff --git a/tests/interpreter/loggers/data/qsystemtest.xsd b/tests/interpreter/loggers/data/qsystemtest.xsd new file mode 100644 index 0000000..35b852a --- /dev/null +++ b/tests/interpreter/loggers/data/qsystemtest.xsd @@ -0,0 +1,228 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + attributeFormDefault="unqualified"> + <xs:annotation> + <xs:documentation xml:lang="en">QtSystemTest xml test result schema. + </xs:documentation> + </xs:annotation> + <xs:element name="systemtestrun"> + <xs:annotation> + <xs:documentation xml:lang="en">Instance of running the test interpreter over a test file + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="collection" type="collection"/> + <xs:element name="report"> + <xs:complexType> + <xs:sequence> + <xs:element name="status" type="Status" minOccurs="0" maxOccurs="1"/> + <xs:element name="passed" type="xs:decimal"/> + <xs:element name="skipped" type="xs:decimal"/> + <xs:element name="untested" type="xs:decimal"/> + <xs:element name="failed" type="xs:decimal"/> + <xs:element name="error" type="xs:decimal"/> + <xs:element name="total" type="xs:decimal"/> + <xs:element name="duration" type="xs:decimal" minOccurs="0" maxOccurs="1"/> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:complexType name="collection"> + <xs:annotation> + <xs:documentation xml:lang="en">A collection of test and test collections + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element name="collection" type="collection"/> + <xs:element name="test" type="test"/> + </xs:choice> + <xs:element name="report" type="report"/> + </xs:sequence> + <xs:attribute name="name" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Name of the collection</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="file" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">File which defines the collection</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="line" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Line in the file where the collection is defined</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="timestamp" type="xs:dateTime" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">When the collection was executed in UTC time</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + <xs:complexType name="test"> + <xs:sequence> + <xs:element name="method" type="method" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="report" type="report"/> + </xs:sequence> + <xs:attribute name="name" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Name of the collection</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="file" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">File which defines the collection</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="line" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Line in the file where the collection is defined</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="timestamp" type="xs:dateTime" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">When the collection was executed in UTC time</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + <xs:complexType name="method"> + <xs:sequence> + <xs:choice> + <xs:element name="method" type="method"/> + <xs:element name="failed" type="event"/> + <xs:element name="passed" type="event"/> + <xs:element name="skipped" type="event"/> + <xs:element name="error" type="event"/> + <xs:element name="untested" type="event"/> + <xs:element name="note"> + <xs:complexType> + <xs:complexContent> + <xs:extension base="event"> + <xs:attribute name="type" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The type of noted event</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + </xs:choice> + </xs:sequence> + <xs:attribute name="name" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Name of the method</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + <xs:complexType name="event"> + <xs:sequence> + <xs:element name="reason" type="pre-string"/> + <xs:element name="stack" minOccurs="0" maxOccurs="1"> + <xs:complexType> + <xs:sequence> + <xs:element name="frame" minOccurs="1" maxOccurs="unbounded"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="pre-string"> + <xs:attribute name="file" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">File for the frame content</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="line" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Line for the frame content</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="meta" minOccurs="0" maxOccurs="1"> + <xs:complexType> + <xs:sequence> + <xs:element name="property" minOccurs="0" maxOccurs="unbounded"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="pre-string"> + <xs:attribute name="name" type="xs:token" use="required"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="report"> + <xs:sequence> + <xs:element name="status" type="Status" minOccurs="0" maxOccurs="1"/> + <xs:element name="duration" type="xs:decimal" minOccurs="0" maxOccurs="1"/> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="pre-string"> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="Status"> + <xs:restriction base="xs:string"> + <xs:enumeration value="passed"/> + <xs:enumeration value="failed"/> + <xs:enumeration value="untested"/> + <xs:enumeration value="error"/> + <xs:enumeration value="skipped"/> + </xs:restriction> + </xs:simpleType> +</xs:schema> diff --git a/tests/interpreter/runner/DefaultConfigTest.qml b/tests/interpreter/runner/DefaultConfigTest.qml new file mode 100644 index 0000000..c64e055 --- /dev/null +++ b/tests/interpreter/runner/DefaultConfigTest.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + name: 'default config test'; description: name + + function run() { + expect(config.remotes).not.toBe(undefined); + expect(config.remotes.localhost).not.toBe(undefined); + expect(config.remotes.localhost.address).not.toBe(''); + } +} diff --git a/tests/interpreter/runner/EmptyTest.qml b/tests/interpreter/runner/EmptyTest.qml new file mode 100644 index 0000000..360a78f --- /dev/null +++ b/tests/interpreter/runner/EmptyTest.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + name: 'an empty teststep'; description: name + + function setup() { } + function run() { } + function cleanup() { } +} diff --git a/tests/interpreter/runner/EmptyTests.qml b/tests/interpreter/runner/EmptyTests.qml new file mode 100644 index 0000000..26a556e --- /dev/null +++ b/tests/interpreter/runner/EmptyTests.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +TestCollection { + name: 'an empty test collection'; description: name + + function setup() { } + EmptyTest {} + EmptyTest {} + EmptyTest {} + function cleanup() { } +} + diff --git a/tests/interpreter/runner/FailTest.qml b/tests/interpreter/runner/FailTest.qml new file mode 100644 index 0000000..76ad7fd --- /dev/null +++ b/tests/interpreter/runner/FailTest.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import 'RunnerInternals.js' as Internals +Test { + id: root + name: 'fail test'; description: name + + function setup() { + Internals.setItem(root); + Internals.setRunner(__runner); + } + + function run() { + fail('Generate a failure'); + } + + function cleanup() { + /// HACK should not be done + /// DO NOT screw around with the internals + /// it is your fault if things break done + var Core = core(); + if (__status !== Core.Qtt.Status.Failed) { + log('Status is not set to Failed ...'); + Internals.changeReport(Core.Qtt.Status.Failed); + } else { + Internals.changeReport(Core.Qtt.Status.Passed); + } + } + +} diff --git a/tests/interpreter/runner/MyUtils.js b/tests/interpreter/runner/MyUtils.js new file mode 100644 index 0000000..aadb36f --- /dev/null +++ b/tests/interpreter/runner/MyUtils.js @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +.pragma library +.import QtUiTest 1.0 as QtUiTest + +function func() { + var tt = QtUiTest.Core.api(); + tt.fail("hello"); +} diff --git a/tests/interpreter/runner/RunnerInternals.js b/tests/interpreter/runner/RunnerInternals.js new file mode 100644 index 0000000..0fedc54 --- /dev/null +++ b/tests/interpreter/runner/RunnerInternals.js @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +.pragma library + +var runner; +var item; + +function changeReport(to, from) { + from = from || item.__status; + + var report = runner.report; + report[from] --; + report[to] ++; + runner.report = report; + item.__status = to; +} + +function setRunner(r) { + runner = r; +} + +function setItem(i) { + item = i; +} diff --git a/tests/interpreter/runner/SkipTest.qml b/tests/interpreter/runner/SkipTest.qml new file mode 100644 index 0000000..baffea9 --- /dev/null +++ b/tests/interpreter/runner/SkipTest.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import 'RunnerInternals.js' as Internals + +Test { + id: root + name: 'skip'; + description: 'calls skip in run' + + function setup() { + Internals.setItem(root); + Internals.setRunner(__runner); + } + + function run() { + skip('Skip this test'); + } + + function cleanup() { + /// HACK should not be done + /// DO NOT screw around with the internals + /// it is your fault if things break done + var Core = core(); + if (__status !== Core.Qtt.Status.Skipped) { + log('Status is not set to skipped ...'); + Internals.changeReport(Core.Qtt.Status.Failed); + } else { + Internals.changeReport(Core.Qtt.Status.Passed); + } + } +} diff --git a/tests/interpreter/runner/UntestedTest.qml b/tests/interpreter/runner/UntestedTest.qml new file mode 100644 index 0000000..f9f0bd0 --- /dev/null +++ b/tests/interpreter/runner/UntestedTest.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import 'RunnerInternals.js' as Internals + +Test { + id: root + name: 'untested test' + description: name + property bool runGotExecuted: false; + property int untestedTestsBeforeRun: 0 + function setup() { + var Core = core(); + Internals.setItem(root); + Internals.setRunner(__runner); + untestedTestsBeforeRun = __runner.report[Core.Qtt.Status.Untested]; + fail('Generating a failure inside setup'); + } + + // Not having run shouldn't matter since this shouldn't + // be even executed + function run() { + runGotExecuted = true; + } + + function cleanup() { + /// HACK should not be done + /// DO NOT screw around with the internals + /// it is your fault if things break done + var Core = core(); + if (runGotExecuted) { + log('Run got executed somehow ...'); + Internals.changeReport(Core.Qtt.Status.Failed); + return; + } + if (__status !== Core.Qtt.Status.Untested) { + log('Status is not set to Untestsed ...'); + Internals.changeReport(Core.Qtt.Status.Failed); + return; + } + var untestedAfterRun = __runner.report[Core.Qtt.Status.Untested]; + if ( untestedTestsBeforeRun + 1 !== untestedAfterRun) { + log('Wrong count of untested. Untested before run was : ', untestedTestsBeforeRun, + ' and after run is : ', untestedAfterRun); + Internals.changeReport(Core.Qtt.Status.Failed); + return; + } + Internals.changeReport(Core.Qtt.Status.Passed); + } +} diff --git a/tests/interpreter/runner/UntestedTests.qml b/tests/interpreter/runner/UntestedTests.qml new file mode 100644 index 0000000..2e180cd --- /dev/null +++ b/tests/interpreter/runner/UntestedTests.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import 'RunnerInternals.js' as Internals + +TestCollection { + id: root + name: 'untested test collection' + description: 'tests if failing in the setup ' + + 'of a test collection sets all child tests to ' + + ' untested' + + property bool runGotExecuted: false; + property int untestedTestsBeforeRun: 0 + function setup() { + var Core = core(); + Internals.setItem(dummyTest); + Internals.setRunner(__runner); + untestedTestsBeforeRun = __runner.report[Core.Qtt.Status.Untested]; + log('Ignore the untested report, done on purpose'); + fail('Generating a failure inside test collection -> setup'); + } + + Test { + id: dummyTest + name: 'a dummy test'; description: name + + // Not having run shouldn't matter since this shouldn't + // be even executed + function run() { + runGotExecuted = true; + } + } + + function cleanup() { + /// HACK should not be done + /// DO NOT screw around with the internals + /// it is your fault if things break done + var Core = core(); + if (runGotExecuted) { + log('Run got executed somehow ...'); + Internals.changeReport(Core.Qtt.Status.Failed); + return; + } + if (dummyTest.__status !== Core.Qtt.Status.Untested) { + log('Status is not set to Untestsed ...'); + Internals.changeReport(Core.Qtt.Status.Failed); + return; + } + var untestedAfterRun = __runner.report[Core.Qtt.Status.Untested]; + if ( untestedTestsBeforeRun + 1 !== untestedAfterRun) { + log('Wrong count of untested. Untested before run was : ', untestedTestsBeforeRun, + ' and after run is : ', untestedAfterRun); + Internals.changeReport(Core.Qtt.Status.Failed); + return; + } + Internals.changeReport(Core.Qtt.Status.Passed); + } +} diff --git a/tests/remote/AssistantTest.qml b/tests/remote/AssistantTest.qml new file mode 100644 index 0000000..87e0733 --- /dev/null +++ b/tests/remote/AssistantTest.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import 'common' + +ApplicationTest { + name: 'Assistant test' + executableName: 'assistant' + + function run() { + var i, + zoomIn = app.item( { toolTip: "Zoom in"} ), + zoomOut = app.item( { toolTip: "Zoom out"} ); + + app.mouseClick(zoomIn, Qt.RightButton); + sleep(1000); + + for (i=0; i<10; i++) { + app.mouseClick(zoomIn); + } + + for (i=0; i<10; i++) { + app.mouseClick(zoomOut); + } + + app.keyPress(Qt.Key_H); + app.keyPress(Qt.Key_E); + app.keyPress(Qt.Key_L); + app.keyPress(Qt.Key_L); + app.keyPress(Qt.Key_O); + + var p = Qt.point(200,300); + app.mouseClick(p); + sleep(1000); + } +} diff --git a/tests/remote/QstObjectApiTests.qml b/tests/remote/QstObjectApiTests.qml new file mode 100644 index 0000000..e04f1b6 --- /dev/null +++ b/tests/remote/QstObjectApiTests.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +import "qstobject" + +TestCollection { + name: 'QstObject api tests'; description: name + + ItemPropertyTest{} + ParentApiTest{} + InheritanceBasedItemHandlerTest{} +} + diff --git a/tests/remote/RemoteApiTests.qml b/tests/remote/RemoteApiTests.qml new file mode 100644 index 0000000..84cb71e --- /dev/null +++ b/tests/remote/RemoteApiTests.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import 'common' + +TestCollection { + name: 'Remote component Test'; description: name + + ApplicationTest { + name: 'Same Application object test'; description: name + executableName: 'testapp_widgets' + + function run() { + var currentApp = remote.currentApplication(); + expect(currentApp.toString()).toBe(app.toString()); + expect(currentApp).toBe(app); + } + } + +} + diff --git a/tests/remote/RunProcessTests.qml b/tests/remote/RunProcessTests.qml new file mode 100644 index 0000000..c85ad8f --- /dev/null +++ b/tests/remote/RunProcessTests.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +import "runProcess" + +TestCollection { + name: 'runProcess tests'; description: name + + RunCommandTest{} +} diff --git a/tests/remote/TestAppWidgetTest.qml b/tests/remote/TestAppWidgetTest.qml new file mode 100644 index 0000000..3cf62ee --- /dev/null +++ b/tests/remote/TestAppWidgetTest.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import 'common' + +ApplicationTest { + name: 'testwidget tests' + executableName: 'testapp_widgets' + + function run() { + var textEdit = app.item({ + inherits: 'QLineEdit' + } ); + + expect(textEdit.property('text')).not.toBe(undefined); + expect(textEdit.property('text')).toBe(''); + app.mouseClick(textEdit); + + app.keyPress(Qt.Key_H); + app.keyPress(Qt.Key_E); + app.keyPress(Qt.Key_L); + app.keyPress(Qt.Key_L); + app.keyPress(Qt.Key_O); + + expect(textEdit.property('text')).toBe('hello'); + } + +} diff --git a/tests/remote/common/ApplicationTest.qml b/tests/remote/common/ApplicationTest.qml new file mode 100644 index 0000000..5af0acd --- /dev/null +++ b/tests/remote/common/ApplicationTest.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +Test { + name: ''; description: name + + property string executableName: '' + property Application app + property alias remote: host + + remotes: [ + Remote { + id: host + host: config.remotes.localhost.address + } + ] + + + function setup() { + expect(executableName).not.toBe(''); + app = host.startApplication(executableName); + } + + function cleanup() { + app.terminate(); + } +} diff --git a/tests/remote/qstobject/InheritanceBasedItemHandlerTest.qml b/tests/remote/qstobject/InheritanceBasedItemHandlerTest.qml new file mode 100644 index 0000000..83b1fd4 --- /dev/null +++ b/tests/remote/qstobject/InheritanceBasedItemHandlerTest.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import '../common' + +ApplicationTest { + name: 'parent api test' + executableName: 'testapp_widgets' + + function run() { + var textEdit = app.item({ + inherits: 'QLineEdit' + }); + + expect(textEdit.type()).toBe('QLineEdit'); + expect(textEdit.handles).toBe('QWidget'); + + core().ItemFactory.register('QLineEdit', 'MyQLineEdit.qml'); + + var sameTextEdit = app.item({ + inherits: 'QLineEdit' + }); + expect(sameTextEdit.type()).toBe('QLineEdit'); + expect(sameTextEdit.handles).toBe('QLineEdit'); + + core().ItemFactory.unregister('QLineEdit'); + var textEdit3 = app.item({ + text: '', + inherits: 'QLineEdit' + } ); + expect(textEdit3.type()).toBe('QLineEdit'); + expect(textEdit3.handles).toBe('QWidget'); + + } +} diff --git a/tests/remote/qstobject/ItemPropertyTest.qml b/tests/remote/qstobject/ItemPropertyTest.qml new file mode 100644 index 0000000..9022045 --- /dev/null +++ b/tests/remote/qstobject/ItemPropertyTest.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import '../common' + +ApplicationTest { + name: 'property setProperty test' + executableName: 'testapp_widgets' + + function run() { + var textEdit = app.item({ + text: '', + inherits: 'QLineEdit' + } ); + + expect(textEdit.property('text')).not.toBe(undefined); + textEdit.setProperty('text', 'Hello World'); + expect(textEdit.property('text')).toBe('Hello World'); + } +} diff --git a/tests/remote/qstobject/MyQLineEdit.qml b/tests/remote/qstobject/MyQLineEdit.qml new file mode 100644 index 0000000..ee1a299 --- /dev/null +++ b/tests/remote/qstobject/MyQLineEdit.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 + +QstObject { + handles: 'QLineEdit' + function enter(text) { + } +} diff --git a/tests/remote/qstobject/ParentApiTest.qml b/tests/remote/qstobject/ParentApiTest.qml new file mode 100644 index 0000000..59e0008 --- /dev/null +++ b/tests/remote/qstobject/ParentApiTest.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import QtSystemTest 1.0 +import '../common' + +ApplicationTest { + name: 'parent api test' + executableName: 'testapp_widgets' + + function run() { + var textEdit = app.item({ + text: '', + inherits: 'QLineEdit' + } ); + expect(textEdit.type()).toBe('QLineEdit'); + + var parent = textEdit.parent(); + expect(parent).not.toBe(undefined); + expect(parent.__isQmlWrapper).toBe(true); + expect(parent.type()).not.toBe(undefined); + } +} diff --git a/tests/remote/qstobject/QstObjectApiTests.qml b/tests/remote/qstobject/QstObjectApiTests.qml new file mode 100644 index 0000000..9e42e15 --- /dev/null +++ b/tests/remote/qstobject/QstObjectApiTests.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtSystemTest 1.0 +import '../common' + +ApplicationTest { + name: 'parent api test' + executableName: 'testapp_widgets' + + function run() { + var textEdit = app.item({ + text: '', + inherits: 'QLineEdit' + } ); + expect(textEdit.type()).toBe('QLineEdit'); + + var parent = textEdit.parent(); + expect(parent).not.toBe(undefined); + expect(parent.__isQmlWrapper).toBe(true); + expect(parent.type()).not.toBe(undefined); + } +} + diff --git a/tests/remote/runProcess/RunCommandTest.qml b/tests/remote/runProcess/RunCommandTest.qml new file mode 100644 index 0000000..22f9f7e --- /dev/null +++ b/tests/remote/runProcess/RunCommandTest.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of QtSystemTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtSystemTest 1.0 + +Test { + name: 'run ls'; description: name + + remotes: [ + Remote { + id: host + host: config.remotes.localhost.address + } + ] + + function run() { + var output = host.runProcess( { program: "/bin/ls", timeout: 1000 } ); + expect(output).not.toBe(undefined); + expect(output).not.toBe(null); + expect(output.length).not.toBe(0); + log(output); + } +} diff --git a/tests/tests.pro b/tests/tests.pro new file mode 100644 index 0000000..8915388 --- /dev/null +++ b/tests/tests.pro @@ -0,0 +1,31 @@ +TEMPLATE = aux +OTHER_FILES = \ + AllTests.qml \ + InterpreterTests.qml \ + interpreter/RunnerTests.qml \ + interpreter/runner/EmptyTest.qml \ + interpreter/runner/FailTest.qml \ + interpreter/runner/MyUtils.js \ + interpreter/runner/SkipTest.qml \ + interpreter/runner/EmptyTests.qml \ + interpreter/runner/RunnerInternals.js \ + interpreter/runner/UntestedTests.qml \ + interpreter/runner/UntestedTest.qml \ + interpreter/runner/DefaultConfigTest.qml \ + interpreter/CoreTests.qml \ + interpreter/core/ClassTest.qml \ + interpreter/core/FailApiTest.qml \ + interpreter/core/SleepTest.qml \ + interpreter/core/ExpectApiTests.qml \ + interpreter/core/ItemHandlerTests.qml \ + interpreter/core/itemhandlers/DefaultItemHandler.qml \ + interpreter/core/itemhandlers/RegisterUnregisterHandlerTest.qml \ + interpreter/core/itemhandlers/CustomItemHandlerTest.qml \ + interpreter/core/itemhandlers/QstPushButton.qml \ + MyConfig.qml \ + RemoteTests.qml \ + remote/RunProcessTests.qml \ + remote/runProcess/RunCommandTest.qml \ + remote/ItemPropertyTest.qml \ + remote/assistant/AssistantTest.qml \ + remote/TestAppWidgetTest.qml |