summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2005-03-16 13:49:10 +0000
committerJohan Dahlin <johan@src.gnome.org>2005-03-16 13:49:10 +0000
commit33039b3716cd62744af5d11992a9b22bcb45ce32 (patch)
treed0ad1c0a0edc9eb12ba80f0201ee6313c0842454
parent8df9133eb9600278e5be6c9dc5906608c081e129 (diff)
downloadpygobject-33039b3716cd62744af5d11992a9b22bcb45ce32.tar.gz
pygobject-33039b3716cd62744af5d11992a9b22bcb45ce32.tar.xz
pygobject-33039b3716cd62744af5d11992a9b22bcb45ce32.zip
New test.
* tests/test_radiobutton.py (RadioButtonTest): New test. * tests: Renamed *.py to test_*.py
-rw-r--r--tests/Makefile.am9
-rw-r--r--tests/runtests.py17
-rw-r--r--tests/test_conversion.py (renamed from tests/conversion.py)0
-rw-r--r--tests/test_enum.py (renamed from tests/enum.py)0
-rw-r--r--tests/test_gtype.py (renamed from tests/gtype.py)0
-rw-r--r--tests/test_radiobutton.py31
6 files changed, 51 insertions, 6 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6572eff..e3b46fc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,12 +19,13 @@ testhelper_la_SOURCES = \
test-unknown.c
tests = \
- test_subprocess.py \
- conversion.py \
- enum.py \
- gtype.py \
+ test_conversion.py \
test_dialog.py \
+ test_enum.py \
+ test_gtype.py \
+ test_radiobutton.py \
test_signal.py \
+ test_subprocess.py \
test_subtype.py \
test_unknown.py
diff --git a/tests/runtests.py b/tests/runtests.py
index b22ce2b..f4c9e1f 100644
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -6,8 +6,19 @@ import unittest
import common
-buildDir = sys.argv[1]
-srcDir = sys.argv[2]
+if len(sys.argv) == 3:
+ buildDir = sys.argv[1]
+ srcDir = sys.argv[2]
+else:
+ if len(sys.argv) == 2:
+ program = sys.argv[1]
+ if program.endswith('.py'):
+ program = program[:-3]
+ else:
+ program = None
+
+ buildDir = '..'
+ srcDir = '.'
common.importModules(buildDir=buildDir,
srcDir=srcDir)
@@ -26,6 +37,8 @@ suite = unittest.TestSuite()
loader = unittest.TestLoader()
for name in gettestnames():
+ if program and program not in name:
+ continue
suite.addTest(loader.loadTestsFromName(name))
testRunner = unittest.TextTestRunner()
diff --git a/tests/conversion.py b/tests/test_conversion.py
index e621e1f..e621e1f 100644
--- a/tests/conversion.py
+++ b/tests/test_conversion.py
diff --git a/tests/enum.py b/tests/test_enum.py
index 052a5e9..052a5e9 100644
--- a/tests/enum.py
+++ b/tests/test_enum.py
diff --git a/tests/gtype.py b/tests/test_gtype.py
index a891ba2..a891ba2 100644
--- a/tests/gtype.py
+++ b/tests/test_gtype.py
diff --git a/tests/test_radiobutton.py b/tests/test_radiobutton.py
new file mode 100644
index 0000000..791f8b2
--- /dev/null
+++ b/tests/test_radiobutton.py
@@ -0,0 +1,31 @@
+import unittest
+
+from common import gtk
+
+class RadioButtonTest(unittest.TestCase):
+ def testCreate(self):
+ radio = gtk.RadioButton()
+ self.assert_(isinstance(radio, gtk.RadioButton))
+
+ def testLabel(self):
+ radio = gtk.RadioButton(None, 'test-radio')
+ self.assertEqual(radio.get_label(), 'test-radio')
+
+ def testGroup(self):
+ radio = gtk.RadioButton()
+ radio2 = gtk.RadioButton(radio)
+ self.assertEqual(radio.get_group(), radio2.get_group())
+
+ def testEmptyGroup(self):
+ radio = gtk.RadioButton()
+ radio2 = gtk.RadioButton()
+ self.assertEqual(radio.get_group(), [radio])
+ self.assertEqual(radio2.get_group(), [radio2])
+ radio2.set_group(radio)
+ self.assertEqual(radio.get_group(), radio2.get_group())
+ radio2.set_group(None)
+ self.assertEqual(radio.get_group(), [radio])
+ self.assertEqual(radio2.get_group(), [radio2])
+
+if __name__ == '__main__':
+ unittest.main()