summaryrefslogtreecommitdiff
path: root/wasp/apps
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-05 08:46:25 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-06 21:04:20 (GMT)
commitbb4e76d85222c263c4486ad1722df44200fcabf2 (patch)
tree13661fdbbb2ded4ddbf9579e2e78a6a1bf015c10 /wasp/apps
parent83cc56969e13d1e0e3ea4b2a6b8c9c6875110688 (diff)
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!
Diffstat (limited to 'wasp/apps')
-rw-r--r--wasp/apps/testapp.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/wasp/apps/testapp.py b/wasp/apps/testapp.py
index e7016d7..3beca50 100644
--- a/wasp/apps/testapp.py
+++ b/wasp/apps/testapp.py
@@ -9,7 +9,7 @@ class TestApp():
"""
def __init__(self):
- self.tests = ('Touch', 'String', 'Button')
+ self.tests = ('Touch', 'String', 'Button', 'Crash')
self.test = self.tests[0]
def foreground(self):
@@ -28,6 +28,8 @@ class TestApp():
self.benchmark_string()
elif self.test == 'Button':
draw.string('{}: {}'.format(button, state), 0, 108, width=240)
+ elif self.test == 'Crash':
+ self.crash()
def swipe(self, event):
tests = self.tests
@@ -69,7 +71,13 @@ class TestApp():
def draw(self):
"""Redraw the display from scratch."""
wasp.watch.display.mute(True)
- wasp.watch.drawable.fill()
- wasp.watch.drawable.string('{} test'.format(self.test),
+ draw = wasp.watch.drawable
+ draw.fill()
+ draw.string('{} test'.format(self.test),
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)