summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:36:58 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:37:00 +0900
commit188514abf089f6c3bf73469e83525f3519f15ede (patch)
treeaef6a890adbf5572bf779c92fe98cb69b2b34636 /tests
parentdd20fe51cd566c8c20bcbb96901c766a385d0a11 (diff)
downloadpygobject2-188514abf089f6c3bf73469e83525f3519f15ede.tar.gz
pygobject2-188514abf089f6c3bf73469e83525f3519f15ede.tar.bz2
pygobject2-188514abf089f6c3bf73469e83525f3519f15ede.zip
Imported Upstream version 2.28.6upstream/2.28.6
Change-Id: Ic975e9ed81a8d0c60fea3fadf17e4172a6c19009 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_everything.py1
-rw-r--r--tests/test_gi.py30
-rw-r--r--tests/test_overrides.py4
3 files changed, 34 insertions, 1 deletions
diff --git a/tests/test_everything.py b/tests/test_everything.py
index 74d917a..5fadc36 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -11,7 +11,6 @@ from sys import getrefcount
import cairo
from gi.repository import GObject
-from gi.repository import GLib
from gi.repository import Regress as Everything
if sys.version_info < (3, 0):
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 4aa5532..6990225 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -5,6 +5,11 @@
import sys
import unittest
+import tempfile
+import shutil
+import os
+import locale
+import subprocess
from gi.repository import GObject
import gobject
@@ -960,6 +965,31 @@ class TestPointer(unittest.TestCase):
class TestEnum(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ '''Run tests under a test locale.
+
+ Upper case conversion of member names should not be locale specific;
+ e. g. in Turkish, "i".upper() == "i", which gives results like "iNVALiD"
+
+ Run test under a locale which defines toupper('a') == 'a'
+ '''
+ cls.locale_dir = tempfile.mkdtemp()
+ subprocess.check_call(['localedef', '-i',
+ os.path.join(os.path.dirname(os.path.realpath(__file__)), 'te_ST@nouppera'),
+ '-c', '-f', 'UTF-8', os.path.join(cls.locale_dir, 'te_ST.UTF-8@nouppera')])
+ os.environ['LOCPATH'] = cls.locale_dir
+ locale.setlocale(locale.LC_ALL, 'te_ST.UTF-8@nouppera')
+
+ @classmethod
+ def tearDownClass(cls):
+ locale.setlocale(locale.LC_ALL, 'C')
+ shutil.rmtree(cls.locale_dir)
+ try:
+ del os.environ['LOCPATH']
+ except KeyError:
+ pass
+
def test_enum(self):
self.assertTrue(issubclass(GIMarshallingTests.Enum, int))
self.assertTrue(isinstance(GIMarshallingTests.Enum.VALUE1, GIMarshallingTests.Enum))
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 57abdfd..47f38a3 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -359,10 +359,14 @@ class TestGdk(unittest.TestCase):
self.assertEquals(color.red, 100)
self.assertEquals(color.green, 200)
self.assertEquals(color.blue, 300)
+ self.assertEquals(color, Gdk.Color(100, 200, 300))
+ self.assertNotEquals(color, Gdk.Color(1, 2, 3))
def test_rgba(self):
self.assertEquals(Gdk.RGBA, overrides.Gdk.RGBA)
rgba = Gdk.RGBA(0.1, 0.2, 0.3, 0.4)
+ self.assertEquals(rgba, Gdk.RGBA(0.1, 0.2, 0.3, 0.4))
+ self.assertNotEquals(rgba, Gdk.RGBA(0.0, 0.2, 0.3, 0.4))
self.assertEquals(rgba.red, 0.1)
self.assertEquals(rgba.green, 0.2)
self.assertEquals(rgba.blue, 0.3)