[eog] tests: fix image size detection step



commit 271dd0167751147901caf55627c52bba7237b9bc
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Mon Mar 9 15:33:21 2015 +0100

    tests: fix image size detection step
    
    Since eog doesn't provide labellee for table cell we have to
    hardcode the size cell number

 tests/steps/steps.py |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/tests/steps/steps.py b/tests/steps/steps.py
index 1c4d639..0d3fa57 100644
--- a/tests/steps/steps.py
+++ b/tests/steps/steps.py
@@ -42,21 +42,22 @@ def open_file_via_menu(context, filename):
 
 @then(u'image size is {width:d}x{height:d}')
 def image_size_is(context, width, height):
+    size_text = None
     for attempt in xrange(0, 10):
-        width_text = context.app.child(roleName='page tab 
list').child(translate('Width:')).parent.children[-1].text
-        if width_text == '':
+        size_child = context.app.child(roleName='page tab list').child(translate('Size'))
+        size_text = size_child.parent.children[11].text
+        if size_text == '':
             sleep(0.5)
             continue
         else:
             break
-    height_text = context.app.child(roleName='page tab 
list').child(translate('Height:')).parent.children[-1].text
     try:
-        actual_width = int(width_text.split(' ')[0])
-        actual_height = int(height_text.split(' ')[0])
+        actual_width = size_text.split(' \xc3\x97 ')[0].strip()
+        actual_height = size_text.split(' \xc3\x97 ')[1].split(' ')[0].strip()
     except Exception:
         raise Exception("Incorrect width/height is been displayed")
-    assert actual_width == width
-    assert actual_height == height
+    assert int(actual_width) == width, "Expected width to be '%s', but was '%s'" % (width, actual_width)
+    assert int(actual_height) == height, "Expected height to be '%s', but was '%s'" % (height, actual_height)
 
 
 @step(u'Rotate the image clockwise')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]