Files
LihonT/tests/test_dead_slots.py
cheb0chik 5df4cddf7d LihonT 3 Luna pre-alpha: the streak pet becomes an animal
A pair of people can have a kitten, a puppy or a lion cub in place of TikTok's streak creature: it grows with the days of the
streak (cub, teen, adult, elder), goes grey while the streak is about to burn out, can be dragged in the chat and is also shown
on the big streak screen. An animal is given by a link (lihont.space/pet) that the friend accepts. The drawings are made by
scripts/make_pet_designs.py and served as strips of frames. Also here: the promo video scripts (make_pet_video.py on top of
make_store_video.py), a retry pause for strips that failed to load, stricter checks in the answer to a gift.

Work in progress: the gift service is not switched on for everyone yet and there is no public build with the animals.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 15:14:48 +03:00

35 lines
1.2 KiB
Python

import unittest
from pathlib import Path
from lihont import app_icons, dead_slots
from lihont.apkzip import Apk
from lihont.arsc import Arsc
BASE = Path("OriginalAPKtiktok/com.zhiliaoapp.musically_47.1.3-2024701030_minAPI23(arm64-v8a)(nodpi)_apkmirror.com.apk")
class DeadSlotsTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not BASE.exists():
raise unittest.SkipTest("clean TikTok base APK is not available")
cls.apk = Apk(str(BASE))
cls.arsc = Arsc(cls.apk.read("resources.arsc"))
cls.addClassCleanup(cls.apk.close)
def test_the_slots_pinned_by_hand_are_found_by_the_build_itself(self):
found = {res_id for res_id, _ in dead_slots.find(self.apk, self.arsc, 500)}
for res_id, path in app_icons.SLOTS:
self.assertIn(res_id, found, hex(res_id))
def test_every_slot_is_a_file_of_the_apk_and_the_order_is_by_id(self):
slots = dead_slots.find(self.apk, self.arsc, 8)
self.assertEqual(8, len(slots))
self.assertEqual(sorted(slots), slots)
for _, path in slots:
self.assertTrue(self.apk.has(path), path)
if __name__ == "__main__":
unittest.main()