Release 0.1.45: member phone locations and people-first family navigation
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
"""Installer routing and permission contracts; not a physical phone test."""
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
ANDROID = ROOT/'android-display'
|
||||
NS = '{http://schemas.android.com/apk/res/android}'
|
||||
|
||||
|
||||
class AndroidLocationContractTests(unittest.TestCase):
|
||||
def test_phone_launcher_is_location_only(self):
|
||||
manifest = ET.parse(ANDROID/'AndroidManifest.xml').getroot()
|
||||
entries = manifest.findall('application/activity')
|
||||
launchers = [a.get(NS+'name') for a in entries if any(c.get(NS+'name') ==
|
||||
'android.intent.category.LAUNCHER' for c in a.findall('intent-filter/category'))]
|
||||
television = [a.get(NS+'name') for a in entries if any(c.get(NS+'name') ==
|
||||
'android.intent.category.LEANBACK_LAUNCHER' for c in a.findall('intent-filter/category'))]
|
||||
self.assertEqual(launchers, ['.LocationActivity'])
|
||||
self.assertEqual(television, ['.MainActivity'])
|
||||
self.assertEqual(manifest.get(NS+'versionName'), (ROOT/'VERSION').read_text().strip())
|
||||
self.assertEqual(manifest.get(NS+'versionCode'), '3')
|
||||
|
||||
def test_collection_is_visible_foreground_and_never_boot_started(self):
|
||||
manifest = ET.parse(ANDROID/'AndroidManifest.xml').getroot()
|
||||
service = next(s for s in manifest.findall('application/service') if s.get(NS+'name') == '.LocationService')
|
||||
self.assertEqual(service.get(NS+'exported'), 'false')
|
||||
self.assertEqual(service.get(NS+'foregroundServiceType'), 'location')
|
||||
boot = (ANDROID/'src/cn/ucvl/zhaodisplay/BootReceiver.java').read_text()
|
||||
self.assertNotIn('LocationService', boot)
|
||||
self.assertIn('phoneMode', boot)
|
||||
ui = (ANDROID/'src/cn/ucvl/zhaodisplay/LocationActivity.java').read_text(encoding='utf-8')
|
||||
self.assertNotIn('WebView', ui)
|
||||
self.assertIn('共享我的位置', ui)
|
||||
self.assertIn('new int[]{10,60,300}', ui)
|
||||
self.assertIn('consent.isChecked()', ui)
|
||||
|
||||
def test_map_has_local_assets_no_external_coordinate_requests(self):
|
||||
source = (ANDROID/'src/cn/ucvl/zhaodisplay/LocationMapView.java').read_text(encoding='utf-8')
|
||||
self.assertIn('getAssets().open("world-land.json")', source)
|
||||
self.assertNotIn('http', source)
|
||||
build = (ANDROID/'build.ps1').read_text(encoding='utf-8')
|
||||
for name in ('world-land.json', 'WORLD-LAND-LICENSE.txt'):
|
||||
self.assertIn(name, build)
|
||||
self.assertTrue((ROOT/'frontend/src/data'/name).exists())
|
||||
|
||||
|
||||
if __name__ == '__main__': unittest.main()
|
||||
Reference in New Issue
Block a user