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:
152
tests/test_settings_patch.py
Normal file
152
tests/test_settings_patch.py
Normal file
@@ -0,0 +1,152 @@
|
||||
import unittest
|
||||
|
||||
from lihont import settings_patch
|
||||
|
||||
|
||||
DVK_SAMPLE = """
|
||||
.class public final LX/1DvK;
|
||||
.super Ljava/lang/Object;
|
||||
|
||||
.method public static final LIZ(LX/0CWi;ZZLX/0LYA;I)V
|
||||
.registers 40
|
||||
move-object/from16 v5, p0
|
||||
invoke-virtual {v6}, LX/0MNM;->LJJJJZ()LX/0MN8;
|
||||
move-result-object v1
|
||||
if-eqz v1, :cond_5a
|
||||
new-instance v0, Lkotlin/jvm/internal/AwS2S0121000_35;
|
||||
|
||||
.line 83886157
|
||||
.line 83886158
|
||||
const/16 v11, 0x23
|
||||
|
||||
.line 83886159
|
||||
.line 83886160
|
||||
move-object v6, v0
|
||||
|
||||
.line 83886161
|
||||
move-object v7, v5
|
||||
|
||||
.line 83886162
|
||||
move v8, v4
|
||||
|
||||
.line 83886163
|
||||
move v9, v3
|
||||
|
||||
.line 83886164
|
||||
move v10, v2
|
||||
|
||||
.line 83886165
|
||||
invoke-direct/range {v6 .. v11}, Lkotlin/jvm/internal/AwS2S0121000_35;-><init>(LX/0CWi;ZZII)V
|
||||
iput-object v0, v1, LX/0MN8;->LIZLLL:Lkotlin/jvm/functions/Function2;
|
||||
:cond_5a
|
||||
return-void
|
||||
|
||||
iget-object v0, v5, LX/0CWi;->LLJJIJIIJIL:Ljava/lang/Integer;
|
||||
|
||||
.line 83886180
|
||||
.line 83886181
|
||||
const/4 v12, 0x0
|
||||
|
||||
.line 83886182
|
||||
if-eqz v0, :cond_e5
|
||||
|
||||
.line 83886183
|
||||
.line 83886184
|
||||
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
|
||||
|
||||
.line 83886185
|
||||
.line 83886186
|
||||
.line 83886187
|
||||
move-result v0
|
||||
|
||||
.line 83886188
|
||||
:goto_6c
|
||||
invoke-static {v0, v6}, LX/0KwU;->LIZIZ(ILX/0LYA;)Ljava/lang/String;
|
||||
|
||||
.line 83886189
|
||||
.line 83886190
|
||||
.line 83886191
|
||||
move-result-object v11
|
||||
|
||||
.line 83886192
|
||||
const/4 v10, 0x0
|
||||
|
||||
.line 83886193
|
||||
iget-object v0, v5, LX/0CWi;->LLJJIJI:LX/0LGU;
|
||||
|
||||
.line 83886194
|
||||
.line 83886195
|
||||
if-nez v0, :cond_77
|
||||
|
||||
.line 83886196
|
||||
.line 83886197
|
||||
sget-object v0, LX/0L1b;->LIZ:LX/0LGU;
|
||||
|
||||
.line 83886198
|
||||
.line 83886199
|
||||
:cond_77
|
||||
invoke-static {v0, v6}, LX/0Lis;->LJFF(LX/0LGU;LX/0LYA;)LX/0MIo;
|
||||
|
||||
:cond_e5
|
||||
const/4 v0, 0x0
|
||||
|
||||
.line 83886310
|
||||
goto :goto_6c
|
||||
.end method
|
||||
"""
|
||||
|
||||
DUR_SAMPLE = """
|
||||
.class public final LX/1DuR;
|
||||
.super Ljava/lang/Object;
|
||||
|
||||
.method public static final LJIIIZ(LX/1Dgo;ZZLX/0LYA;I)V
|
||||
const/4 v14, 0x4
|
||||
|
||||
.line 83886338
|
||||
move-object v12, v6
|
||||
|
||||
.line 83886339
|
||||
invoke-static/range {v9 .. v14}, LX/1Dvf;->LIZIZ(ZZLcom/ss/android/ugc/aweme/setting/ui/rvmpcompose/group/top/cell/ManagePostsVM;LX/0LYA;II)V
|
||||
.end method
|
||||
"""
|
||||
|
||||
LDM_SAMPLE = """
|
||||
.class public final LX/0LDm;
|
||||
.super Ljava/lang/Object;
|
||||
|
||||
.method public static final LIZ(LX/0M1d;Ljava/lang/String;ILjava/lang/String;ZZLX/0LDk;ZLX/0LRh;ZLX/0LDv;ZZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;LX/1Dw4;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;LX/0LYA;IIII)V
|
||||
.registers 78
|
||||
|
||||
.prologue
|
||||
.line 503316480
|
||||
move-object/from16 p20, p20
|
||||
return-void
|
||||
.end method
|
||||
"""
|
||||
|
||||
|
||||
class SettingsPatchTest(unittest.TestCase):
|
||||
def test_rewrite_1dvk_injects_lihont_method(self):
|
||||
patched = settings_patch.rewrite_1dvk(DVK_SAMPLE)
|
||||
self.assertIn(".method public static final lihont(", patched)
|
||||
self.assertIn("SettingsCell;->title()Ljava/lang/String;", patched)
|
||||
self.assertIn("LX/0LB8;->LLLLIIL:LX/0LGU;", patched)
|
||||
self.assertIn("SettingsCell;->again(", patched)
|
||||
self.assertNotIn(":cond_e5", patched.split("lihont(")[1])
|
||||
with self.assertRaises(ValueError):
|
||||
settings_patch.rewrite_1dvk(patched)
|
||||
|
||||
def test_rewrite_1dur_injects_draw_call(self):
|
||||
patched = settings_patch.rewrite_1dur(DUR_SAMPLE)
|
||||
self.assertIn("invoke-static {v9, v6}, Llihont/two/settings/SettingsCell;->draw(ZLjava/lang/Object;)Z", patched)
|
||||
self.assertIn("move-result v9", patched)
|
||||
with self.assertRaises(ValueError):
|
||||
settings_patch.rewrite_1dur(patched)
|
||||
|
||||
def test_rewrite_0ldm_injects_transform_icon(self):
|
||||
patched = settings_patch.rewrite_0ldm(LDM_SAMPLE)
|
||||
self.assertIn("SettingsCell;->transformIcon(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;", patched)
|
||||
self.assertIn("move-object/from16 p8, v0", patched)
|
||||
with self.assertRaises(ValueError):
|
||||
settings_patch.rewrite_0ldm(patched)
|
||||
|
||||
Reference in New Issue
Block a user