[Galago-commits] r2775 - in trunk/notify-python: . tests
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Tue Apr 25 22:53:44 PDT 2006
Author: chipx86
Date: 2006-04-25 22:53:38 -0700 (Tue, 25 Apr 2006)
New Revision: 2775
Added:
trunk/notify-python/tests/test-replace-widget.py
trunk/notify-python/tests/test-xy-stress.py
Modified:
trunk/notify-python/ChangeLog
trunk/notify-python/tests/Makefile.am
Log:
Added two new test apps.
Modified: trunk/notify-python/ChangeLog
===================================================================
--- trunk/notify-python/ChangeLog 2006-04-26 05:28:35 UTC (rev 2774)
+++ trunk/notify-python/ChangeLog 2006-04-26 05:53:38 UTC (rev 2775)
@@ -1,3 +1,10 @@
+Tue Apr 25 22:53:24 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * tests/Makefile.am:
+ A tests/test-replace-widget.py:
+ A tests/test-xy-stress.py:
+ - Added two new test apps.
+
Tue Apr 25 22:28:15 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
* tests/Makefile.am:
Modified: trunk/notify-python/tests/Makefile.am
===================================================================
--- trunk/notify-python/tests/Makefile.am 2006-04-26 05:28:35 UTC (rev 2774)
+++ trunk/notify-python/tests/Makefile.am 2006-04-26 05:53:38 UTC (rev 2775)
@@ -6,6 +6,8 @@
test-markup.py \
test-multi-actions.py \
test-replace.py \
+ test-replace-widget.py \
test-server-info.py \
test-urgency.py \
- test-xy.py
+ test-xy.py \
+ test-xy-stress.py
Added: trunk/notify-python/tests/test-replace-widget.py
===================================================================
--- trunk/notify-python/tests/test-replace-widget.py 2006-04-26 05:28:35 UTC (rev 2774)
+++ trunk/notify-python/tests/test-replace-widget.py 2006-04-26 05:53:38 UTC (rev 2775)
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+import pynotify
+import sys
+
+exposed_signal_id = 0
+count = 0
+
+def exposed_cb(button, event, n):
+ global exposed_signal_id
+ button.disconnect(exposed_signal_id)
+ if not n.show():
+ print "Failed to send notification"
+ gtk.main_quit()
+
+def clicked_cb(button, n):
+ global count
+ count += 1
+ n.update("Widget Attachment Test",
+ "You clicked the button %s times" % count)
+ if not n.show():
+ print "Failed to send notification"
+ gtk.main_quit()
+
+
+if __name__ == '__main__':
+ if not pynotify.init("Replace Test"):
+ sys.exit(1)
+
+ win = gtk.Window(gtk.WINDOW_TOPLEVEL)
+ win.show()
+ win.connect('delete_event', gtk.main_quit)
+
+ button = gtk.Button("Click here to change notification")
+ button.show()
+ win.add(button)
+
+ n = pynotify.Notification("Widget Attachment Test",
+ "Button has not been clicked yet", None, button)
+ n.set_category("presence.online")
+ n.set_timeout(0)
+
+ button.connect('clicked', clicked_cb, n)
+ exposed_signal_id = button.connect('expose_event', exposed_cb, n)
+
+ gtk.main()
Property changes on: trunk/notify-python/tests/test-replace-widget.py
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/notify-python/tests/test-xy-stress.py
===================================================================
--- trunk/notify-python/tests/test-xy-stress.py 2006-04-26 05:28:35 UTC (rev 2774)
+++ trunk/notify-python/tests/test-xy-stress.py 2006-04-26 05:53:38 UTC (rev 2775)
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+import pygtk
+pygtk.require('2.0')
+import gobject
+import gtk
+import gtk.gdk
+import pynotify
+import sys
+import random
+
+exposed_signal_id = 0
+count = 0
+
+def handle_closed(n):
+ print "Closing."
+
+def emit_notification(x, y):
+ n = pynotify.Notification("X, Y Test",
+ "This notification should point to %d, %d." % (x, y))
+ n.set_hint_int32("x", x)
+ n.set_hint_int32("y", y)
+ n.connect('closed', handle_closed)
+ n.show()
+
+def popup_random_bubble():
+ display = gtk.gdk.display_get_default()
+ screen = display.get_default_screen()
+ screen_x2 = screen.get_width() - 1
+ screen_y2 = screen.get_height() - 1
+
+ x = random.randint(0, screen_x2)
+ y = random.randint(0, screen_y2)
+ emit_notification(x, y)
+ return True
+
+
+if __name__ == '__main__':
+ if not pynotify.init("XY Stress"):
+ sys.exit(1)
+
+ gobject.timeout_add(1000, popup_random_bubble)
+
+ gtk.main()
Property changes on: trunk/notify-python/tests/test-xy-stress.py
___________________________________________________________________
Name: svn:executable
+ *
More information about the galago-commits
mailing list