summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2016-08-16 21:51:17 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2016-08-16 21:57:21 +0300
commitfdab8ed5b6ba8a595e80b0e159c9ff7884db7a5e (patch)
treed48bee48e7a2143f1bb931daf87e77bc7be7611e
parentb2af779d7d416df654c690f2de077f5eeb6e72b9 (diff)
tests: Fix edje decorators test
Commit dd584b9f79ec41b53ca620ae534fcf84f12e30a9 fixed bad behaviour in edje entry. Our test was picking up the "changed" and "cursor,changed" signals emitted by edje entry when its text was set to "" on creation. Raster changed this behaviour, removing the emissions, so let's do the same in our test and add some future proofing as well. Fixes T4374
-rw-r--r--tests/edje/test_05_decorators.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/edje/test_05_decorators.py b/tests/edje/test_05_decorators.py
index 2a09dea..1a8fbfe 100644
--- a/tests/edje/test_05_decorators.py
+++ b/tests/edje/test_05_decorators.py
@@ -14,7 +14,7 @@ theme_file = os.path.join(theme_path, "theme.edj")
14 14
15 15
16expected_signals = ["edje,language,none", "edje,state,ltr", "load", 16expected_signals = ["edje,language,none", "edje,state,ltr", "load",
17 "edje,state,ltr", "resize", "cursor,changed", "changed", 17 "edje,state,ltr", "resize",
18 "emit,message", "emit,message"] 18 "emit,message", "emit,message"]
19expected_signals2 = ["load", "resize"] 19expected_signals2 = ["load", "resize"]
20expected_messages = [33, 33] 20expected_messages = [33, 33]
@@ -28,7 +28,8 @@ class MyEdje(Edje):
28 28
29 @edje.on_signal("*", "*") 29 @edje.on_signal("*", "*")
30 def cb_signal_all(self, emission, source): 30 def cb_signal_all(self, emission, source):
31 expected_signals.remove(emission) 31 if source == "" or source == "edje":
32 expected_signals.remove(emission)
32 33
33 @edje.on_signal("load", "*") 34 @edje.on_signal("load", "*")
34 @edje.on_signal("resize", "*") 35 @edje.on_signal("resize", "*")
@@ -50,13 +51,16 @@ class TestEdjeDecoratedCallbacks(unittest.TestCase):
50 size=(400, 500), 51 size=(400, 500),
51 viewport=(0, 0, 400, 500)) 52 viewport=(0, 0, 400, 500))
52 self.canvas.engine_info_set(self.canvas.engine_info_get()) 53 self.canvas.engine_info_set(self.canvas.engine_info_get())
54 self.o = MyEdje(self.canvas)
55 self.assertIsInstance(self.o, Edje)
53 56
54 def tearDown(self): 57 def tearDown(self):
58 self.o.delete()
59 self.assertTrue(self.o.is_deleted())
55 self.canvas.delete() 60 self.canvas.delete()
56 61
57 def testDecorators(self): 62 def testDecorators(self):
58 o = MyEdje(self.canvas) 63 o = self.o
59 self.assertIsInstance(o, Edje)
60 64
61 # this should trigger text_change, two times 65 # this should trigger text_change, two times
62 ecore.Timer(0.1, lambda: o.part_text_set("label", "asd")) 66 ecore.Timer(0.1, lambda: o.part_text_set("label", "asd"))
@@ -76,9 +80,6 @@ class TestEdjeDecoratedCallbacks(unittest.TestCase):
76 self.assertEqual(expected_messages, []) 80 self.assertEqual(expected_messages, [])
77 self.assertEqual(expected_text_parts, []) 81 self.assertEqual(expected_text_parts, [])
78 82
79 o.delete()
80 self.assertTrue(o.is_deleted())
81
82 83
83if __name__ == '__main__': 84if __name__ == '__main__':
84 formatter = logging.Formatter("[%(levelname)s] %(name)s (%(filename)s: %(lineno)d) --- %(message)s") 85 formatter = logging.Formatter("[%(levelname)s] %(name)s (%(filename)s: %(lineno)d) --- %(message)s")