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

Proposed by Albert Astals Cid
Status: Merged
Approved by: Gerry Boland
Approved revision: 861
Merged at revision: 858
Proposed branch: lp:~aacid/unity-2d/unity-2d_test_launcher_hide_delay_on_tile_removal
Merge into: lp:unity-2d
Diff against target: 78 lines (+49/-0)
1 file modified
tests/launcher/autohide_show_tests.rb (+49/-0)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d_test_launcher_hide_delay_on_tile_removal
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
Gerry Boland Pending
Review via email: mp+89037@code.launchpad.net

Description of the change

[test] Check that the launcher is around for 1 second after removing an application tile

To post a comment you must log in.
855. By Albert Astals Cid

Nice way to find a non running application

856. By Albert Astals Cid

merge trunk

Revision history for this message
Michał Sawicz (saviq) wrote :

Please use gsettings instead of dconf, as it's available in a default installation.

review: Needs Fixing
857. By Albert Astals Cid

We need to wait more than 1 sec here, otherwise we still have the timer of having moved the mouse out of the launcher applies

Revision history for this message
Michał Sawicz (saviq) wrote :

I'm thinking DConf profiles might help in providing a clean test env and leaving it clean after we leave, see https://live.gnome.org/dconf/SystemAdministrators#Profiles.

The issue with using `dconf write` or `gsettings set` is that the value will be written in the users' database, even if they didn't touch it themselves. That will prevent them from getting any new defaults introduced later on.

858. By Albert Astals Cid

Use gsettings instead of dconf

Revision history for this message
Michał Sawicz (saviq) wrote :

One last thing: since you've added the 1sec delay, could you also please add that to the test steps? Cheers.

Gerry, hope you're not angry for me stealing your review a bit ;)

859. By Albert Astals Cid

Add the wait step to step list

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

Saviq: not at all :)

My comment:
+ tiles = @app.LauncherList( :name => 'main' ).children( { :running => 'false', :desktopFile => /^.*.desktop$/ } )
+ verify( 0, 'Could not find any non running application tile to remove' ) { !tiles.empty? }

From the docs[1] it looks like 'children' returns an exception if no matching child is found. Is that right? So then it should be inside the verify block, to at least get a readable error message.

Note that "verify(0){ block }" triggers a fail only if "block" throws an exception. I suggest you use verify_true or verify_false, ref [1].

[1] https://projects.developer.nokia.com/dav/Testabilitydriver/doc/api/qt_linux/#GenericTestObject:children

860. By Albert Astals Cid

Fix test in case no children around

tiles = @app.LauncherList( :name => 'main' ).children( { :running => 'false', :desktopFile => /^.*.desktop$/ } )
returns an exception if no match happens to move it inside the verify and remove the check for empty in there,
which was actually wrong since verify just checks for exceptions, not for true-ness of the value

861. By Albert Astals Cid

merge

Revision history for this message
Michał Sawicz (saviq) wrote :

I'm OK with that, Gerry?

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

Yep, approved.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/launcher/autohide_show_tests.rb'
2--- tests/launcher/autohide_show_tests.rb 2012-01-18 12:11:19 +0000
3+++ tests/launcher/autohide_show_tests.rb 2012-01-19 15:56:30 +0000
4@@ -31,6 +31,7 @@
5 ############################# Test Suite #############################
6 context "Launcher Autohide and Show Tests" do
7 WIDTH = 65 #launcher bar width
8+ launcher_favorites = ""
9
10 # Run once at the beginning of this test suite
11 startup do
12@@ -50,6 +51,8 @@
13 #Ensure mouse out of the way
14 XDo::Mouse.move(200,200,10,true)
15
16+ launcher_favorites = `gsettings get com.canonical.Unity.Launcher favorites`
17+
18 # Execute the application
19 @sut = TDriver.sut(:Id => "sut_qt")
20 @app = @sut.run( :name => UNITY_2D_LAUNCHER,
21@@ -65,6 +68,7 @@
22 #@app.close
23 #Need to kill Launcher as it does not shutdown when politely asked
24 system "pkill -nf unity-2d-launcher"
25+ system "gsettings set com.canonical.Unity.Launcher favorites \"" + launcher_favorites + "\""
26 end
27
28 #####################################################################################
29@@ -383,4 +387,49 @@
30 xid.close!
31 end
32
33+ # Test case objectives:
34+ # * Launcher is around for 1 second after removing a tile
35+ # Pre-conditions
36+ # * Desktop with at least one application not running
37+ # Test steps
38+ # * Open application in position overlapping Launcher
39+ # * Verify Launcher hiding
40+ # * Right click on a non running application tile
41+ # * Wait enough time ( > 1 sec) so that the timer that would close the launcher
42+ # if the menu was not open triggers
43+ # * Click on the last menu item (Remove)
44+ # * Verify Launcher stays away for a second
45+ # Post-conditions
46+ # * None
47+ # References
48+ # * None
49+ test "Launcher hide delay on tile removal" do
50+ xid = TmpWindow.open_window_at(10,100)
51+ tiles = ""
52+ verify( 0, 'Could not find any non running application tile to remove' ) {
53+ tiles = @app.LauncherList( :name => 'main' ).children( { :running => 'false', :desktopFile => /^.*.desktop$/ } )
54+ }
55+ if !tiles.empty?
56+ tile = tiles[0]
57+ XDo::Mouse.move(0, 200, 0, true)
58+ verify_equal( 0, TIMEOUT, 'Launcher hiding when mouse at left edge of screen' ) {
59+ @app.Unity2dPanel()['x_absolute'].to_i
60+ }
61+ XDo::Mouse.move(tile['x_absolute'].to_i + 1, tile['y_absolute'].to_i + 1, 0, true)
62+ XDo::Mouse.click(nil, nil, :right)
63+ menu = @app.LauncherContextualMenu( :folded => false );
64+ XDo::Mouse.move(menu['x_absolute'].to_i + 20, menu['y_absolute'].to_i + menu['height'].to_i - 10, 0, true)
65+ sleep 1.5
66+ XDo::Mouse.click()
67+ sleep 0.9
68+ verify_equal( 0, 0, 'Launcher hiding after icon removal, should be visible for 1 second' ) {
69+ @app.Unity2dPanel()['x_absolute'].to_i
70+ }
71+ verify_equal( -WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
72+ @app.Unity2dPanel()['x_absolute'].to_i
73+ }
74+ xid.close!
75+ end
76+ end
77+
78 end

Subscribers

People subscribed via source and target branches