diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-09-10 00:54:05 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-09-10 00:54:05 (GMT) |
commit | 3884507a741856e3db77617bb6a85b3c2595e21b (patch) | |
tree | 03c4f257802b83a159a856ed282541a37979b39b | |
parent | 47cc58b1e648a586252046eb79339357cd38f939 (diff) |
Write a session for ui tests and use it for test-icons
-rw-r--r-- | sugar/env.py | 5 | ||||
-rw-r--r-- | sugar/session/Makefile.am | 3 | ||||
-rw-r--r-- | sugar/session/UITestSession.py | 21 | ||||
-rwxr-xr-x | tests/test-icons.py | 20 | ||||
-rwxr-xr-x | tools/run-test.sh | 5 |
5 files changed, 40 insertions, 14 deletions
diff --git a/sugar/env.py b/sugar/env.py index e3c552d..62dc269 100644 --- a/sugar/env.py +++ b/sugar/env.py @@ -15,7 +15,7 @@ def setup_user(profile): def get_nick_name(): return os.environ['SUGAR_NICK_NAME'] -def setup_system(): +def setup_python_path(): for path in sugar_python_path: sys.path.insert(0, path) if os.environ.has_key('PYTHONPATH'): @@ -24,6 +24,9 @@ def setup_system(): else: os.environ['PYTHONPATH'] = path +def setup_system(): + setup_python_path() + for path in sugar_bin_path: if os.environ.has_key('PATH'): old_path = os.environ['PATH'] diff --git a/sugar/session/Makefile.am b/sugar/session/Makefile.am index 326f2ab..3434c44 100644 --- a/sugar/session/Makefile.am +++ b/sugar/session/Makefile.am @@ -4,4 +4,5 @@ sugar_PYTHON = \ DbusProcess.py \ Emulator.py \ MatchboxProcess.py \ - Process.py + Process.py \ + UITestSession.py diff --git a/sugar/session/UITestSession.py b/sugar/session/UITestSession.py new file mode 100644 index 0000000..49056fa --- /dev/null +++ b/sugar/session/UITestSession.py @@ -0,0 +1,21 @@ +import os + +from sugar.session.DbusProcess import DbusProcess +from sugar.session.MatchboxProcess import MatchboxProcess +from sugar.session.Emulator import Emulator +from sugar import env + +class UITestSession: + def start(self): + env.setup_python_path() + + if os.environ.has_key('SUGAR_EMULATOR') and \ + os.environ['SUGAR_EMULATOR'] == 'yes': + emulator = Emulator() + emulator.start() + + process = MatchboxProcess() + process.start() + + process = DbusProcess() + process.start() diff --git a/tests/test-icons.py b/tests/test-icons.py index b0d6485..3a2b47d 100755 --- a/tests/test-icons.py +++ b/tests/test-icons.py @@ -1,10 +1,16 @@ #!/usr/bin/python -import random - import pygtk pygtk.require('2.0') -import gtk +from sugar.session.UITestSession import UITestSession + +session = UITestSession() +session.start() + +import sys +import random + +import gtk import goocanvas from sugar.canvas import IconColor @@ -22,19 +28,19 @@ window.add(canvas) canvas_model = goocanvas.CanvasModelSimple() root = canvas_model.get_root_item() -item = goocanvas.Rect(x=0, y=0, width=800, height=600, +item = goocanvas.Rect(x=0, y=0, width=1200, height=900, line_width=0.0, fill_color="#4f4f4f") root.add_child(item) icon_names = [ 'stock-buddy', 'activity-groupchat', 'activity-web'] k = 0 -while k < 11: +while k < 17: i = 0 - while i < 15: + while i < 23: color = IconColor.IconColor() icon_name_n = int(random.random() * len(icon_names)) - icon = IconItem(x=i * 50 + 10, y=k * 50 + 10, + icon = IconItem(x=i * 50 + 20, y=k * 50 + 10, size=46, color=color, icon_name=icon_names[icon_name_n]) root.add_child(icon) diff --git a/tools/run-test.sh b/tools/run-test.sh deleted file mode 100755 index 23c7368..0000000 --- a/tools/run-test.sh +++ /dev/null @@ -1,5 +0,0 @@ -Xephyr :50 -ac -screen 800x600 & - -DISPLAY=:50 -matchbox-window-manager & -exec $* |