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
=== modified file 'Makefile.decl'
--- Makefile.decl 2011-11-29 09:13:49 +0000
+++ Makefile.decl 2012-10-09 09:29:08 +0000
@@ -3,8 +3,8 @@
3# This file is copied almost verbatim from the GLib-2.0 distribution3# This file is copied almost verbatim from the GLib-2.0 distribution
4#4#
55
6GTESTER = gtester # for non-GLIB packages6GTESTER = gtester
7GTESTER_REPORT = $(top_builddir)/test/gtester-report # for the GLIB package7GTESTER_REPORT = gtester-report
88
9# initialize variables for unconditional += appending9# initialize variables for unconditional += appending
10EXTRA_DIST =10EXTRA_DIST =
@@ -13,12 +13,16 @@
13### testing rules13### testing rules
1414
15# test: run all tests in cwd and subdirs15# test: run all tests in cwd and subdirs
16test: ${TEST_PROGS}16test: test-nonrecursive
17 @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS}17 @ for subdir in $(SUBDIRS) . ; do \
18 @ for subdir in $(SUBDIRS) ; do \
19 test "$$subdir" = "." -o "$$subdir" = "po" || \18 test "$$subdir" = "." -o "$$subdir" = "po" || \
20 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \19 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
21 done20 done
21
22# test-nonrecursive: run tests only in cwd
23test-nonrecursive: ${TEST_PROGS}
24 @test -z "${TEST_PROGS}" || G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS}
25
22# test-report: run tests in subdirs and generate report26# test-report: run tests in subdirs and generate report
23# perf-report: run tests in subdirs with -m perf and generate report27# perf-report: run tests in subdirs with -m perf and generate report
24# full-report: like test-report: with -m perf and -m slow28# full-report: like test-report: with -m perf and -m slow
@@ -40,13 +44,19 @@
40 GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \44 GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
41 ignore_logdir=false ; \45 ignore_logdir=false ; \
42 fi ; \46 fi ; \
43 for subdir in $(SUBDIRS) ; do \47 REVISION=$(VERSION) ; \
48 for subdir in $(SUBDIRS) . ; do \
44 test "$$subdir" = "." -o "$$subdir" = "po" || \49 test "$$subdir" = "." -o "$$subdir" = "po" || \
45 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \50 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
46 done ; \51 done ; \
47 $$ignore_logdir || { \52 $$ignore_logdir || { \
48 echo '<?xml version="1.0"?>' > $@.xml ; \53 echo '<?xml version="1.0"?>' > $@.xml ; \
49 echo '<report-collection>' >> $@.xml ; \54 echo '<report-collection>' >> $@.xml ; \
55 echo '<info>' >> $@.xml ; \
56 echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \
57 echo ' <version>$(VERSION)</version>' >> $@.xml ; \
58 echo " <revision>$$REVISION</revision>" >> $@.xml ; \
59 echo '</info>' >> $@.xml ; \
50 for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \60 for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
51 sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \61 sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
52 done ; \62 done ; \
@@ -55,12 +65,11 @@
55 rm -rf "$$GTESTER_LOGDIR"/ ; \65 rm -rf "$$GTESTER_LOGDIR"/ ; \
56 ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \66 ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
57 }67 }
58.PHONY: test test-report perf-report full-report68.PHONY: test test-report perf-report full-report test-nonrecursive
5969
60# Run tests as part of make check70# run tests in cwd as part of make check
61if ENABLE_HEADLESS_TESTS71if ENABLE_HEADLESS_TESTS
62check-local: test-headless72check-local: test-headless
63else73else
64check-local: test74check-local: test-nonrecursive
65endif75endif
66
6776
=== modified file 'configure.ac'
--- configure.ac 2012-10-03 06:21:02 +0000
+++ configure.ac 2012-10-09 09:29:08 +0000
@@ -243,6 +243,7 @@
243test/Makefile243test/Makefile
244test/C/Makefile244test/C/Makefile
245test/vala/Makefile245test/vala/Makefile
246test/python/Makefile
246vapi/Makefile247vapi/Makefile
247])248])
248249
249250
=== modified file 'src/unity-previews.vala'
--- src/unity-previews.vala 2012-10-02 15:18:03 +0000
+++ src/unity-previews.vala 2012-10-09 09:29:08 +0000
@@ -691,7 +691,7 @@
691 public signal void preview_ready (Preview? preview);691 public signal void preview_ready (Preview? preview);
692692
693 // simple emit method, so it's easy to use in C/Python693 // simple emit method, so it's easy to use in C/Python
694 [CCode (name = "unity_async_preview_preview_ready")]694 [CCode (cname = "unity_async_preview_preview_ready")]
695 public void emit_preview_ready (Preview? preview)695 public void emit_preview_ready (Preview? preview)
696 requires (!(preview is AsyncPreview))696 requires (!(preview is AsyncPreview))
697 {697 {
698698
=== modified file 'test/C/Makefile.am'
--- test/C/Makefile.am 2011-01-11 21:37:07 +0000
+++ test/C/Makefile.am 2012-10-09 09:29:08 +0000
@@ -0,0 +1,2 @@
1include $(top_srcdir)/Makefile.decl
2
03
=== modified file 'test/Makefile.am'
--- test/Makefile.am 2011-12-05 12:18:16 +0000
+++ test/Makefile.am 2012-10-09 09:29:08 +0000
@@ -1,4 +1,6 @@
1SUBDIRS = vala C1include $(top_srcdir)/Makefile.decl
2
3SUBDIRS = vala C python
24
3EXTRA_DIST = \5EXTRA_DIST = \
4 data/applications/ubuntu-about.desktop \6 data/applications/ubuntu-about.desktop \
57
=== added directory 'test/python'
=== added file 'test/python/Makefile.am'
--- test/python/Makefile.am 1970-01-01 00:00:00 +0000
+++ test/python/Makefile.am 2012-10-09 09:29:08 +0000
@@ -0,0 +1,41 @@
1include $(top_srcdir)/Makefile.decl
2
3TESTS = bug-1062331.py
4TEST_EXTENSIONS = .py
5
6# gtester doesn't care about our TESTS_ENVIRONMENT, so can't use it
7#TEST_PROGS = $(TESTS)
8
9TESTS_ENVIRONMENT = \
10 GI_TYPELIB_PATH=$(top_builddir)/src:$$GI_TYPELIB_PATH; \
11 export GI_TYPELIB_PATH; \
12 LD_LIBRARY_PATH=$(top_builddir)/src/.libs:$$LD_LIBRARY_PATH; \
13 export LD_LIBRARY_PATH; \
14 $(NULL)
15PY_LOG_COMPILER = $(PYTHON)
16AM_PY_LOG_FLAGS =
17
18# START HEADLESS TESTS
19if ENABLE_HEADLESS_TESTS
20DISPLAY = :27
21LOG_PATH = headless-logs
22test-headless:
23 set -e; \
24 export DISPLAY=$(DISPLAY); \
25 rm -rf $(LOG_PATH); \
26 mkdir $(LOG_PATH); \
27 $(XVFB) $(DISPLAY) -screen 0 1024x768x8 > $(LOG_PATH)/Xvfb.out 2>&1 & \
28 sleep 1; \
29 \
30 $(DBUS_LAUNCH) > $(LOG_PATH)/sessionbus.sh; \
31 source $(LOG_PATH)/sessionbus.sh; \
32 sleep 1; \
33 \
34 make test; \
35 sleep 1; \
36 \
37 kill `grep DBUS_SESSION_BUS_PID $(LOG_PATH)/sessionbus.sh | grep -oE '[0-9]+'`; \
38 pkill Xvfb;
39
40endif
41# END HEADLESS TESTS
042
=== added file 'test/python/bug-1062331.py'
--- test/python/bug-1062331.py 1970-01-01 00:00:00 +0000
+++ test/python/bug-1062331.py 2012-10-09 09:29:08 +0000
@@ -0,0 +1,9 @@
1#!/usr/bin/python
2
3from gi.repository import Unity
4
5async_preview = Unity.AsyncPreview.new()
6generic_preview = Unity.GenericPreview.new("Title", "Description", None)
7
8# Check that preview-ready emitter works correctly
9async_preview.preview_ready(generic_preview)
010
=== modified file 'test/vala/test-mpris-backend-prop-updates-client.vala'
--- test/vala/test-mpris-backend-prop-updates-client.vala 2011-11-25 13:05:58 +0000
+++ test/vala/test-mpris-backend-prop-updates-client.vala 2012-10-09 09:29:08 +0000
@@ -302,9 +302,11 @@
302 { 302 {
303 }*/303 }*/
304304
305 private const string RB_NAME = "org.mpris.MediaPlayer2.rhythmbox";
306
305 internal static void player_property_updates_playback_status ()307 internal static void player_property_updates_playback_status ()
306 {308 {
307 Mpris2Controller controller = new Mpris2Controller ("org.mpris.MediaPlayer2.rhythmbox"); 309 Mpris2Controller controller = new Mpris2Controller (RB_NAME);
308 controller.player.PlayPause();310 controller.player.PlayPause();
309311
310 Timeout.add_seconds (2, () => {312 Timeout.add_seconds (2, () => {
@@ -318,7 +320,7 @@
318 320
319 internal static void player_property_updates_metadata()321 internal static void player_property_updates_metadata()
320 {322 {
321 Mpris2Controller controller = new Mpris2Controller ("org.mpris.MediaPlayer2.rhythmbox"); 323 Mpris2Controller controller = new Mpris2Controller (RB_NAME);
322 controller.player.Next();324 controller.player.Next();
323 Timeout.add_seconds (2, () => {325 Timeout.add_seconds (2, () => {
324 assert (controller.received_prop_updates_for_metadata_change.size == 1);326 assert (controller.received_prop_updates_for_metadata_change.size == 1);
@@ -346,7 +348,7 @@
346348
347 internal static async void do_test_async_property_update_activate_playlist (MainLoop loop)349 internal static async void do_test_async_property_update_activate_playlist (MainLoop loop)
348 {350 {
349 var contr = new Mpris2Controller ("org.mpris.MediaPlayer2.rhythmbox");351 Mpris2Controller contr = new Mpris2Controller (RB_NAME);
350 try{352 try{
351 PlaylistDetails[] pls = yield contr.playlists.GetPlaylists (0,353 PlaylistDetails[] pls = yield contr.playlists.GetPlaylists (0,
352 10,354 10,

Subscribers

People subscribed via source and target branches