LihonT 2 Luna beta: source release
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>
This commit is contained in:
80
tests/test_badge_patch.py
Normal file
80
tests/test_badge_patch.py
Normal file
@@ -0,0 +1,80 @@
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from lihont import badge_patch as bp
|
||||
|
||||
USER = """\
|
||||
.class public Lcom/ss/android/ugc/aweme/profile/model/User;
|
||||
.super Ljava/lang/Object;
|
||||
|
||||
.method public getNickname()Ljava/lang/String;
|
||||
.registers 2
|
||||
|
||||
iget-object v0, p0, Lx;->nickname:Ljava/lang/String;
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
.method public getUniqueId()Ljava/lang/String;
|
||||
.registers 2
|
||||
|
||||
iget-object v0, p0, Lx;->uniqueId:Ljava/lang/String;
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
.method public getUserDisplayName()Ljava/lang/String;
|
||||
.registers 2
|
||||
|
||||
iget-object v0, p0, Lx;->d:Ljava/lang/String;
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
"""
|
||||
|
||||
TUX = """\
|
||||
.class public Lcom/bytedance/tux/input/TuxTextView;
|
||||
.super Landroid/widget/TextView;
|
||||
|
||||
.method public setText(Ljava/lang/CharSequence;Landroid/widget/TextView$BufferType;)V
|
||||
.registers 10
|
||||
|
||||
return-void
|
||||
.end method
|
||||
"""
|
||||
|
||||
|
||||
class BadgePatchTest(unittest.TestCase):
|
||||
def test_user_getters_remember_their_names(self):
|
||||
patched, hits = bp.rewrite_user(USER)
|
||||
self.assertEqual(3, len(hits))
|
||||
self.assertEqual(3, patched.count(bp.REMEMBER))
|
||||
self.assertLess(patched.index(bp.REMEMBER), patched.index("return-object v0"))
|
||||
|
||||
def test_text_view_hook_runs_first_and_replaces_the_text(self):
|
||||
patched, _ = bp.rewrite_text_view(TUX)
|
||||
self.assertLess(patched.index(".registers 10"), patched.index(bp.PREPARE))
|
||||
self.assertLess(patched.index("move-result-object p1"), patched.index("return-void"))
|
||||
|
||||
def test_second_pass_and_changed_shapes_are_refused(self):
|
||||
with self.assertRaises(ValueError):
|
||||
bp.rewrite_user(bp.rewrite_user(USER)[0])
|
||||
with self.assertRaises(ValueError):
|
||||
bp.rewrite_user(USER.replace(".registers 2", ".registers 3", 1))
|
||||
with self.assertRaises(ValueError):
|
||||
bp.rewrite_text_view(TUX.replace("setText", "setLabel"))
|
||||
|
||||
def test_every_target_has_a_dex_and_the_runtime_calls_exist(self):
|
||||
self.assertEqual(set(bp.REWRITES), set(bp.DEXES))
|
||||
self.assertEqual(4, len(bp.runtime_targets()))
|
||||
|
||||
def test_the_bundled_pictures_are_there(self):
|
||||
# the pictures are third-party artwork: a checkout without them still builds, without those two badges
|
||||
for name in ("supporter.png", "developer.png"):
|
||||
path = Path("src/compat", name)
|
||||
if path.is_file():
|
||||
self.assertTrue(path.stat().st_size > 500)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user