Merge lp:~stolowski/unity-lens-video/close-preview-player into lp:unity-lens-video

Proposed by Paweł Stołowski
Status: Merged
Approved by: Michal Hruby
Approved revision: 92
Merged at revision: 91
Proposed branch: lp:~stolowski/unity-lens-video/close-preview-player
Merge into: lp:unity-lens-video
Diff against target: 66 lines (+42/-0)
2 files modified
src/unity-lens-video (+8/-0)
tests/manual/local-video-previews.txt (+34/-0)
To merge this branch: bzr merge lp:~stolowski/unity-lens-video/close-preview-player
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+122282@code.launchpad.net

Commit message

Handle preview closed() signal and call Close() dbus method of music-preview-player. Added manual tests.

Description of the change

Handle preview closed() signal and call Close() dbus method of music-preview-player. Added manual tests.

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

Code-wise looks fine, I don't really like the ever-increasing number of manual tests, but we don't really have infrastructure to automate these right now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-lens-video'
2--- src/unity-lens-video 2012-08-23 16:19:24 +0000
3+++ src/unity-lens-video 2012-08-31 14:01:38 +0000
4@@ -131,6 +131,13 @@
5 else:
6 return False
7
8+ def on_preview_closed(self, preview):
9+ try:
10+ player = self.bus.get_object (PREVIEW_PLAYER_DBUS_NAME, PREVIEW_PLAYER_DBUS_PATH)
11+ dbus.Interface (player, PREVIEW_PLAYER_DBUS_IFACE).Close()
12+ except Exception as e:
13+ print "Failed to send close signal to preview player:", e
14+
15 def on_preview_uri(self, scope, uri):
16 """Preview request handler"""
17 preview = None
18@@ -142,6 +149,7 @@
19 subtitle = time.strftime("%x, %X", time.localtime(os.path.getmtime(GLib.filename_from_uri(uri, None))))
20 desc = model.get_string(iter, 5);
21 preview = Unity.MoviePreview.new(title, subtitle, desc, None)
22+ preview.connect('closed', self.on_preview_closed)
23
24 # we may get remote uris from zeitgeist - fetch details for local files only
25 if uri.startswith("file://"):
26
27=== added directory 'tests'
28=== added directory 'tests/manual'
29=== added file 'tests/manual/local-video-previews.txt'
30--- tests/manual/local-video-previews.txt 1970-01-01 00:00:00 +0000
31+++ tests/manual/local-video-previews.txt 2012-08-31 14:01:38 +0000
32@@ -0,0 +1,34 @@
33+Preview of local video file
34+---------------------------
35+Test that details of a local video file are displayed in the preview.
36+
37+Setup:
38+Have some video files available in ~/Videos folder.
39+
40+Actions:
41+1. Open the Dash and switch to the video lens.
42+2. Make sure some video files from ~/Videos folder are displayed.
43+3. Right click a video file.
44+
45+Expected Result:
46+Video preview should be displayed. Verify the preview display a sample video frame (a picture) and contains
47+the following data: file name (as title), modification date and time (as subtitle) and 'Format', 'Dimensions',
48+'Size' info; 'Dimensions' should include resolution and aspect ratio, e.g. '1280:720, 16:9'.
49+
50+
51+Preview of local video file - preview-player close
52+--------------------------------------------------
53+Test that music-preview-player is closed automatically when not needed.
54+
55+Setup:
56+Have some video files available in ~/Videos folder.
57+
58+Actions:
59+1. Open the Dash and switch to the video lens.
60+2. Make sure some video files from ~/Videos folder are displayed.
61+3. Right click a video file.
62+4. Close the preview.
63+
64+Expected Result:
65+Video preview should be displayed. After closing the preview, verify with 'ps aux' that music-preview-player
66+process disappears after approximately 1 minute.

Subscribers

People subscribed via source and target branches