[eog] tests: add screenshot tour test
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] tests: add screenshot tour test
- Date: Thu, 24 Jul 2014 14:46:05 +0000 (UTC)
commit d52f34e60574eb7ec0b62b01d869df7e25f305d8
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Thu Jul 24 16:44:20 2014 +0200
tests: add screenshot tour test
This would help designers to check app looks (see screenshots
in installed-tests/eog_screenshots) and translators
Makefile.am | 2 +-
tests/environment.py | 35 +++++++++++++++++++++++++++++++++++
tests/screenshot_tour.feature | 41 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 77 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 8da496f..d44a35c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,7 +34,7 @@ MAINTAINERCLEANFILES = \
$(srcdir)/mkinstalldirs
@BEHAVE_INSTALLED_TESTS_RULE@
-INSTALLED_TESTS=about undo sidepane fullscreen wallpaper
+INSTALLED_TESTS=about undo sidepane fullscreen wallpaper screenshot
INSTALLED_TESTS_TYPE=session-exclusive
-include $(top_srcdir)/git.mk
diff --git a/tests/environment.py b/tests/environment.py
index 08dc06d..3c61d1d 100644
--- a/tests/environment.py
+++ b/tests/environment.py
@@ -7,6 +7,8 @@ if not isA11yEnabled():
from common_steps import App, cleanup
from dogtail.config import config
+from os import system, makedirs
+from shutil import copyfile
def before_all(context):
@@ -21,9 +23,42 @@ def before_all(context):
context.app_class = App('eog')
+ context.screenshot_counter = 0
+ context.save_screenshots = False
except Exception as e:
print("Error in before_all: %s" % e.message)
+
+def before_tag(context, tag):
+ # Copy screenshots
+ if tag == 'screenshot':
+ context.save_screenshots = True
+ context.screenshot_dir = "../eog_screenshots"
+ makedirs(context.screenshot_dir)
+
+
+def after_step(context, step):
+ try:
+ if hasattr(context, "embed"):
+ # Embed screenshot if HTML report is used
+ system("dbus-send --session --type=method_call " +
+ "--dest='org.gnome.Shell.Screenshot' " +
+ "'/org/gnome/Shell/Screenshot' " +
+ "org.gnome.Shell.Screenshot.Screenshot " +
+ "boolean:true boolean:false string:/tmp/screenshot.png")
+ if context.save_screenshots:
+ # Don't embed screenshot if this is a screenshot tour page
+ name = "%s/screenshot_%s_%02d.png" % (
+ context.screenshot_dir, context.current_locale, context.screenshot_counter)
+
+ copyfile("/tmp/screenshot.png", name)
+ context.screenshot_counter += 1
+ else:
+ context.embed('image/png', open("/tmp/screenshot.png", 'r').read())
+ except Exception as e:
+ print("Error in after_step: %s" % str(e))
+
+
def before_scenario(context, scenario):
""" Cleanup previous settings and make sure we have test files in /tmp """
try:
diff --git a/tests/screenshot_tour.feature b/tests/screenshot_tour.feature
new file mode 100644
index 0000000..10c90fd
--- /dev/null
+++ b/tests/screenshot_tour.feature
@@ -0,0 +1,41 @@
+ screenshot
+Feature: Screenshot tour
+
+ Scenario Outline: Main dialogs
+ * Set locale to "<locale>"
+ * Make sure that eog is running
+ * Select and close "Image" menu
+ * Select and close "Edit" menu
+ * Select and close "View" menu
+ * Select and close "Go" menu
+ * Select and close "Help" menu
+ * Open "/tmp/gnome-logo.png" via menu
+ * Open context menu for current image
+
+ Examples:
+ | locale |
+ | es_ES |
+ | el_GR |
+ | lt_LT |
+ | gl_ES |
+ | cs_CZ |
+ | ru_RU |
+ | id_ID |
+
+ # Need a new test for those
+ #| hu_HU |
+ #| pl_PL |
+ #| fr_FR |
+ #| sl_SI |
+ #| zh_CN |
+ #| it_IT |
+ #| da_DK |
+ #| de_DE |
+ #| ca_ES |
+ #| sr_RS |
+ #| sr_RS latin |
+
+
+ # Error selecting translations
+ #| pt_BR |
+ #| zh_TW |
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]