diff --git a/.gitattributes b/.gitattributes index 6a5ef04..bad39d7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,3 +6,8 @@ *.json text eol=lf *.md text eol=lf *.bat text eol=crlf +# Test fixtures are byte-exact (hashes, signatures): never convert line endings. +tests/fixtures/** -text +*.apk binary +*.jar binary +*.obb binary diff --git a/tests/e2e/test_android.py b/tests/e2e/test_android.py index b2b5373..79bb345 100644 --- a/tests/e2e/test_android.py +++ b/tests/e2e/test_android.py @@ -33,7 +33,7 @@ class AndroidApps(harness.FrameTestCase): self.assertEqual(shortcut['name'], 'App label') self.assertEqual(shortcut['exe'], f'{APP_DIR}/launch.sh') self.assertEqual(shortcut['start_dir'], APP_DIR) - self.assertEqual(shortcut['icon'], f'{APP_DIR}/icon.png') + self.assertEqual(shortcut['icon'], f'{APP_DIR}/artwork/icon.png') for f in ('app.apk', 'launch.sh', 'instance.id', 'meta.json', 'icon.png', 'lepton-show-flatscreen'): self.assertTrue(exists(f'{APP_DIR}/{f}'), f) self.assertEqual(meta['game_id'], (meta['shortcut'] << 32) | 0x02000000) diff --git a/tests/test_frame_android_data.py b/tests/test_frame_android_data.py index 7108a81..175762c 100644 --- a/tests/test_frame_android_data.py +++ b/tests/test_frame_android_data.py @@ -68,7 +68,8 @@ class ObbTests(unittest.TestCase): data._stream('command') - @unittest.skipUnless(shutil.which("sh") and shutil.which("shasum"), "shell checksum tools unavailable") + @unittest.skipUnless(os.name == 'posix' and shutil.which("sh") and shutil.which("shasum"), + "the OBB script runs on the Frame (Linux shell)") def test_android_shell_publish_and_hash_failure(self): with tempfile.TemporaryDirectory() as tmp: source = Path(tmp) / ('main.7.' + PKG + '.obb') @@ -100,6 +101,7 @@ class ObbTests(unittest.TestCase): self.assertEqual(list(output.parent.glob('*.part')), []) +@unittest.skipUnless(os.name == 'posix', 'app-data backups run on the Frame (Linux ownership and modes)') class BackupTests(unittest.TestCase): def test_roundtrip_and_retains_previous_data(self): with tempfile.TemporaryDirectory() as tmp: diff --git a/tests/test_library_entrypoints.py b/tests/test_library_entrypoints.py index cb46c37..1ee80ff 100644 --- a/tests/test_library_entrypoints.py +++ b/tests/test_library_entrypoints.py @@ -216,6 +216,19 @@ class EntryPoints(unittest.TestCase): titles.remove('Game') self.assertTrue(any('steamos-delete --delete-title Game' in c for c in cmds)) + def test_native_remove_deletes_before_tidying_the_shortcut(self): + # steamos-delete finds the Proton prefix through the shortcut, so the shortcut must still exist. + order = [] + def ssh(cmd, **kwargs): + if 'steamos-delete' in cmd: + order.append('delete') + return 'yes' if 'test -d' in cmd else '/home/steamos' if 'HOME' in cmd else '' + with patch.object(titles, 'ssh', side_effect=ssh), patch.object(titles, 'ensure_utils'), \ + patch.object(titles, '_library_shortcut', return_value=42), \ + patch.object(titles.frame_android, 'shortcut_tool', side_effect=lambda *a: order.append(a)): + titles.remove('Game') + self.assertEqual(order, ['delete', ('remove', '42')]) + def test_native_refresh_art_backfills_registered_title(self): meta = {'id':'Game','name':'My Game','source':'game.zip'} writes = [] diff --git a/tests/test_server.py b/tests/test_server.py index a1f9626..319ab8e 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -277,10 +277,10 @@ class ArtworkSettings(unittest.TestCase): proc.wait(timeout=10) def test_panel_script_uses_the_keyed_api_helper(self): - script = (ROOT / "ui" / "artwork-settings.js").read_text() + script = (ROOT / "ui" / "artwork-settings.js").read_text(encoding="utf-8") self.assertNotIn("fetch(", script) self.assertIn("api('/api/settings/artwork'", script) - page = (ROOT / "ui" / "index.html").read_text() + page = (ROOT / "ui" / "index.html").read_text(encoding="utf-8") self.assertLess(page.index("async function api("), page.index('