wasp: testapp: Add an option to force an exception
We will shortly be adding machinary to handle application errors more gracefully. This is a useful way to force an application error!
This commit is contained in:
parent
83cc56969e
commit
bb4e76d852
1 changed files with 11 additions and 3 deletions
|
@ -9,7 +9,7 @@ class TestApp():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.tests = ('Touch', 'String', 'Button')
|
self.tests = ('Touch', 'String', 'Button', 'Crash')
|
||||||
self.test = self.tests[0]
|
self.test = self.tests[0]
|
||||||
|
|
||||||
def foreground(self):
|
def foreground(self):
|
||||||
|
@ -28,6 +28,8 @@ class TestApp():
|
||||||
self.benchmark_string()
|
self.benchmark_string()
|
||||||
elif self.test == 'Button':
|
elif self.test == 'Button':
|
||||||
draw.string('{}: {}'.format(button, state), 0, 108, width=240)
|
draw.string('{}: {}'.format(button, state), 0, 108, width=240)
|
||||||
|
elif self.test == 'Crash':
|
||||||
|
self.crash()
|
||||||
|
|
||||||
def swipe(self, event):
|
def swipe(self, event):
|
||||||
tests = self.tests
|
tests = self.tests
|
||||||
|
@ -69,7 +71,13 @@ class TestApp():
|
||||||
def draw(self):
|
def draw(self):
|
||||||
"""Redraw the display from scratch."""
|
"""Redraw the display from scratch."""
|
||||||
wasp.watch.display.mute(True)
|
wasp.watch.display.mute(True)
|
||||||
wasp.watch.drawable.fill()
|
draw = wasp.watch.drawable
|
||||||
wasp.watch.drawable.string('{} test'.format(self.test),
|
draw.fill()
|
||||||
|
draw.string('{} test'.format(self.test),
|
||||||
0, 6, width=240)
|
0, 6, width=240)
|
||||||
|
|
||||||
|
if self.test == 'Crash':
|
||||||
|
draw.string("Press button to", 12, 24+24)
|
||||||
|
draw.string("throw exception.", 12, 24+48)
|
||||||
|
|
||||||
wasp.watch.display.mute(False)
|
wasp.watch.display.mute(False)
|
||||||
|
|
Loading…
Reference in a new issue