Write a session for ui tests and use it for test-icons
This commit is contained in:
parent
47cc58b1e6
commit
3884507a74
@ -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']
|
||||
|
@ -4,4 +4,5 @@ sugar_PYTHON = \
|
||||
DbusProcess.py \
|
||||
Emulator.py \
|
||||
MatchboxProcess.py \
|
||||
Process.py
|
||||
Process.py \
|
||||
UITestSession.py
|
||||
|
21
sugar/session/UITestSession.py
Normal file
21
sugar/session/UITestSession.py
Normal file
@ -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()
|
@ -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)
|
||||
|
@ -1,5 +0,0 @@
|
||||
Xephyr :50 -ac -screen 800x600 &
|
||||
|
||||
DISPLAY=:50
|
||||
matchbox-window-manager &
|
||||
exec $*
|
Loading…
Reference in New Issue
Block a user