37 lines
847 B
Python
37 lines
847 B
Python
"""手工剪贴板联调;自动测试导入本模块时不会点击桌面。"""
|
|
|
|
import unittest
|
|
|
|
|
|
def main() -> None:
|
|
import time
|
|
|
|
import pyautogui
|
|
import pyperclip
|
|
|
|
print("Please open WeCom chat window and keep it active.")
|
|
time.sleep(3)
|
|
old = pyperclip.paste()
|
|
print(f"Old clipboard: {old}")
|
|
|
|
# Click in the center of the active window.
|
|
pyautogui.click()
|
|
time.sleep(0.2)
|
|
pyautogui.hotkey("ctrl", "a")
|
|
time.sleep(0.2)
|
|
pyautogui.hotkey("ctrl", "c")
|
|
time.sleep(0.5)
|
|
new = pyperclip.paste()
|
|
|
|
print(f"New clipboard length: {len(new)}")
|
|
print(f"New clipboard snippet: {new[:100]}")
|
|
|
|
|
|
class ManualClipboardIsolationTest(unittest.TestCase):
|
|
def test_manual_entrypoint_is_import_safe(self) -> None:
|
|
self.assertTrue(callable(main))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|