- 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
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
import unittest
|
|
from pathlib import Path
|
|
|
|
from lihont import sound_patch
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SETTINGS = ROOT / "src" / "lihont" / "two" / "settings" / "LihonTSettingsActivity.java"
|
|
SOUND = ROOT / "src" / "lihont" / "two" / "sound" / "Sound.java"
|
|
|
|
SAMPLE = """.class public final Lcom/ss/android/ugc/aweme/feed/model/AwemeStatus$VideoMuteInfo;
|
|
.super Ljava/lang/Object;
|
|
.source "AwemeStatus.java"
|
|
|
|
.method public final isMute()Z
|
|
.registers 2
|
|
|
|
.prologue
|
|
.line 0
|
|
iget-boolean v0, p0, Lcom/ss/android/ugc/aweme/feed/model/AwemeStatus$VideoMuteInfo;->isMute:Z
|
|
|
|
.line 1
|
|
return v0
|
|
.end method
|
|
"""
|
|
|
|
|
|
class SoundPatchTest(unittest.TestCase):
|
|
def test_the_getter_goes_through_the_switch(self):
|
|
patched = sound_patch.rewrite(SAMPLE)
|
|
self.assertIn(sound_patch.MARKER, patched)
|
|
self.assertIn("Llihont/two/sound/Sound;->unmute(Z)Z", patched)
|
|
self.assertIn("->isMute:Z", patched)
|
|
self.assertIn("return v0", patched)
|
|
|
|
def test_it_refuses_to_patch_twice(self):
|
|
patched = sound_patch.rewrite(SAMPLE)
|
|
with self.assertRaises(ValueError):
|
|
sound_patch.rewrite(patched)
|
|
|
|
def test_the_settings_screen_has_the_switch(self):
|
|
text = SETTINGS.read_text(encoding="utf-8")
|
|
self.assertIn("soundRow()", text)
|
|
self.assertIn("Sound.setEnabled(this, value)", text)
|
|
|
|
def test_the_switch_defaults_to_on(self):
|
|
text = SOUND.read_text(encoding="utf-8")
|
|
self.assertIn("getBoolean(KEY, true)", text)
|
|
self.assertIn("return enabled() ? false : original", text)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|