コード例 #1
0
 def test_dump_minimal(self):
     assert ModifiedMouseClick.shift_left_click().dump() == remove_indent(
         """
     <KeyDown Shift>
     <ClickMouse LButton Down>
     <ClickMouse LButton Up>
     <KeyUp Shift>
     """)
コード例 #2
0
 def test_dump_indent(self):
     sl = SendLabel(to=["w1", "w2"],
                    actions=[
                        Key(name=keyname.KEY_1),
                        "<Key 2>",
                    ])
     assert sl.dump() == remove_indent("""
     <SendLabel w1, w2>
         <Key 1>
         <Key 2>
     """)
コード例 #3
0
def test_remove_indent():
    content = """
    <div>
        <strong></strong>
    </div>
    """
    assert utils.remove_indent(content) == "\n".join([
        "<div>",
        "    <strong></strong>",
        "</div>",
    ])
コード例 #4
0
 def test_dump_indent(self):
     cmd = Command(
         "MyCommand",
         actions=[
             Key(name=keyname.KEY_1),
             "<Key 2>",
         ],
     )
     assert cmd.dump() == remove_indent("""
     <Command MyCommand>
         <Key 1>
         <Key 2>
     """)
コード例 #5
0
 def test_dump_with_hotkey_and_send_label(self):
     hk = Hotkey(name="Test",
                 key=keyname.SCROLOCK_ON(keyname.KEY_1),
                 actions=[
                     SendLabel(to=[
                         "w1",
                     ],
                               actions=[
                                   ModifiedMouseClick.shift_left_click(),
                               ])
                 ])
     assert hk.dump() == remove_indent("""
     <Hotkey ScrollLockOn 1>
         <SendLabel w1>
             <KeyDown Shift>
             <ClickMouse LButton Down>
             <ClickMouse LButton Up>
             <KeyUp Shift>
     """)
コード例 #6
0
    def test_dump(self):
        cmd = Command(name="MyCommand")

        hk = Hotkey(
            name="Test",
            key=keyname.SCROLOCK_ON(keyname.SPACE),
            actions=[
                SendLabel(
                    to=["w1", ],
                    actions=[
                        Key(keyname.NUMPAD_1),
                        Key(keyname.KEY_1),
                    ]
                ),
                SendLabel(
                    to=["w2", ],
                    actions=[
                        Key(keyname.NUMPAD_2),
                        Key(keyname.KEY_2),
                    ]
                ),
                CallCommand(cmd=cmd),
                cmd.call(),
                "<MyCommand>",
            ]
        )
        assert hk.dump().strip() == remove_indent("""
        <Hotkey ScrollLockOn Space>
            <SendLabel w1>
                <Key Numpad1>
                <Key 1>
            <SendLabel w2>
                <Key Numpad2>
                <Key 2>
            <MyCommand>
            <MyCommand>
            <MyCommand>
        """)