Merge lp:~aacid/unity-2d/unity-2d_tests_fullscreen_rb_improvement into lp:unity-2d

Proposed by Albert Astals Cid
Status: Merged
Approved by: Gerry Boland
Approved revision: 880
Merged at revision: 885
Proposed branch: lp:~aacid/unity-2d/unity-2d_tests_fullscreen_rb_improvement
Merge into: lp:unity-2d
Diff against target: 139 lines (+32/-32)
1 file modified
tests/places/fullscreen.rb (+32/-32)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d_tests_fullscreen_rb_improvement
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Lohith D Shivamurthy (community) Approve
Review via email: mp+90883@code.launchpad.net

Description of the change

[tests] Port tests/places/fullscreen.rb to target/host divide

* do not use @sut = TDriver.sut(:Id => "sut_qt")
* do not use system
* do not use %x{}

To post a comment you must log in.
Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

They look fine.

review: Approve
Revision history for this message
Gerry Boland (gerboland) wrote :

Yep, approving.

Tip: you can do
width, height = XDo::XWindow.display_geometry()

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/places/fullscreen.rb'
2--- tests/places/fullscreen.rb 2012-01-26 18:58:40 +0000
3+++ tests/places/fullscreen.rb 2012-01-31 15:20:30 +0000
4@@ -43,10 +43,10 @@
5
6 # Run once at the beginning of this test suite
7 startup do
8- system 'killall unity-2d-places > /dev/null 2>&1'
9- system 'killall unity-2d-panel > /dev/null 2>&1'
10- system 'killall unity-2d-launcher > /dev/null 2>&1'
11- system 'killall unity-2d-launcher > /dev/null 2>&1'
12+ $SUT.execute_shell_command 'killall unity-2d-places'
13+ $SUT.execute_shell_command 'killall unity-2d-panel'
14+ $SUT.execute_shell_command 'killall unity-2d-launcher'
15+ $SUT.execute_shell_command 'killall unity-2d-launcher'
16
17 # Minimize all windows
18 XDo::XWindow.toggle_minimize_all
19@@ -58,18 +58,17 @@
20
21 # Run before each test case begins
22 setup do
23- @fullscreen_old = %x{dconf read #{DASH_FULLSCREEN_KEY}}.chop
24- @formfactor_old = %x{dconf read #{DASH_FORMFACTOR_KEY}}.chop
25+ @fullscreen_old = ($SUT.execute_shell_command "dconf read #{DASH_FULLSCREEN_KEY}").chop
26+ @formfactor_old = ($SUT.execute_shell_command "dconf read #{DASH_FORMFACTOR_KEY}").chop
27
28 # Execute the application
29- @sut = TDriver.sut(:Id => "sut_qt")
30- @dash = @sut.run(:name => UNITY_2D_PLACES,
31- :arguments => "-testability",
32- :sleeptime => 2)
33- @panel = @sut.run(:name => UNITY_2D_PANEL,
34- :arguments => "-testability",
35- :sleeptime => 2)
36- @launcher = @sut.run(:name => UNITY_2D_LAUNCHER,
37+ @dash = $SUT.run(:name => UNITY_2D_PLACES,
38+ :arguments => "-testability",
39+ :sleeptime => 2)
40+ @panel = $SUT.run(:name => UNITY_2D_PANEL,
41+ :arguments => "-testability",
42+ :sleeptime => 2)
43+ @launcher = $SUT.run(:name => UNITY_2D_LAUNCHER,
44 :arguments => "-testability",
45 :sleeptime => 2)
46
47@@ -80,17 +79,18 @@
48
49 # Run after each test case completes
50 teardown do
51- %x{dconf write #{DASH_FULLSCREEN_KEY} #{'"'}#{@fullscreen_old}#{'"'}}
52- %x{dconf write #{DASH_FORMFACTOR_KEY} #{'"'}#{@formfactor_old}#{'"'}}
53+ $SUT.execute_shell_command "dconf write #{DASH_FULLSCREEN_KEY} #{@fullscreen_old}"
54+ $SUT.execute_shell_command "dconf write #{DASH_FORMFACTOR_KEY} '#{@formfactor_old}"
55
56- system "pkill -nf unity-2d-panel"
57- system "pkill -nf unity-2d-places"
58- system "pkill -nf unity-2d-launcher"
59+ $SUT.execute_shell_command "pkill -nf unity-2d-panel"
60+ $SUT.execute_shell_command "pkill -nf unity-2d-places"
61+ $SUT.execute_shell_command "pkill -nf unity-2d-launcher"
62 end
63
64 def dash_always_fullscreen
65- out = %x{xdotool getdisplaygeometry}
66- width, height = out.split.collect { |coord| coord.to_i }
67+ out = XDo::XWindow.display_geometry()
68+ width = out[0]
69+ height = out[1]
70 return width < DASH_MIN_SCREEN_WIDTH && height < DASH_MIN_SCREEN_HEIGHT
71 end
72
73@@ -98,8 +98,8 @@
74 # Test cases
75
76 test "Dash fullscreens on dconf key change" do
77- %x{dconf write #{DASH_FULLSCREEN_KEY} false}
78- %x{dconf write #{DASH_FORMFACTOR_KEY} #{'\"desktop\"'}}
79+ $SUT.execute_shell_command "dconf write #{DASH_FULLSCREEN_KEY} false"
80+ $SUT.execute_shell_command "dconf write #{DASH_FORMFACTOR_KEY} 'desktop'"
81 XDo::Keyboard.super
82 sleep 1
83
84@@ -112,7 +112,7 @@
85 @dash.DashDeclarativeView()['dashMode']
86 }
87
88- %x{dconf write #{DASH_FULLSCREEN_KEY} true}
89+ $SUT.execute_shell_command "dconf write #{DASH_FULLSCREEN_KEY} true"
90 sleep 1
91
92 verify_equal('FullScreenMode', TIMEOUT, 'Dash is not fullscreen but should be') {
93@@ -121,8 +121,8 @@
94 end
95
96 test "Dash reacts correctly to panel buttons" do
97- %x{dconf write #{DASH_FULLSCREEN_KEY} false}
98- %x{dconf write #{DASH_FORMFACTOR_KEY} #{'\"desktop\"'}}
99+ $SUT.execute_shell_command "dconf write #{DASH_FULLSCREEN_KEY} false"
100+ $SUT.execute_shell_command "dconf write #{DASH_FORMFACTOR_KEY} 'desktop'"
101 XDo::Keyboard.super
102 sleep 1
103 verify_equal('true', TIMEOUT, 'Dash did not appear') {
104@@ -144,7 +144,7 @@
105 # false.
106 expected = dash_always_fullscreen ? 'false' : 'true'
107 verify_equal(expected, TIMEOUT, 'Dash fullscreen key has the wrong value after maximize') {
108- %x{dconf read #{DASH_FULLSCREEN_KEY}}.chop
109+ ($SUT.execute_shell_command "dconf read #{DASH_FULLSCREEN_KEY}").chop
110 }
111
112 maxbutton.tap if maxbutton
113@@ -154,13 +154,13 @@
114 @dash.DashDeclarativeView()['dashMode']
115 }
116 verify_equal('false', TIMEOUT, 'Dash fullscreen key was not unset') {
117- %x{dconf read #{DASH_FULLSCREEN_KEY}}.chop
118+ ($SUT.execute_shell_command "dconf read #{DASH_FULLSCREEN_KEY}").chop
119 }
120 end
121
122 test "Dash fullscreen initially" do
123- %x{dconf write #{DASH_FULLSCREEN_KEY} true}
124- %x{dconf write #{DASH_FORMFACTOR_KEY} #{'\"desktop\"'}}
125+ $SUT.execute_shell_command "dconf write #{DASH_FULLSCREEN_KEY} true"
126+ $SUT.execute_shell_command "dconf write #{DASH_FORMFACTOR_KEY} 'desktop'"
127 XDo::Keyboard.super
128 sleep 1
129
130@@ -173,8 +173,8 @@
131 end
132
133 test "Dash always fullscreen if not desktop form factor" do
134- %x{dconf write #{DASH_FULLSCREEN_KEY} false}
135- %x{dconf write #{DASH_FORMFACTOR_KEY} #{'\"tv\"'}}
136+ $SUT.execute_shell_command "dconf write #{DASH_FULLSCREEN_KEY} false"
137+ $SUT.execute_shell_command "dconf write #{DASH_FORMFACTOR_KEY} 'tv'"
138 XDo::Keyboard.super
139 sleep 1
140

Subscribers

People subscribed via source and target branches