补齐移动壳剪贴板Unicode截断覆盖

移动壳剪贴板测试覆盖多字节文本按共享上限截断

移动壳配置检查反查剪贴板 Unicode 截断用例
This commit is contained in:
2026-06-20 04:17:17 +08:00
parent 61f2dec93a
commit b8562dfdd9
2 changed files with 14 additions and 0 deletions
@@ -1797,6 +1797,9 @@ for (const snippet of [
throw new Error(`mobile shell clipboard module is missing ${snippet}`);
}
}
if (!bridgeTestSource.includes("'猫'.repeat(100000)")) {
throw new Error('mobile shell clipboard tests must cover Unicode truncation');
}
if (
!hapticsSource.includes('normalizeHostBridgeHapticsImpactStyle(rawStyle)') ||
@@ -709,6 +709,17 @@ describe('handleMobileHostBridgeMessage', () => {
expect(expectOk(response).result).toBe(true);
expect(Clipboard.setStringAsync).toHaveBeenCalledWith('a'.repeat(100000));
vi.mocked(Clipboard.setStringAsync).mockClear();
const unicodeResponse = await send(
request('clipboard.writeText', {
text: '猫'.repeat(100010),
}),
);
expect(expectOk(unicodeResponse).result).toBe(true);
expect(Clipboard.setStringAsync).toHaveBeenCalledWith('猫'.repeat(100000));
});
test('clipboard.readText 读取失败时返回 host_error', async () => {