summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoly Leshin <ALeshin@luxoft.com>2014-07-17 17:44:46 +0400
committerAnatoly Leshin <ALeshin@luxoft.com>2014-07-17 17:44:46 +0400
commit47fb61f33d89a12c1d7db9139fd3f0a91be5ef14 (patch)
tree93f38c425db8f4250c646e1905b8f5e49d6e1175
parent6fd07954b8158b9cfc13b8eb66cbacda32a9e449 (diff)
downloadsmartdevicelink-47fb61f33d89a12c1d7db9139fd3f0a91be5ef14.tar.gz
Tests made by students
-rw-r--r--test/components/qt_hmi/src/tst_DeleteCommand.qml196
-rw-r--r--test/components/qt_hmi/src/tst_Show.qml363
-rw-r--r--test/components/qt_hmi/src/tst_Timer.qml296
3 files changed, 855 insertions, 0 deletions
diff --git a/test/components/qt_hmi/src/tst_DeleteCommand.qml b/test/components/qt_hmi/src/tst_DeleteCommand.qml
new file mode 100644
index 000000000..b6dc70b74
--- /dev/null
+++ b/test/components/qt_hmi/src/tst_DeleteCommand.qml
@@ -0,0 +1,196 @@
+import QtTest 1.0
+import QtQuick 2.0
+import QtMultimedia 5.0
+import com.ford.sdl.hmi.dbus_adapter 1.0
+import com.ford.sdl.hmi.hw_buttons 1.0
+import com.ford.sdl.hmi.log4cxx 1.0
+import "../../../../src/components/qt_hmi/qml_model_qt5/controls"
+import "../../../../src/components/qt_hmi/qml_model_qt5/views"
+import "../../../../src/components/qt_hmi/qml_model_qt5/hmi_api" as HmiApi
+import "../../../../src/components/qt_hmi/qml_model_qt5/models"
+import "../../../../src/components/qt_hmi/qml_model_qt5/popups"
+import "../../../../src/components/qt_hmi/qml_model_qt5/hmi_api/Common.js" as Common
+import "../../../../src/components/qt_hmi/qml_model_qt5/models/Constants.js" as Constants
+import "../../../../src/components/qt_hmi/qml_model_qt5/models/Internal.js" as Internal
+
+Item
+{
+ width : mainWindowLoader.width
+ height: mainWindowLoader.height
+
+ Loader
+ {
+ id: mainWindowLoader
+ asynchronous : false
+ }
+
+ TestCase
+ {
+ name: "DeleteCommand"
+ when: windowShown
+ property var dataContainer
+ property var sdlUIProxy
+ property var contentLoader
+ property var messageModel
+
+
+ //initialization for each test
+ function createMessageView(appID)
+ {
+ mainWindowLoader.source = ""
+ mainWindowLoader.source = "../../../../src/components/qt_hmi/qml_model_qt5/MainWindow.qml"
+ var mainWindowObject = mainWindowLoader.item
+ if(!mainWindowObject)
+ qtest_fail("mainWindowObject is undefined");
+ var mainScreen = mainWindowObject.getMainScreen()
+ mainScreen.visible = true
+ var warningInfo = mainWindowObject.getWarningInfo()
+ warningInfo.visible = false
+ contentLoader = mainWindowObject.getContentLoader()
+ contentLoader.asynchronous = false
+ sdlUIProxy = mainWindowObject.getUIProxy()
+ dataContainer = mainWindowObject.getDataStorage()
+ dataContainer.addApplication({appName:"TestAppName", appId:appID})
+ }
+
+ //cleanup for each test
+ function destroyView()
+ {
+ //Clear Loader with MainWindow, which delete own models and views
+ mainWindowLoader.source = ""
+ }
+
+ /*
+ * Test Cases
+ */
+
+ // -> Proverka dobavleniya -> Udaleniye kommandu -> Proverka udaleniya
+ function test_01_deleteCommand()
+ {
+ console.debug("enter")
+ var initData = {
+ cmdID: 1,
+ menuParams:
+ {
+ menuName:"",
+ },
+ cmdIcon:"",
+ appID: 1
+ }
+ var initData2 = {
+ cmdID: 2,
+ menuParams:
+ {
+ menuName:"",
+ },
+ cmdIcon:"",
+ appID: 1
+ }
+
+ createMessageView(initData.appID)
+ var app = dataContainer.getApplication(initData.appID)
+ var MenuCount = app.options.count
+ app.options.append(
+ { id: initData.cmdID,
+ name: initData.menuParams.menuName,
+ type: Internal.MenuItemType.MI_NODE,
+ position: Constants.positionOfElementWithoutPosition,
+ icon: initData.cmdIcon ? cmdIcon : {},
+ subMenu: []
+ }
+ )
+
+ compare(app.options.count, MenuCount+1, "Command into menu not added")
+ sdlUIProxy.deleteCommand(initData2)
+
+ var a = 0
+ for(var i=0;((a===0)&&( i<app.options.count)); i++)
+ {
+ if (app.options.get(i).id===initData2.menuID)
+ {
+ a=1
+ }
+ }
+ compare (a, 0, "Command into menu not removed")
+
+
+ destroyView()
+ console.debug("exit")
+ }
+
+ //Sozdaniye submenu -> Sozdanie kommandu v submenu -> Proverka sozdaniya -> Udaleniye kommandu iz submenu -> Proverka udaleniya
+ //
+ function test_02_deleteCommand()
+ {
+ console.debug("enter")
+ var initData = {
+ menuID: 1000,
+ menuParams: {
+ position: 1,
+ menuName: "SubMenu"
+ },
+ appID: 1
+ }
+
+ var initData2 = {
+ cmdID: 1,
+ menuParams: {
+ menuName:"",
+ },
+ cmdIcon:"",
+ appID: 1
+ }
+
+ createMessageView(initData.appID)
+ var app = dataContainer.getApplication(initData.appID)
+ var MenuCount = app.options.count
+ app.options.append (
+ {
+ "id": initData.menuID,
+ "name": initData.menuParams.menuName,
+ "position": initData.menuParams.position,
+ "type": Internal.MenuItemType.MI_SUBMENU,
+ "icon": undefined,
+ "subMenu":[ {
+ "id":initData2.cmdID,
+ "name": initData2.menuParams.menuName,
+ "position": Constants.positionOfElementWithoutPosition,
+ "type": Internal.MenuItemType.MI_PARENT,
+ "icon": {
+ "imageType": Common.ImageType.DYNAMIC,
+ "value": "../res/nav/turnArrow.png"
+ },
+
+ "subMenu": []
+ }
+ ]
+ })
+
+ compare(app.options.count, MenuCount+1, "SubMenu into added")
+ var SubMenuCount = app.options.get(0).subMenu.count
+ compare( SubMenuCount, 1, "Command into SubMenu is not added")
+
+ sdlUIProxy.deleteCommand(initData2)
+
+ for (var i = 0; i<app.options.count;i++)
+ {
+ var option = app.options.get(i)
+ if (option.type === Internal.MenuItemType.MI_SUBMENU)
+ {
+ var subMenu = option.subMenu
+ for (var j = 0; j < subMenu.count; )
+ {
+ compare(subMenu.get(j).id, !(initData2.cmdID), "Command into removed")
+ j++
+ }
+ }
+ }
+ compare(app.options.count , MenuCount+1, "Menu is changed")
+ compare(app.options.get(0).subMenu.count, SubMenuCount-1, "Command into SubMenu is not removed")
+
+ destroyView()
+ console.debug("exit")
+
+ }
+ }
+}
diff --git a/test/components/qt_hmi/src/tst_Show.qml b/test/components/qt_hmi/src/tst_Show.qml
new file mode 100644
index 000000000..2e39546a4
--- /dev/null
+++ b/test/components/qt_hmi/src/tst_Show.qml
@@ -0,0 +1,363 @@
+/**
+ * @file tst_Slider.qml
+ * @brief Test Case for Slider.
+ * Copyright (c) 2013, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtTest 1.0
+import QtQuick 2.0
+import QtMultimedia 5.0
+//import com.ford.sdl.hmi.dbus_adapter 1.0
+//import com.ford.sdl.hmi.hw_buttons 1.0
+//import com.ford.sdl.hmi.log4cxx 1.0
+import "../../../../src/components/qt_hmi/qml_model_qt5/controls"
+import "../../../../src/components/qt_hmi/qml_model_qt5/views"
+import "../../../../src/components/qt_hmi/qml_model_qt5/hmi_api" as HmiApi
+import "../../../../src/components/qt_hmi/qml_model_qt5/models"
+import "../../../../src/components/qt_hmi/qml_model_qt5/popups"
+import "../../../../src/components/qt_hmi/qml_model_qt5/hmi_api/Common.js" as Common
+import "../../../../src/components/qt_hmi/qml_model_qt5/models/Constants.js" as Constants
+import "../../../../src/components/qt_hmi/qml_model_qt5/models/Internal.js" as Internal
+
+Item {
+ width : mainWindowLoader.width
+ height: mainWindowLoader.height
+ Loader {
+ id: mainWindowLoader
+ asynchronous : false
+ }
+
+ TestCase {
+ name: "Show"
+ when: windowShown
+ property var mainWindowComponent : Qt.createComponent("./../../../../src/components/qt_hmi/qml_model_qt5/MainWindow.qml")
+ property var mainObject
+ property var sldUI
+ property var dataContainer
+ property var contentLoader
+
+ property var softButtonsListExample : [
+ {softButtonID:0, isHighlighted:true, systemAction:Common.SystemAction.DEFAULT_ACTION,
+ type:Common.SoftButtonType.SBT_TEXT, text:"Default Action"},
+ {softButtonID:1, isHighlighted:false, systemAction:Common.SystemAction.STEAL_FOCUS,
+ type:Common.SoftButtonType.SBT_IMAGE, text:"Steal Focus"},
+ {softButtonID:2, isHighlighted:false, systemAction:Common.SystemAction.KEEP_CONTEXT,
+ type:Common.SoftButtonType.SBT_BOTH, text:"Keep context"}]
+
+
+ //initialization for each test
+ function createShow(appID) {
+ mainWindowLoader.source = ""
+ mainWindowLoader.source = "../../../../src/components/qt_hmi/qml_model_qt5/MainWindow.qml"
+ var mainWindowObject = mainWindowLoader.item
+ if(!mainWindowObject)
+ qtest_fail("mainWindowObject is undefined");
+ var mainScreen = mainWindowObject.getMainScreen()
+ mainScreen.visible = true
+ var warningInfo = mainWindowObject.getWarningInfo()
+ warningInfo.visible = false
+ contentLoader = mainWindowObject.getContentLoader()
+ contentLoader.asynchronous = false
+ sldUI = mainWindowObject.getUIProxy()
+ dataContainer = mainWindowObject.getDataStorage()
+ dataContainer.addApplication({appName:"TestAppName", appId:appID})
+ }
+
+
+
+ //cleanup for each test
+ function destroyShow() {
+ //Clear Loader with MainWindow, which delete own models and views
+ mainWindowLoader.source = ""
+ }
+
+
+ //zapolnenie vseh poley, proverka sohranenia ih v dataContainer.
+ function test_01_create() {
+ console.debug("enter")
+ var initData = {
+ appID:1,
+ showStrings:[
+ {fieldName:Common.TextFieldName.mainField1 ,fieldText:"showString1"},
+ {fieldName:Common.TextFieldName.mainField2,fieldText:"showString2"},
+ {fieldName:Common.TextFieldName.mainField3,fieldText:"showString3"},
+ {fieldName:Common.TextFieldName.mainField4,fieldText:"showString4"},
+ {fieldName:Common.TextFieldName.mediaTrack,fieldText:"mediaTrack"},
+ {fieldName:Common.TextFieldName.statusBar,fieldText:"StatusBar"},
+ {fieldName:Common.TextFieldName.mediaClock,fieldText:"12:34"}
+ ],
+ softButtons:softButtonsListExample,
+ alignment:2,
+ graphic:{value:"/home/user/applink/bin/SPTAlice9675308/action.png",imageType: "DYNAMIC"},
+ secondaryGraphic:{value:"/home/user/applink/bin/SPTAlice9675308/action.png",imageType: "DYNAMIC"},
+ customPresets:["GEN0","GEN1","GEN2","GEN3"]
+ }
+
+ createShow(1)
+ var app = dataContainer.getApplication(initData.appID)
+ sldUI.show (initData)
+
+ try {
+
+ compare(app.hmiUIText.mainField1 , initData.showStrings[0].fieldText, "mainField1")
+ compare(app.hmiUIText.mainField2 , initData.showStrings[1].fieldText, "mainField2")
+ compare(app.hmiUIText.mainField3 , initData.showStrings[2].fieldText, "mainField3")
+ compare(app.hmiUIText.mainField4 , initData.showStrings[3].fieldText, "mainField4")
+ compare(app.hmiUIText.mediaTrack , initData.showStrings[4].fieldText, "mediaTrack")
+ compare(app.hmiUIText.statusBar , initData.showStrings[5].fieldText, "StatusBar" )
+ compare(app.hmiUIText.mediaClock , initData.showStrings[6].fieldText, "mediaClock")
+ var a;
+ if(app.hmiUITextAlignment === 1) a=0;
+ if(app.hmiUITextAlignment === 2) a=1;
+ if(app.hmiUITextAlignment === 4) a=2;
+ compare(initData.alignment, a, "Alignment")
+ compare(app.hmiUIText.image, initData.graphic.value, "image")
+ compare(app.hmiUIText.secondaryImage, initData.secondaryGraphic.value, "secdondImage")
+ compare(app.softButtons.count, initData.softButtons.length, "wrong buttons count created")
+ for (var i = 0, len = app.softButtons.count; i < len; i++)
+ {
+ var act = app.softButtons.get(i)
+ var exp = initData.softButtons[i]
+ compare(act.softButtonID, exp.softButtonID, "wrong softButtonID in button")
+ compare(act.isHighlighted, exp.isHighlighted, "wrong isHighlighted in button")
+ compare(act.systemAction, exp.systemAction, "wrong systemAction in button")
+ compare(act.text, exp.text, "wrong text in button")
+ }
+ compare(app.customPresets.count, initData.customPresets.length, "wrong buttons count created")
+ for (var j = 0, len2 = app.customPresets.count; j < len; j++)
+ {
+ var act2 = app.customPresets.get(j)
+ var exp2 = initData.customPresets[j]
+ compare(act2.text, exp2, "wrong text in button")
+ }
+ }
+ catch (e) {}
+ destroyShow()
+ console.debug("exit")
+ }
+ //vse pola pustie
+ function test_02_emptyInit()
+ {
+ console.debug("enter")
+ var initData = {
+ appID:1,
+ showStrings:[
+ {fieldName:Common.TextFieldName.mainField1 ,fieldText:""},
+ {fieldName:Common.TextFieldName.mainField2,fieldText:""},
+ {fieldName:Common.TextFieldName.mainField3,fieldText:""},
+ {fieldName:Common.TextFieldName.mainField4,fieldText:""},
+ {fieldName:Common.TextFieldName.mediaTrack,fieldText:""},
+ {fieldName:Common.TextFieldName.statusBar,fieldText:""},
+ {fieldName:Common.TextFieldName.mediaClock,fieldText:""}
+ ],
+ softButtons:[],
+ alignment:0,
+ graphic:{value:"",imageType: "DYNAMIC"},
+ secondaryGraphic:{value:"",imageType: "DYNAMIC"},
+ customPresets:[]
+ }
+
+ createShow(1)
+ var app = dataContainer.getApplication(initData.appID)
+ sldUI.show (initData)
+
+ try {
+
+ compare(app.hmiUIText.mainField1 , initData.showStrings[0].fieldText, "mainField1")
+ compare(app.hmiUIText.mainField2 , initData.showStrings[1].fieldText, "mainField2")
+ compare(app.hmiUIText.mainField3 , initData.showStrings[2].fieldText, "mainField3")
+ compare(app.hmiUIText.mainField4 , initData.showStrings[3].fieldText, "mainField4")
+ compare(app.hmiUIText.mediaTrack , initData.showStrings[4].fieldText, "mediaTrack")
+ compare(app.hmiUIText.statusBar , initData.showStrings[5].fieldText, "StatusBar" )
+ compare(app.hmiUIText.mediaClock , initData.showStrings[6].fieldText, "mediaClock")
+ var a;
+ if(app.hmiUITextAlignment === 1) a=0;
+ if(app.hmiUITextAlignment === 2) a=1;
+ if(app.hmiUITextAlignment === 4) a=2;
+ compare(initData.alignment, a, "Alignment")
+ compare(app.hmiUIText.image, initData.graphic.value, "image")
+ compare(app.hmiUIText.secondaryImage, initData.secondaryGraphic.value, "secdondImage")
+ compare(app.softButtons.count, initData.softButtons.length, "wrong buttons count created")
+ for (var i = 0, len = app.softButtons.count; i < len; i++)
+ {
+ var act = app.softButtons.get(i)
+ var exp = initData.softButtons[i]
+ compare(act.softButtonID, exp.softButtonID, "wrong softButtonID in button")
+ compare(act.isHighlighted, exp.isHighlighted, "wrong isHighlighted in button")
+ compare(act.systemAction, exp.systemAction, "wrong systemAction in button")
+ compare(act.text, exp.text, "wrong text in button")
+ }
+ compare(app.customPresets.count, initData.customPresets.length, "wrong buttons count created")
+ for (var j = 0, len2 = app.customPresets.count; j < len; j++)
+ {
+ var act2 = app.customPresets.get(j)
+ var exp2 = initData.customPresets[j]
+ compare(act2.text, exp2, "wrong text in button")
+ }
+ }
+ catch (e) {}
+ destroyShow()
+ console.debug("exit")
+ }
+//tol'ko obazatel'nue pola
+ function test_03_create_mandatory_only() {
+ console.debug("enter")
+ var initData = {
+ appID:1,
+ showStrings:[
+ {fieldName:Common.TextFieldName.mainField1 ,fieldText:"showString1"},
+ {fieldName:Common.TextFieldName.mainField2,fieldText:"showString2"},
+ {fieldName:Common.TextFieldName.mainField3,fieldText:"showString3"},
+ {fieldName:Common.TextFieldName.mainField4,fieldText:"showString4"},
+ {fieldName:Common.TextFieldName.mediaTrack,fieldText:"mediaTrack"},
+ {fieldName:Common.TextFieldName.statusBar,fieldText:"StatusBar"},
+ {fieldName:Common.TextFieldName.mediaClock,fieldText:"12:34"}
+ ]
+ }
+
+ createShow(1)
+ var app = dataContainer.getApplication(initData.appID)
+ sldUI.show (initData)
+
+ try {
+
+ compare(app.hmiUIText.mainField1 , initData.showStrings[0].fieldText, "mainField1")
+ compare(app.hmiUIText.mainField2 , initData.showStrings[1].fieldText, "mainField2")
+ compare(app.hmiUIText.mainField3 , initData.showStrings[2].fieldText, "mainField3")
+ compare(app.hmiUIText.mainField4 , initData.showStrings[3].fieldText, "mainField4")
+ compare(app.hmiUIText.mediaTrack , initData.showStrings[4].fieldText, "mediaTrack")
+ compare(app.hmiUIText.statusBar , initData.showStrings[5].fieldText, "StatusBar" )
+ compare(app.hmiUIText.mediaClock , initData.showStrings[6].fieldText, "mediaClock")
+
+ }
+ catch (e) {}
+ destroyShow()
+ console.debug("exit")
+ }
+ //pole s lishnim parametrom
+ function test_04_fake_param() {
+ console.debug("enter")
+ var initData = {
+ appID:1,
+ showStrings:[
+ {fieldName:Common.TextFieldName.mainField1 ,fieldText:"showString1"},
+ {fieldName:Common.TextFieldName.mainField2,fieldText:"showString2"},
+ {fieldName:Common.TextFieldName.mainField3,fieldText:"showString3"},
+ {fieldName:Common.TextFieldName.mainField4,fieldText:"showString4"},
+ {fieldName:Common.TextFieldName.mediaTrack,fieldText:"mediaTrack"},
+ {fieldName:Common.TextFieldName.statusBar,fieldText:"StatusBar",fakeParam:"FakeParam"},
+ {fieldName:Common.TextFieldName.mediaClock,fieldText:"12:34"}
+ ]
+ }
+
+ createShow(1)
+ var app = dataContainer.getApplication(initData.appID)
+ sldUI.show (initData)
+
+ try {
+
+ compare(app.hmiUIText.mainField1 , initData.showStrings[0].fieldText, "mainField1")
+ compare(app.hmiUIText.mainField2 , initData.showStrings[1].fieldText, "mainField2")
+ compare(app.hmiUIText.mainField3 , initData.showStrings[2].fieldText, "mainField3")
+ compare(app.hmiUIText.mainField4 , initData.showStrings[3].fieldText, "mainField4")
+ compare(app.hmiUIText.mediaTrack , initData.showStrings[4].fieldText, "mediaTrack")
+ compare(app.hmiUIText.statusBar , initData.showStrings[5].fieldText, "StatusBar" )
+ compare(app.hmiUIText.mediaClock , initData.showStrings[6].fieldText, "mediaClock")
+
+ }
+ catch (e) {}
+ destroyShow()
+ console.debug("exit")
+ }
+ //aligment of mainField1, mainField2
+ function test_05_alignment() {
+ console.debug("enter")
+ var initData = {
+ appID:1,
+ showStrings:[],
+ alignment:0,
+ }
+
+ createShow(1)
+ var app = dataContainer.getApplication(initData.appID)
+ sldUI.show (initData)
+
+ try {
+
+ var a;
+ if(app.hmiUITextAlignment === 1) a=0;
+ if(app.hmiUITextAlignment === 2) a=1;
+ if(app.hmiUITextAlignment === 4) a=2;
+ compare(initData.alignment, a, "Alignment")
+ initData.alignment=1
+ sldUI.show (initData)
+ var b;
+ if(app.hmiUITextAlignment === 1) b=0;
+ if(app.hmiUITextAlignment === 2) b=1;
+ if(app.hmiUITextAlignment === 4) b=2;
+ compare(initData.alignment, b, "Alignment")
+ initData.alignment=2
+ sldUI.show (initData)
+ var c;
+ if(app.hmiUITextAlignment === 1) c=0;
+ if(app.hmiUITextAlignment === 2) c=1;
+ if(app.hmiUITextAlignment === 4) c=2;
+ compare(initData.alignment, c, "Alignment")
+ }
+ catch (e) {}
+ destroyShow()
+ console.debug("exit")
+ }
+ //pole bez parametra
+ function test_06_no_param() {
+ console.debug("enter")
+ var initData = {
+ appID:1,
+ showStrings:[],
+ graphic:{imageType: "DYNAMIC"},
+ }
+
+ createShow(1)
+ var app = dataContainer.getApplication(initData.appID)
+ sldUI.show (initData)
+
+ try {
+
+ compare(app.hmiUIText.image, undefined, "image")
+
+ }
+ catch (e) {}
+ destroyShow()
+ console.debug("exit")
+ }
+
+}
+}
diff --git a/test/components/qt_hmi/src/tst_Timer.qml b/test/components/qt_hmi/src/tst_Timer.qml
new file mode 100644
index 000000000..97ed3d0d0
--- /dev/null
+++ b/test/components/qt_hmi/src/tst_Timer.qml
@@ -0,0 +1,296 @@
+/**
+ * @file tst_Slider.qml
+ * @brief Test Case for Slider.
+ * Copyright (c) 2013, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtTest 1.0
+import QtQuick 2.0
+import QtMultimedia 5.0
+import com.ford.sdl.hmi.dbus_adapter 1.0
+import com.ford.sdl.hmi.hw_buttons 1.0
+import com.ford.sdl.hmi.log4cxx 1.0
+import "../../../../src/components/qt_hmi/qml_model_qt5/controls"
+import "../../../../src/components/qt_hmi/qml_model_qt5/views"
+import "../../../../src/components/qt_hmi/qml_model_qt5/hmi_api" as HmiApi
+import "../../../../src/components/qt_hmi/qml_model_qt5/models"
+import "../../../../src/components/qt_hmi/qml_model_qt5/popups"
+import "../../../../src/components/qt_hmi/qml_model_qt5/hmi_api/Common.js" as Common
+import "../../../../src/components/qt_hmi/qml_model_qt5/models/Constants.js" as Constants
+import "../../../../src/components/qt_hmi/qml_model_qt5/models/Internal.js" as Internal
+
+Item {
+ id:item123
+ TestCase {
+ name: "time"
+ property var mainWindowComponent : Qt.createComponent("./../../../../src/components/qt_hmi/qml_model_qt5/MainWindow.qml")
+ property var mainObject
+ property var sdlUI
+ property var dataContainer
+
+ function createTime() {
+ mainObject = mainWindowComponent.createObject(parent)
+ sdlUI = mainObject.getUIProxy()
+ dataContainer = mainObject.getDataStorage()
+ }
+
+
+
+ function destroyTime() {
+ mainObject.destroy()
+ }
+
+ //Отсутствие конечного времени. Программа работает как таймер.
+ function test_01_noEndTimeInCountUp() {
+ console.debug("enter")
+
+ var initData = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:undefined , updateMode: 0, appID: 1}
+
+ var expectedResult = {endTimeResult:-1, resultCode : Common.Result.SUCCESS}
+
+ createTime()
+ dataContainer.addApplication({appName:"TestAppName", appId:initData.appID})
+
+ var actualResult = sdlUI.setMediaClockTimer(initData)
+
+ try {
+ compare(dataContainer.getApplication(initData.appID).mediaClock.endTime, expectedResult.endTimeResult, "time position")
+ compare(actualResult.__retCode, expectedResult.resultCode, "result code")
+ } catch (e) {}
+
+ destroyTime()
+ console.debug("exit")
+ }
+
+ //Отстутствие начального времени. Программа обрабатывает ошибку.
+ function test_02_noStartTime() {
+ console.debug("enter")
+
+ var initData = {startTime:undefined, endTime:{hours: 4, minutes: 0, seconds: 0} , updateMode: 1, appID: 1}
+ var expectedResult = {resultCode : Common.Result.INVALID_DATA}
+
+ createTime()
+ dataContainer.addApplication({appName:"TestAppName", appId:initData.appID})
+
+ var actualResult = sdlUI.setMediaClockTimer(initData)
+
+ try {
+ compare(actualResult.__retCode, expectedResult.resultCode, "result code")
+ } catch (e) {}
+
+ destroyTime()
+ console.debug("exit")
+ }
+
+ //Нажатие кнопки "стоп", когда программа на паузе. Игнорирование команды.
+ function test_03_pauseAfterPause() {
+ console.debug("enter")
+
+ var initData = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:{hours: 12, minutes: 00, seconds: 00}, updateMode: 0, appID: 1}
+ var expectedResult = {resultCode : Common.Result.IGNORED}
+
+ createTime()
+ dataContainer.addApplication({appName:"TestAppName", appId:initData.appID})
+
+ sdlUI.setMediaClockTimer(initData)
+
+ initData.updateMode=2
+ sdlUI.setMediaClockTimer(initData)
+
+ var actualResult = sdlUI.setMediaClockTimer(initData)
+
+ try {
+ compare(actualResult.__retCode, expectedResult.resultCode, "result code")
+ } catch (e) {}
+
+ destroyTime()
+ console.debug("exit")
+ }
+
+ //Нажатие кнопки "продолжить", когда часы очистили. Игнорирование команды.
+ function test_04_resumeAfterClear() {
+ console.debug("enter")
+
+ var initData = {startTime:{hours: 10, minutes: 0, seconds: 0},endTime:{ }, updateMode:0, appID:1}
+
+ var expectedResult = {resultCode : Common.Result.IGNORED}
+
+ createTime()
+ dataContainer.addApplication({appName:"TestAppName", appId:initData.appID})
+
+ sdlUI.setMediaClockTimer(initData)
+
+ initData.updateMode=4
+ sdlUI.setMediaClockTimer(initData)
+
+ initData.updateMode=3
+ sdlUI.setMediaClockTimer(initData)
+
+ var actualResult = sdlUI.setMediaClockTimer(initData)
+ try {
+ compare(actualResult.__retCode, expectedResult.resultCode, "result code")
+ } catch (e) {}
+
+ destroyTime()
+ console.debug("exit")
+ }
+
+ //Нажатие кнопки "продолжить", после того, как таймер отсчитает время.
+ //Команда должна игнорироваться, но программа пишет, что выполнила команду успешно, хоть и ничего не сделала.
+ function test_05_resumeAfterEnd() {
+ console.debug("enter")
+
+ var initData = {startTime:{hours: 0, minutes: 12, seconds: 33},endTime:{hours: 0, minutes: 12, seconds: 33}, updateMode:0, appID:1}
+
+ var expectedResult = {resultCode : Common.Result.IGNORED}
+
+ createTime()
+ dataContainer.addApplication({appName:"TestAppName", appId:initData.appID})
+
+ sdlUI.setMediaClockTimer(initData)
+
+ dataContainer.setApplicationProperties(initData.appID, {
+ "mediaClock": {
+ "updateMode": 0,
+ "runningMode": 1,
+ "startTime": initData.StartTime,
+ "endTime": initData.EndTime,
+ "startTimeForProgress": 753
+ }
+ })
+ initData.updateMode=3
+ var actualResult = sdlUI.setMediaClockTimer(initData)
+
+ try {
+ compare(actualResult.__retCode, expectedResult.resultCode, "result code")
+ } catch (e) {}
+
+ destroyTime()
+ console.debug("exit")
+ }
+
+ //Запустить отсчёт времени 2 раза подряд. Программа работает корректно.
+ function test_06_twoCountUp() {
+ console.debug("enter")
+
+ var initData1 = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:{hours: 12, minutes: 00, seconds: 00}, updateMode: 0, appID: 1}
+ var initData2 = {startTime:{hours: 5, minutes: 0, seconds: 0}, endTime:{hours: 18, minutes: 00, seconds: 00}, updateMode: 0, appID: 1}
+ var expectedResult = {startTime:18000, endTime: 64800, updateMode: 0, resultCode : Common.Result.SUCCESS}
+
+ createTime()
+ dataContainer.addApplication({appName:"TestAppName", appId:initData1.appID})
+
+ sdlUI.setMediaClockTimer(initData1)
+
+ var actualResult = sdlUI.setMediaClockTimer(initData2)
+
+ try {
+ compare(dataContainer.getApplication(initData1.appID).mediaClock.startTime, expectedResult.startTime, "startTime")
+ compare(dataContainer.getApplication(initData1.appID).mediaClock.endTime, expectedResult.endTime, "endTime")
+ compare(dataContainer.getApplication(initData1.appID).mediaClock.updateMode, expectedResult.updateMode, "updateMode")
+ compare(actualResult.__retCode, expectedResult.resultCode, "result code")
+ } catch (e) {}
+
+ destroyTime()
+ console.debug("exit")
+ }
+
+ //Нажать клавишу "продолжить", когда время не на паузе. Игнорирование команды.
+ function test_07_resumeAfterResume() {
+ console.debug("enter")
+
+ var initData = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:{hours: 12, minutes: 00, seconds: 00}, updateMode: 0, appID: 1}
+ var expectedResult = {resultCode : Common.Result.IGNORED}
+
+ createTime()
+ dataContainer.addApplication({appName:"TestAppName", appId:initData.appID})
+
+ sdlUI.setMediaClockTimer(initData)
+
+ initData.updateMode=3
+ var actualResult = sdlUI.setMediaClockTimer(initData)
+
+ try {
+ compare(actualResult.__retCode, expectedResult.resultCode, "result code")
+ } catch (e) {}
+
+ destroyTime()
+ console.debug("exit")
+ }
+
+ //Запустить отсчёт времени в одну сторону, а потом в другую. Работает корректно.
+ function test_08_countDownAfterCountUp() {
+ console.debug("enter")
+
+ var initData1 = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:{hours: 12, minutes: 00, seconds: 00}, updateMode: 0, appID: 1}
+ var initData2 = {startTime:{hours: 18, minutes: 0, seconds: 0}, endTime:{hours: 5, minutes: 00, seconds: 00}, updateMode: 1, appID: 1}
+ var expectedResult = {startTime:64800, endTime: 18000, updateMode: 1, resultCode : Common.Result.SUCCESS}
+
+ createTime()
+ dataContainer.addApplication({appName:"TestAppName", appId:initData1.appID})
+
+ sdlUI.setMediaClockTimer(initData1)
+
+ var actualResult = sdlUI.setMediaClockTimer(initData2)
+
+ try {
+ compare(dataContainer.getApplication(initData1.appID).mediaClock.startTime, expectedResult.startTime, "startTime")
+ compare(dataContainer.getApplication(initData1.appID).mediaClock.endTime, expectedResult.endTime, "endTime")
+ compare(dataContainer.getApplication(initData1.appID).mediaClock.updateMode, expectedResult.updateMode, "updateMode")
+ compare(actualResult.__retCode, expectedResult.resultCode, "result code")
+ } catch (e) {}
+
+ destroyTime()
+ console.debug("exit")
+ }
+ //Отсутствие конечного времени. Программа работает как таймер. НО!!! Исчезает прогрессбар.
+ function test_09_noEndTimeInCountDown() {
+ console.debug("enter")
+
+ var initData = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:undefined, updateMode: 0, appID: 1}
+
+ var expectedResult = {startTimeForProgress:14400, resultCode : Common.Result.SUCCESS}
+
+ createTime()
+ dataContainer.addApplication({appName:"TestAppName", appId:initData.appID})
+
+ var actualResult = sdlUI.setMediaClockTimer(initData)
+
+ try {
+ compare(dataContainer.getApplication(initData.appID).mediaClock.startTimeForProgress, expectedResult.startTimeForProgress, "time position")
+ compare(actualResult.__retCode, expectedResult.resultCode, "result code")
+ } catch (e) {}
+
+ destroyTime()
+ console.debug("exit")
+ }
+ }
+}