Merge lp:~carla-sella/sudoku-app/hint_button_test into lp:sudoku-app

Proposed by Carla Sella on 2013-07-16
Status: Superseded
Proposed branch: lp:~carla-sella/sudoku-app/hint_button_test
Merge into: lp:sudoku-app
Diff against target: 130 lines (+78/-2) (has conflicts)
3 files modified
sudoku-app.qml (+3/-0)
tests/autopilot/sudoku_app/emulators/main_window.py (+19/-0)
tests/autopilot/sudoku_app/tests/test_sudoku.py (+56/-2)
Text conflict in tests/autopilot/sudoku_app/tests/test_sudoku.py
To merge this branch: bzr merge lp:~carla-sella/sudoku-app/hint_button_test
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration 2013-07-17 Needs Fixing on 2013-07-17
Nicholas Skaggs (community) Needs Fixing on 2013-07-17
Dinko Osmankovic 2013-07-16 Approve on 2013-07-17
Review via email: mp+175112@code.launchpad.net

This proposal has been superseded by a proposal from 2013-07-17.

Commit message

sudoku app

Description of the change

Fixed the test_hint_button test, it used to fail as the hint button on the toolbar was not enabled, and completed it too by clicking on the hints switch in settings tab to enable the hint button on the toolbar.

To post a comment you must log in.
review: Approve
Nicholas Skaggs (nskaggs) wrote :

Jenkins failed the merge because there is a small conflict because of the merge from Adrian this morning. Should be a really easy fix and merge.

review: Needs Fixing

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sudoku-app.qml'
2--- sudoku-app.qml 2013-07-17 14:35:52 +0000
3+++ sudoku-app.qml 2013-07-17 19:39:26 +0000
4@@ -533,6 +533,7 @@
5 }
6
7 ListItem.ValueSelector {
8+ objectName: "difficultySelector"
9 id: difficultySelector
10 text: i18n.tr("Difficulty")
11 values: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard")]
12@@ -591,9 +592,11 @@
13 }
14
15 ListItem.Standard {
16+ objectName: "hintsSwitchClickable"
17 text: i18n.tr("Hints")
18 width: parent.width
19 control: Switch {
20+ objectName: "hintsSwitch"
21 id: disableHints
22 anchors.horizontalCenter: parent.horizontalCenter
23 anchors.verticalCenter: parent.verticalCenter
24
25=== modified file 'tests/autopilot/sudoku_app/emulators/main_window.py'
26--- tests/autopilot/sudoku_app/emulators/main_window.py 2013-07-11 19:57:30 +0000
27+++ tests/autopilot/sudoku_app/emulators/main_window.py 2013-07-17 19:39:26 +0000
28@@ -32,3 +32,22 @@
29
30 def get_number_dialog(self):
31 return self.app.select_single("Dialog", objectName="picknumberscreen")
32+
33+ def get_hints_switch(self):
34+ return self.app.select_single("CheckBox", objectName="hintsSwitch")
35+
36+ #clicking on this works instead on the previous one (get_hints_switch) it doesn't(but the previous
37+ #has the clicked property so I am using both
38+ def get_hints_switchClickable(self):
39+ return self.app.select_single("Standard", objectName="hintsSwitchClickable")
40+
41+ def get_difficulty_selector(self):
42+ return self.app.select_single("ValueSelector", objectName="difficultySelector")
43+
44+ def get_difficulty_selector_labelvisual(self):
45+ labelvisual = self.get_difficulty_selector()
46+ labelvisualList = labelvisual.select_many("LabelVisual", text="Easy")
47+ return labelvisualList
48+
49+
50+
51
52=== modified file 'tests/autopilot/sudoku_app/tests/test_sudoku.py'
53--- tests/autopilot/sudoku_app/tests/test_sudoku.py 2013-07-16 16:50:40 +0000
54+++ tests/autopilot/sudoku_app/tests/test_sudoku.py 2013-07-17 19:39:26 +0000
55@@ -86,8 +86,8 @@
56
57 #check label again
58 self.assertThat(label, Eventually(Equals("<b>Best scores for all players</b>")))
59-
60- def test_enter_and_cancel(self):
61+
62+ def test_enter_and_cancel(self):
63 #find the first button that has a blank value
64 gridButtons = self.main_window.get_blank_inputs()
65 gridButton = gridButtons[0]
66@@ -127,6 +127,7 @@
67
68 #check the value to ensure it worked
69 self.assertThat(buttonValue, Eventually(Equals("4")))
70+<<<<<<< TREE
71
72 def test_new_game_button(self):
73 self.ubuntusdk.click_toolbar_button("newgamebutton")
74@@ -186,3 +187,56 @@
75
76
77
78+=======
79+
80+ def test_new_game_button(self):
81+ self.ubuntusdk.click_toolbar_button("newgamebutton")
82+
83+ number_of_hints = lambda: self.app.select_single(objectName="blockgrid").numberOfHints
84+ number_of_actions = lambda: self.app.select_single(objectName="blockgrid").numberOfActions
85+ game_seconds = lambda: self.app.select_single(objectName="blockgrid").gameSeconds
86+
87+ self.assertThat(number_of_hints, Eventually(Equals(0)))
88+ self.assertThat(number_of_actions, Eventually(Equals(0)))
89+ self.assertThat(game_seconds, Eventually(Equals(0)))
90+
91+ def test_hint_button(self):
92+ #open settings tab
93+ self.open_and_check_settings_tab()
94+
95+ #click on hints switch to enalbe hints toolbar button
96+ hintsSwitchClickable = self.main_window.get_hints_switchClickable()
97+ lambda: self.assertThat(hintsSwitchClickable.text, Eventually(Equals("Hints")))
98+
99+ #turn on (by clicking on it) hints switch if not already
100+ hintsSwitch = self.main_window.get_hints_switch()
101+ lambda: self.assertThat(hintsSwitch.id, Eventually(Equals("disableHints")))
102+ if hintsSwitch.checked == False:
103+ self.pointing_device.click_object(hintsSwitchClickable)
104+
105+ #verify hints switch is clicked
106+ self.assertThat(hintsSwitch.checked, Eventually(Equals(True)))
107+
108+ # exit settings tab by clicking on sudoku tab
109+ self.ubuntusdk.switch_to_tab(0)
110+
111+ #verify settings sudoku tab is open
112+ tabName = lambda: self.ubuntusdk.get_object("Tab","Sudoku")
113+ #self.assertThat(tabName, Eventually(NotEquals(None)))
114+
115+ #click on hint button on tuolbar
116+ self.ubuntusdk.click_toolbar_button("hintbutton")
117+ gridButtons = self.main_window.get_blank_inputs()
118+
119+ number_of_hints = lambda: self.app.select_single(objectName="blockgrid").numberOfHints
120+ self.assertThat(number_of_hints, Eventually(Equals(1)))
121+
122+ def open_and_check_settings_tab(self):
123+ #click on settings tab so to enable the hints button
124+ self.ubuntusdk.switch_to_tab(2)
125+
126+ #verify settings tab is open
127+ tabName = lambda: self.ubuntusdk.get_object("Tab","settingsTab")
128+ self.assertThat(tabName, Eventually(NotEquals(None)))
129+
130+>>>>>>> MERGE-SOURCE

Subscribers

People subscribed via source and target branches