wasp: testapp: Sort tests alphabetically
This commit is contained in:
parent
50ecff29ef
commit
64a97fce58
1 changed files with 18 additions and 18 deletions
|
@ -12,28 +12,28 @@ class TestApp():
|
|||
ICON = icons.app
|
||||
|
||||
def __init__(self):
|
||||
self.tests = ('Touch', 'String', 'Wrap', 'Button', 'Crash', 'RLE')
|
||||
self.tests = ('Button', 'Crash', 'RLE', 'String', 'Touch', 'Wrap')
|
||||
self.test = self.tests[0]
|
||||
self.scroll = wasp.widgets.ScrollIndicator()
|
||||
|
||||
def foreground(self):
|
||||
"""Activate the application."""
|
||||
self.on_screen = ( -1, -1, -1, -1, -1, -1 )
|
||||
self.draw()
|
||||
self._draw()
|
||||
wasp.system.request_event(wasp.EventMask.TOUCH |
|
||||
wasp.EventMask.SWIPE_UPDOWN |
|
||||
wasp.EventMask.BUTTON)
|
||||
|
||||
def press(self, button, state):
|
||||
draw = wasp.watch.drawable
|
||||
if self.test == 'Touch':
|
||||
draw.string('Button', 0, 108, width=240)
|
||||
if self.test == 'String':
|
||||
self.benchmark_string()
|
||||
elif self.test == 'Button':
|
||||
if self.test == 'Button':
|
||||
draw.string('{}: {}'.format(button, state), 0, 108, width=240)
|
||||
elif self.test == 'Crash':
|
||||
self.crash()
|
||||
elif self.test == 'String':
|
||||
self._benchmark_string()
|
||||
elif self.test == 'Touch':
|
||||
draw.string('Button', 0, 108, width=240)
|
||||
|
||||
def swipe(self, event):
|
||||
tests = self.tests
|
||||
|
@ -48,20 +48,20 @@ class TestApp():
|
|||
if i < 0:
|
||||
i = len(tests) - 1
|
||||
self.test = tests[i]
|
||||
self.draw()
|
||||
self._draw()
|
||||
|
||||
def touch(self, event):
|
||||
if self.test == 'Touch':
|
||||
if self.test == 'RLE':
|
||||
self._benchmark_rle()
|
||||
elif self.test == 'String':
|
||||
self._benchmark_string()
|
||||
elif self.test == 'Touch':
|
||||
wasp.watch.drawable.string('({}, {})'.format(
|
||||
event[1], event[2]), 0, 108, width=240)
|
||||
elif self.test == 'String':
|
||||
self.benchmark_string()
|
||||
elif self.test == 'Wrap':
|
||||
self.benchmark_wrap()
|
||||
elif self.test == 'RLE':
|
||||
self.benchmark_rle()
|
||||
self._benchmark_wrap()
|
||||
|
||||
def benchmark_rle(self):
|
||||
def _benchmark_rle(self):
|
||||
draw = wasp.watch.drawable
|
||||
draw.fill(0, 0, 30, 240, 240-30)
|
||||
self.scroll.draw()
|
||||
|
@ -74,7 +74,7 @@ class TestApp():
|
|||
del t
|
||||
draw.string('{}s'.format(elapsed / 1000000), 12, 24+192)
|
||||
|
||||
def benchmark_string(self):
|
||||
def _benchmark_string(self):
|
||||
draw = wasp.watch.drawable
|
||||
draw.fill(0, 0, 30, 240, 240-30)
|
||||
self.scroll.draw()
|
||||
|
@ -90,7 +90,7 @@ class TestApp():
|
|||
del t
|
||||
draw.string('{}s'.format(elapsed / 1000000), 12, 24+192)
|
||||
|
||||
def benchmark_wrap(self):
|
||||
def _benchmark_wrap(self):
|
||||
draw = wasp.watch.drawable
|
||||
draw.fill(0, 0, 30, 240, 240-30)
|
||||
self.scroll.draw()
|
||||
|
@ -108,7 +108,7 @@ class TestApp():
|
|||
del t
|
||||
draw.string('{}s'.format(elapsed / 1000000), 12, 24+192)
|
||||
|
||||
def draw(self):
|
||||
def _draw(self):
|
||||
"""Redraw the display from scratch."""
|
||||
wasp.watch.display.mute(True)
|
||||
draw = wasp.watch.drawable
|
||||
|
|
Loading…
Reference in a new issue