[Galago-commits] r2771 - in trunk/notify-python: . src tests

galago-commits at freedesktop.org galago-commits at freedesktop.org
Tue Apr 25 01:48:06 PDT 2006


Author: chipx86
Date: 2006-04-25 01:48:00 -0700 (Tue, 25 Apr 2006)
New Revision: 2771

Added:
   trunk/notify-python/tests/test-markup.py
   trunk/notify-python/tests/test-replace.py
   trunk/notify-python/tests/test-server-info.py
   trunk/notify-python/tests/test-urgency.py
   trunk/notify-python/tests/test-xy.py
Modified:
   trunk/notify-python/ChangeLog
   trunk/notify-python/src/Makefile.am
   trunk/notify-python/src/pynotify.defs
   trunk/notify-python/tests/Makefile.am
Log:
- Add default values and null-ok to the message and icon parameters in the Notification constructor and update() method.
- Add a few test cases.


Modified: trunk/notify-python/ChangeLog
===================================================================
--- trunk/notify-python/ChangeLog	2006-04-25 08:38:29 UTC (rev 2770)
+++ trunk/notify-python/ChangeLog	2006-04-25 08:48:00 UTC (rev 2771)
@@ -1,3 +1,17 @@
+Tue Apr 25 01:47:17 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* src/Makefile.am:
+	* src/pynotify.defs:
+	* tests/Makefile.am:
+	A tests/test-markup.py:
+	A tests/test-replace.py:
+	A tests/test-server-info.py:
+	A tests/test-urgency.py:
+	A tests/test-xy.py:
+	  - Add default values and null-ok to the message and icon parameters
+	    in the Notification constructor and update() method.
+	  - Add a few test cases.
+
 Tue Apr 25 01:38:08 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/pynotify.override:

Modified: trunk/notify-python/src/Makefile.am
===================================================================
--- trunk/notify-python/src/Makefile.am	2006-04-25 08:38:29 UTC (rev 2770)
+++ trunk/notify-python/src/Makefile.am	2006-04-25 08:48:00 UTC (rev 2771)
@@ -41,7 +41,8 @@
 update-defs:
 	@python $(datadir)/pygtk/2.0/codegen/h2def.py $(DEFHEADERS) > pynotify.defs.tmp
 	@sed -e 's/define-function notify_\(init\|uninit\|is_\|get\)/define-function \1/g' \
-	     -e '/define-function notify_notification_new/,/^$$/ { s/\("icon"\)/\1 (null-ok) (default "NULL")/g; s/\("attach"\)/\1 (null-ok) (default "NULL")/g; }' \
+	     -e '/define-function notify_notification_new/,/^$$/ { s/\("message"\)/\1 (null-ok) (default "NULL")/g; s/\("icon"\)/\1 (null-ok) (default "NULL")/g; s/\("attach"\)/\1 (null-ok) (default "NULL")/g; }' \
+	     -e '/define-method update/,/^$$/ { s/\("message"\)/\1 (null-ok) (default "NULL")/g; s/\("icon"\)/\1 (null-ok) (default "NULL")/g; }' \
 	     pynotify.defs.tmp > pynotify.defs
 	@rm -f pynotify.defs.tmp
 	@echo Definitions updated

Modified: trunk/notify-python/src/pynotify.defs
===================================================================
--- trunk/notify-python/src/pynotify.defs	2006-04-25 08:38:29 UTC (rev 2770)
+++ trunk/notify-python/src/pynotify.defs	2006-04-25 08:48:00 UTC (rev 2771)
@@ -36,7 +36,7 @@
   (return-type "NotifyNotification*")
   (parameters
     '("const-gchar*" "summary")
-    '("const-gchar*" "message")
+    '("const-gchar*" "message" (null-ok) (default "NULL"))
     '("const-gchar*" "icon" (null-ok) (default "NULL"))
     '("GtkWidget*" "attach" (null-ok) (default "NULL"))
   )
@@ -48,8 +48,8 @@
   (return-type "gboolean")
   (parameters
     '("const-gchar*" "summary")
-    '("const-gchar*" "message")
-    '("const-gchar*" "icon")
+    '("const-gchar*" "message" (null-ok) (default "NULL"))
+    '("const-gchar*" "icon" (null-ok) (default "NULL"))
   )
 )
 

Modified: trunk/notify-python/tests/Makefile.am
===================================================================
--- trunk/notify-python/tests/Makefile.am	2006-04-25 08:38:29 UTC (rev 2770)
+++ trunk/notify-python/tests/Makefile.am	2006-04-25 08:48:00 UTC (rev 2771)
@@ -1,2 +1,7 @@
 EXTRA_DIST = \
-	test-basic.py
+	test-basic.py \
+	test-markup.py \
+	test-replace.py \
+	test-server-info.py \
+	test-urgency.py \
+	test-xy.py

Added: trunk/notify-python/tests/test-markup.py
===================================================================
--- trunk/notify-python/tests/test-markup.py	2006-04-25 08:38:29 UTC (rev 2770)
+++ trunk/notify-python/tests/test-markup.py	2006-04-25 08:48:00 UTC (rev 2771)
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+import pygtk
+pygtk.require('2.0')
+import pynotify
+import sys
+
+if __name__ == '__main__':
+    if not pynotify.init("Markup"):
+        sys.exit(1)
+
+    n = pynotify.Notification("Summary",
+        "Some <b>bold</b>, <u>underlined</u>, <i>italic</i>, " +
+        "<a href='http://www.google.com'>linked</a> text")
+
+    if not n.show():
+        print "Failed to send notification"
+        sys.exit(1)


Property changes on: trunk/notify-python/tests/test-markup.py
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/notify-python/tests/test-replace.py
===================================================================
--- trunk/notify-python/tests/test-replace.py	2006-04-25 08:38:29 UTC (rev 2770)
+++ trunk/notify-python/tests/test-replace.py	2006-04-25 08:48:00 UTC (rev 2771)
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+import pygtk
+pygtk.require('2.0')
+import pynotify
+import sys
+import time
+
+if __name__ == '__main__':
+    if not pynotify.init("Replace Test"):
+        sys.exit(1)
+
+    n = pynotify.Notification("Summary", "First message")
+    n.set_timeout(0)
+
+    if not n.show():
+        print "Failed to send notification"
+        sys.exit(1)
+
+    time.sleep(3)
+
+    n.update("Second Summary", "First mesage was replaced")
+
+    if not n.show():
+        print "Failed to send notification"
+        sys.exit(1)


Property changes on: trunk/notify-python/tests/test-replace.py
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/notify-python/tests/test-server-info.py
===================================================================
--- trunk/notify-python/tests/test-server-info.py	2006-04-25 08:38:29 UTC (rev 2770)
+++ trunk/notify-python/tests/test-server-info.py	2006-04-25 08:48:00 UTC (rev 2771)
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+import pygtk
+pygtk.require('2.0')
+import pynotify
+import sys
+
+if __name__ == '__main__':
+    if not pynotify.init("TestCaps"):
+        sys.exit(1)
+
+    info = pynotify.get_server_info()
+
+    print "Name:         " + info["name"]
+    print "Vendor:       " + info["vendor"]
+    print "Version:      " + info["version"]
+    print "Spec Version: " + info["spec-version"]
+    print "Capabilities:"
+
+    caps = pynotify.get_server_caps()
+
+    if caps is None:
+        print "Failed to receive server caps."
+        sys.exit(1)
+
+    for cap in caps:
+        print "\t" + cap


Property changes on: trunk/notify-python/tests/test-server-info.py
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/notify-python/tests/test-urgency.py
===================================================================
--- trunk/notify-python/tests/test-urgency.py	2006-04-25 08:38:29 UTC (rev 2770)
+++ trunk/notify-python/tests/test-urgency.py	2006-04-25 08:48:00 UTC (rev 2771)
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+import pygtk
+pygtk.require('2.0')
+import pynotify
+import sys
+
+if __name__ == '__main__':
+    if not pynotify.init("Urgency"):
+        sys.exit(1)
+
+    # Low Urgency
+    n = pynotify.Notification("Low Urgency", "Joe signed online.")
+    n.set_urgency(pynotify.URGENCY_LOW)
+
+    if not n.show():
+        print "Failed to send notification"
+        sys.exit(1)
+
+
+    # Normal Urgency
+    n = pynotify.Notification("Normal Urgency",
+                              "You have a meeting in 10 minutes.")
+    n.set_urgency(pynotify.URGENCY_NORMAL)
+
+    if not n.show():
+        print "Failed to send notification"
+        sys.exit(1)
+
+
+    # Critical Urgency
+    n = pynotify.Notification("Critical Urgency",
+                              "This message will self-destruct in 10 seconds.")
+    n.set_urgency(pynotify.URGENCY_CRITICAL)
+    n.set_timeout(10000) # 10 seconds
+
+    if not n.show():
+        print "Failed to send notification"
+        sys.exit(1)


Property changes on: trunk/notify-python/tests/test-urgency.py
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/notify-python/tests/test-xy.py
===================================================================
--- trunk/notify-python/tests/test-xy.py	2006-04-25 08:38:29 UTC (rev 2770)
+++ trunk/notify-python/tests/test-xy.py	2006-04-25 08:48:00 UTC (rev 2771)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import pygtk
+pygtk.require('2.0')
+import pynotify
+import sys
+
+if __name__ == '__main__':
+    if not pynotify.init("XY"):
+        sys.exit(1)
+
+    n = pynotify.Notification("X, Y Test",
+                              "This notification should point to 150, 10")
+    n.set_hint_int32("x", 150)
+    n.set_hint_int32("y", 10)
+
+    if not n.show():
+        print "Failed to send notification"
+        sys.exit(1)


Property changes on: trunk/notify-python/tests/test-xy.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the galago-commits mailing list