Mod for TikTok 47.1.3 (arm64) in Material 3 style: bottom bar, profile menu, TikTok settings and comments; downloads without the watermark; switches for ads, live streams and the Shop tab; badges of other mods next to names and the niche mod badge (members service); app icons; mod settings screen. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
68 lines
2.3 KiB
Python
68 lines
2.3 KiB
Python
"""The custom launcher icon store and the picture-crop geometry.
|
|
|
|
Both are plain java.io / arithmetic, so they run on a desktop JVM; the Android side (picking a photo,
|
|
pinning the shortcut) is checked on the phone.
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
PACKAGE = ROOT / "src" / "lihont" / "two" / "settings"
|
|
HARNESS = ROOT / "tests" / "java" / "lihont" / "two" / "settings" / "IconStoreTest.java"
|
|
|
|
|
|
class CustomIconTest(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.javac = shutil.which("javac")
|
|
cls.java = shutil.which("java")
|
|
if not cls.javac or not cls.java:
|
|
raise RuntimeError("These tests require a JDK with java and javac")
|
|
cls.temporary = tempfile.TemporaryDirectory(prefix="lihont-custom-icon-tests-")
|
|
cls.addClassCleanup(cls.temporary.cleanup)
|
|
cls.classes = Path(cls.temporary.name)
|
|
cls.environment = dict(os.environ)
|
|
cls.environment.pop("JAVA_TOOL_OPTIONS", None)
|
|
cls.run_command([
|
|
cls.javac, "--release", "17", "-encoding", "UTF-8", "-nowarn", "-Xlint:-options",
|
|
"-d", str(cls.classes),
|
|
str(PACKAGE / "IconCrop.java"), str(PACKAGE / "CustomIconStore.java"), str(HARNESS),
|
|
])
|
|
|
|
@classmethod
|
|
def run_command(cls, command):
|
|
result = subprocess.run(
|
|
command, capture_output=True, text=True, encoding="utf-8",
|
|
env=cls.environment, timeout=60,
|
|
)
|
|
if result.returncode:
|
|
raise AssertionError(
|
|
f"Command failed with exit {result.returncode}: {command[0]}\n" + result.stdout + result.stderr)
|
|
return result
|
|
|
|
def run_scenario(self, name):
|
|
result = self.run_command([
|
|
self.java, "-cp", str(self.classes), "lihont.two.settings.IconStoreTest", name])
|
|
self.assertEqual(result.stdout.strip(), "PASS " + name)
|
|
|
|
def test_the_photo_is_cut_to_the_centre_square(self):
|
|
self.run_scenario("crop")
|
|
|
|
def test_names_and_ids_are_cleaned(self):
|
|
self.run_scenario("names")
|
|
|
|
def test_icons_are_stored_listed_capped_and_removed(self):
|
|
self.run_scenario("store")
|
|
|
|
def test_a_damaged_index_is_survived(self):
|
|
self.run_scenario("damaged")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|