- Shared moderated MP3 profile music (with floating mini-player and MediaSession controls, zero bubble when absent) - AI video dubbing into Russian with burned-in ASS subtitles inside AgentChat (`services/members/dub.py`) - Picture-in-Picture 9:16 and background audio playback (`PlayControl` + `play_patch.py`) - System/custom .ttf fonts & emoji packs (`FontsAndEmoji`), account cleaner (`AccountCleaner`) - Feed blacklist, muted sound restoration, OLED burn-in shift, A/B flag editor, presets, long comments - Updated site homepage (`src/web/index.html`) for LihonT 2.3.0 Serena
64 lines
2.0 KiB
Python
64 lines
2.0 KiB
Python
import unittest
|
|
from pathlib import Path
|
|
|
|
from lihont import flags_patch
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SETTINGS = ROOT / "src" / "lihont" / "two" / "settings" / "LihonTSettingsActivity.java"
|
|
FLAGS = ROOT / "src" / "lihont" / "two" / "flags" / "Flags.java"
|
|
|
|
SAMPLE = """.class public Lcom/bytedance/ies/abmock/SettingsManager;
|
|
.super Ljava/lang/Object;
|
|
|
|
.method public static LIZ(Ljava/lang/String;Z)Z
|
|
.registers 3
|
|
return p1
|
|
.end method
|
|
|
|
.method public static LJ(Ljava/lang/String;I)I
|
|
.registers 3
|
|
return p1
|
|
.end method
|
|
|
|
.method public static LJFF(Ljava/lang/String;J)J
|
|
.registers 4
|
|
return-wide p1
|
|
.end method
|
|
|
|
.method public static LJI(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
.registers 3
|
|
return-object p1
|
|
.end method
|
|
"""
|
|
|
|
|
|
class FlagsPatchTest(unittest.TestCase):
|
|
def test_primitive_getters_are_hooked(self):
|
|
patched = flags_patch.rewrite(SAMPLE)
|
|
self.assertIn("Flags;->bool(Ljava/lang/String;Z)Z", patched)
|
|
self.assertIn("Flags;->number(Ljava/lang/String;I)I", patched)
|
|
self.assertIn("Flags;->longer(Ljava/lang/String;J)J", patched)
|
|
self.assertIn("Flags;->text(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", patched)
|
|
self.assertIn("invoke-static {p0, p1, p2},", patched)
|
|
self.assertIn("move-result-wide p1", patched)
|
|
|
|
def test_it_refuses_to_patch_twice(self):
|
|
patched = flags_patch.rewrite(SAMPLE)
|
|
with self.assertRaises(ValueError):
|
|
flags_patch.rewrite(patched)
|
|
|
|
def test_the_editor_is_in_the_settings(self):
|
|
text = SETTINGS.read_text(encoding="utf-8")
|
|
self.assertIn("flagsRow()", text)
|
|
self.assertIn("Flags.save(this, lines, toggle.isChecked())", text)
|
|
self.assertIn('addSection("Эксперименты"', text)
|
|
|
|
def test_the_editor_is_off_until_turned_on(self):
|
|
text = FLAGS.read_text(encoding="utf-8")
|
|
self.assertIn("getBoolean(KEY_ON, false)", text)
|
|
self.assertIn("MAX_LINES = 500", text)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|