Merge lp:~mhr3/libunity/fix-1062331 into lp:libunity

Proposed by Michal Hruby on 2012-10-09
Status: Merged
Approved by: Paweł Stołowski on 2012-10-09
Approved revision: 191
Merged at revision: 189
Proposed branch: lp:~mhr3/libunity/fix-1062331
Merge into: lp:libunity
Diff against target: 213 lines (+83/-17)
8 files modified
Makefile.decl (+21/-12)
configure.ac (+1/-0)
src/unity-previews.vala (+1/-1)
test/C/Makefile.am (+2/-0)
test/Makefile.am (+3/-1)
test/python/Makefile.am (+41/-0)
test/python/bug-1062331.py (+9/-0)
test/vala/test-mpris-backend-prop-updates-client.vala (+5/-3)
To merge this branch: bzr merge lp:~mhr3/libunity/fix-1062331
Reviewer Review Type Date Requested Status
Paweł Stołowski 2012-10-09 Approve on 2012-10-09
Review via email: mp+128656@code.launchpad.net

Commit message

Fix AsyncPreview.preview_ready not being usable from pygi

Description of the change

Fixes issue where AsyncPreview.preview_ready wasn't usable from pygi. Also adds infrastructure for running pygi tests.

To post a comment you must log in.
Paweł Stołowski (stolowski) wrote :

LGTM. Python test passes.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.decl'
2--- Makefile.decl 2011-11-29 09:13:49 +0000
3+++ Makefile.decl 2012-10-09 09:29:08 +0000
4@@ -3,8 +3,8 @@
5 # This file is copied almost verbatim from the GLib-2.0 distribution
6 #
7
8-GTESTER = gtester # for non-GLIB packages
9-GTESTER_REPORT = $(top_builddir)/test/gtester-report # for the GLIB package
10+GTESTER = gtester
11+GTESTER_REPORT = gtester-report
12
13 # initialize variables for unconditional += appending
14 EXTRA_DIST =
15@@ -13,12 +13,16 @@
16 ### testing rules
17
18 # test: run all tests in cwd and subdirs
19-test: ${TEST_PROGS}
20- @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS}
21- @ for subdir in $(SUBDIRS) ; do \
22+test: test-nonrecursive
23+ @ for subdir in $(SUBDIRS) . ; do \
24 test "$$subdir" = "." -o "$$subdir" = "po" || \
25 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
26 done
27+
28+# test-nonrecursive: run tests only in cwd
29+test-nonrecursive: ${TEST_PROGS}
30+ @test -z "${TEST_PROGS}" || G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS}
31+
32 # test-report: run tests in subdirs and generate report
33 # perf-report: run tests in subdirs with -m perf and generate report
34 # full-report: like test-report: with -m perf and -m slow
35@@ -40,13 +44,19 @@
36 GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
37 ignore_logdir=false ; \
38 fi ; \
39- for subdir in $(SUBDIRS) ; do \
40+ REVISION=$(VERSION) ; \
41+ for subdir in $(SUBDIRS) . ; do \
42 test "$$subdir" = "." -o "$$subdir" = "po" || \
43 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
44 done ; \
45 $$ignore_logdir || { \
46- echo '<?xml version="1.0"?>' > $@.xml ; \
47- echo '<report-collection>' >> $@.xml ; \
48+ echo '<?xml version="1.0"?>' > $@.xml ; \
49+ echo '<report-collection>' >> $@.xml ; \
50+ echo '<info>' >> $@.xml ; \
51+ echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \
52+ echo ' <version>$(VERSION)</version>' >> $@.xml ; \
53+ echo " <revision>$$REVISION</revision>" >> $@.xml ; \
54+ echo '</info>' >> $@.xml ; \
55 for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
56 sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
57 done ; \
58@@ -55,12 +65,11 @@
59 rm -rf "$$GTESTER_LOGDIR"/ ; \
60 ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
61 }
62-.PHONY: test test-report perf-report full-report
63+.PHONY: test test-report perf-report full-report test-nonrecursive
64
65-# Run tests as part of make check
66+# run tests in cwd as part of make check
67 if ENABLE_HEADLESS_TESTS
68 check-local: test-headless
69 else
70-check-local: test
71+check-local: test-nonrecursive
72 endif
73-
74
75=== modified file 'configure.ac'
76--- configure.ac 2012-10-03 06:21:02 +0000
77+++ configure.ac 2012-10-09 09:29:08 +0000
78@@ -243,6 +243,7 @@
79 test/Makefile
80 test/C/Makefile
81 test/vala/Makefile
82+test/python/Makefile
83 vapi/Makefile
84 ])
85
86
87=== modified file 'src/unity-previews.vala'
88--- src/unity-previews.vala 2012-10-02 15:18:03 +0000
89+++ src/unity-previews.vala 2012-10-09 09:29:08 +0000
90@@ -691,7 +691,7 @@
91 public signal void preview_ready (Preview? preview);
92
93 // simple emit method, so it's easy to use in C/Python
94- [CCode (name = "unity_async_preview_preview_ready")]
95+ [CCode (cname = "unity_async_preview_preview_ready")]
96 public void emit_preview_ready (Preview? preview)
97 requires (!(preview is AsyncPreview))
98 {
99
100=== modified file 'test/C/Makefile.am'
101--- test/C/Makefile.am 2011-01-11 21:37:07 +0000
102+++ test/C/Makefile.am 2012-10-09 09:29:08 +0000
103@@ -0,0 +1,2 @@
104+include $(top_srcdir)/Makefile.decl
105+
106
107=== modified file 'test/Makefile.am'
108--- test/Makefile.am 2011-12-05 12:18:16 +0000
109+++ test/Makefile.am 2012-10-09 09:29:08 +0000
110@@ -1,4 +1,6 @@
111-SUBDIRS = vala C
112+include $(top_srcdir)/Makefile.decl
113+
114+SUBDIRS = vala C python
115
116 EXTRA_DIST = \
117 data/applications/ubuntu-about.desktop \
118
119=== added directory 'test/python'
120=== added file 'test/python/Makefile.am'
121--- test/python/Makefile.am 1970-01-01 00:00:00 +0000
122+++ test/python/Makefile.am 2012-10-09 09:29:08 +0000
123@@ -0,0 +1,41 @@
124+include $(top_srcdir)/Makefile.decl
125+
126+TESTS = bug-1062331.py
127+TEST_EXTENSIONS = .py
128+
129+# gtester doesn't care about our TESTS_ENVIRONMENT, so can't use it
130+#TEST_PROGS = $(TESTS)
131+
132+TESTS_ENVIRONMENT = \
133+ GI_TYPELIB_PATH=$(top_builddir)/src:$$GI_TYPELIB_PATH; \
134+ export GI_TYPELIB_PATH; \
135+ LD_LIBRARY_PATH=$(top_builddir)/src/.libs:$$LD_LIBRARY_PATH; \
136+ export LD_LIBRARY_PATH; \
137+ $(NULL)
138+PY_LOG_COMPILER = $(PYTHON)
139+AM_PY_LOG_FLAGS =
140+
141+# START HEADLESS TESTS
142+if ENABLE_HEADLESS_TESTS
143+DISPLAY = :27
144+LOG_PATH = headless-logs
145+test-headless:
146+ set -e; \
147+ export DISPLAY=$(DISPLAY); \
148+ rm -rf $(LOG_PATH); \
149+ mkdir $(LOG_PATH); \
150+ $(XVFB) $(DISPLAY) -screen 0 1024x768x8 > $(LOG_PATH)/Xvfb.out 2>&1 & \
151+ sleep 1; \
152+ \
153+ $(DBUS_LAUNCH) > $(LOG_PATH)/sessionbus.sh; \
154+ source $(LOG_PATH)/sessionbus.sh; \
155+ sleep 1; \
156+ \
157+ make test; \
158+ sleep 1; \
159+ \
160+ kill `grep DBUS_SESSION_BUS_PID $(LOG_PATH)/sessionbus.sh | grep -oE '[0-9]+'`; \
161+ pkill Xvfb;
162+
163+endif
164+# END HEADLESS TESTS
165
166=== added file 'test/python/bug-1062331.py'
167--- test/python/bug-1062331.py 1970-01-01 00:00:00 +0000
168+++ test/python/bug-1062331.py 2012-10-09 09:29:08 +0000
169@@ -0,0 +1,9 @@
170+#!/usr/bin/python
171+
172+from gi.repository import Unity
173+
174+async_preview = Unity.AsyncPreview.new()
175+generic_preview = Unity.GenericPreview.new("Title", "Description", None)
176+
177+# Check that preview-ready emitter works correctly
178+async_preview.preview_ready(generic_preview)
179
180=== modified file 'test/vala/test-mpris-backend-prop-updates-client.vala'
181--- test/vala/test-mpris-backend-prop-updates-client.vala 2011-11-25 13:05:58 +0000
182+++ test/vala/test-mpris-backend-prop-updates-client.vala 2012-10-09 09:29:08 +0000
183@@ -302,9 +302,11 @@
184 {
185 }*/
186
187+ private const string RB_NAME = "org.mpris.MediaPlayer2.rhythmbox";
188+
189 internal static void player_property_updates_playback_status ()
190 {
191- Mpris2Controller controller = new Mpris2Controller ("org.mpris.MediaPlayer2.rhythmbox");
192+ Mpris2Controller controller = new Mpris2Controller (RB_NAME);
193 controller.player.PlayPause();
194
195 Timeout.add_seconds (2, () => {
196@@ -318,7 +320,7 @@
197
198 internal static void player_property_updates_metadata()
199 {
200- Mpris2Controller controller = new Mpris2Controller ("org.mpris.MediaPlayer2.rhythmbox");
201+ Mpris2Controller controller = new Mpris2Controller (RB_NAME);
202 controller.player.Next();
203 Timeout.add_seconds (2, () => {
204 assert (controller.received_prop_updates_for_metadata_change.size == 1);
205@@ -346,7 +348,7 @@
206
207 internal static async void do_test_async_property_update_activate_playlist (MainLoop loop)
208 {
209- var contr = new Mpris2Controller ("org.mpris.MediaPlayer2.rhythmbox");
210+ Mpris2Controller contr = new Mpris2Controller (RB_NAME);
211 try{
212 PlaylistDetails[] pls = yield contr.playlists.GetPlaylists (0,
213 10,

Subscribers

People subscribed via source and target branches