diff options
author | Jussi Kukkonen <jku@openedhand.com> | 2008-05-28 17:19:11 +0000 |
---|---|---|
committer | Jussi Kukkonen <jku@openedhand.com> | 2008-05-28 17:19:11 +0000 |
commit | c83a504a36490915df8378fa5083af824b8c7831 (patch) | |
tree | e9ebcc2058f517301ae702fc181aac0d5f37eccc /tests | |
parent | c62a975ba60ce9b32b155933c1f4531f72e57dfd (diff) | |
download | gupnp-vala-c83a504a36490915df8378fa5083af824b8c7831.tar.gz |
Vala bindings for gupnp-ui (and a test app)
git-svn-id: https://svn.o-hand.com/repos/gupnp/trunk/bindings/gupnp-vala@1001 d8cb91d7-bff9-0310-92b9-80b65e4482b2
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 14 | ||||
-rw-r--r-- | tests/device-view-test.vala | 46 |
2 files changed, 58 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 1c43a50..db39600 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,7 +4,8 @@ all: Makefile all-tests gssdp-tests: test-publisher test-browser gupnp-tests: server-test proxy-test browsing-test introspection-test -all-tests: gssdp-tests gupnp-tests +gupnp-ui-tests: device-view-test +all-tests: gssdp-tests gupnp-tests gupnp-ui-tests test-publisher: test-publisher.vala $(QUIET_VALAC)$(VALAC) \ @@ -54,10 +55,19 @@ introspection-test: introspection-test.vala --pkg=gupnp-1.0 \ -o $(@F) $< +device-view-test: device-view-test.vala + $(QUIET_VALAC)$(VALAC) \ + --quiet \ + --vapidir=$(top_srcdir) \ + --vapidir=@VAPIDIR@ \ + --pkg=gupnp-ui-1.0 \ + -o $(@F) $< + CLEANFILES = \ test-publisher \ test-browser \ server-test \ proxy-test \ browsing-test \ - introspection-test + introspection-test \ + device-view-test diff --git a/tests/device-view-test.vala b/tests/device-view-test.vala new file mode 100644 index 0000000..1f9d802 --- /dev/null +++ b/tests/device-view-test.vala @@ -0,0 +1,46 @@ +using GLib; +using Gtk; +using GUPnP; + +public class Test.DeviceViewTest : Window { + + construct { + title = "GUPnP DeviceView Test"; + resize (400, 300); + destroy += Gtk.main_quit; + + /* Init GUPnP stuff */ + Context ctxt; + try { + GLib.Thread.init (null); + ctxt = new Context (null, null, 0); + } catch (GLib.Error err) { + GLib.critical (err.message); + Gtk.main_quit (); + } + ControlPoint cp = new ControlPoint (ctxt, "upnp:rootdevice"); + cp.active = true; + + /* Create a ScrolledWindow for the UIDeviceView */ + var scroll_win = new ScrolledWindow (null, null); + scroll_win.set_policy (PolicyType.AUTOMATIC, + PolicyType.ALWAYS); + scroll_win.set_shadow_type (ShadowType.IN); + add (scroll_win); + + /* Set up store and view */ + UIDeviceStore store = new UIDeviceStore (cp); + UIDeviceView view = new UIDeviceView (store); + scroll_win.add (view); + } + + static int main (string[] args) { + Gtk.init (ref args); + + var test = new DeviceViewTest (); + test.show_all (); + Gtk.main (); + + return 0; + } +} |