Skip to content

Commit 8e917b0

Browse files
committed
Added more debug stuff to testing apps
1 parent 47258f8 commit 8e917b0

File tree

2 files changed

+57
-4
lines changed

2 files changed

+57
-4
lines changed

tests/testapp/main.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
from kivy.properties import StringProperty
55

66
from kivy.uix.popup import Popup
7+
from kivy.clock import Clock
8+
9+
print('Imported kivy')
10+
from kivy.utils import platform
11+
print('platform is', platform)
712

813

914
kv = '''
@@ -20,6 +25,10 @@
2025
FixedSizeButton:
2126
text: 'test pyjnius'
2227
on_press: app.test_pyjnius()
28+
Widget:
29+
size_hint_y: None
30+
height: 1000
31+
on_touch_down: print 'touched at', args[-1].pos
2332
2433
<ErrorPopup>:
2534
title: 'Error'
@@ -39,21 +48,28 @@ def raise_error(error):
3948
class TestApp(App):
4049
def build(self):
4150
root = Builder.load_string(kv)
51+
Clock.schedule_interval(self.print_something, 2)
52+
Clock.schedule_interval(self.test_pyjnius, 5)
4253
return root
4354

55+
def print_something(self, *args):
56+
print('App print tick', Clock.get_boottime())
57+
4458
def on_pause(self):
4559
return True
4660

47-
def test_pyjnius(self):
61+
def test_pyjnius(self, *args):
4862
try:
4963
from jnius import autoclass
5064
except ImportError:
5165
raise_error('Could not import pyjnius')
5266
return
5367

5468
print('Attempting to vibrate with pyjnius')
55-
PythonActivity = autoclass('org.renpy.android.PythonActivity')
56-
activity = PythonActivity.mActivity
69+
# PythonActivity = autoclass('org.renpy.android.PythonActivity')
70+
# activity = PythonActivity.mActivity
71+
NewPythonActivity = autoclass('net.inclem.android.NewPythonActivity')
72+
activity = NewPythonActivity.mActivity
5773
Intent = autoclass('android.content.Intent')
5874
Context = autoclass('android.content.Context')
5975
vibrator = activity.getSystemService(Context.VIBRATOR_SERVICE)

tests/testapp_nogui/main.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11

22
from math import sqrt
3+
print('import math worked')
34

4-
for i in range(50):
5+
import sys
6+
7+
print('sys.path is', sys.path)
8+
9+
for i in range(45, 50):
510
print(i, sqrt(i))
611

712
print('Just printing stuff apparently worked, trying pyjnius')
@@ -10,6 +15,38 @@
1015

1116
print('Importing jnius worked')
1217

18+
print('trying to import stuff')
19+
20+
try:
21+
from jnius import cast
22+
except ImportError:
23+
print('cast failed')
24+
25+
try:
26+
from jnius import ensureclass
27+
except ImportError:
28+
print('ensureclass failed')
29+
30+
try:
31+
from jnius import JavaClass
32+
except ImportError:
33+
print('JavaClass failed')
34+
35+
try:
36+
from jnius import jnius
37+
except ImportError:
38+
print('jnius failed')
39+
40+
try:
41+
from jnius import reflect
42+
except ImportError:
43+
print('reflect failed')
44+
45+
try:
46+
from jnius import find_javaclass
47+
except ImportError:
48+
print('find_javaclass failed')
49+
1350
print('Trying to autoclass activity')
1451

1552
from jnius import autoclass

0 commit comments

Comments
 (0)