Esempio n. 1
0
def test_mode_change_clears_maps_in_progress(caplog):
    caplog.set_level(logging.DEBUG)
    iLhs="savag"
    iRhs="role"
    imap(iLhs, iRhs)
    nmap("g", "l")
    setMode(Mode.insert)
    # maps_in_progress should be iLhs minus end char (sava)
    insertExpected = (iLhs[:-1])
    assert translate_keys(insertExpected) == insertExpected
    assert not maps_in_progress_is_blank()
    setMode(Mode.normal)
    # Need to send one more key to trigger the map check.
    translate_keys("l")
    assert maps_in_progress_is_blank()
Esempio n. 2
0
def test_mode_change_not_affects_remaps(caplog):
    caplog.set_level(logging.DEBUG)
    iLhs="savag"
    iRhs="role"
    imap(iLhs, iRhs)
    nmap("g", "l")
    setMode(Mode.insert)
    # maps_in_progress should be iLhs minus end char (sava)
    insertExpected = (iLhs[:-1])
    assert translate_keys(insertExpected) == insertExpected
    assert not maps_in_progress_is_blank()
    setMode(Mode.normal)
    assert translate_keys("g") == Motion.right.value
    setMode(Mode.insert)
    assert translate_keys("g") == "g"
    assert translate_keys(iLhs) == iRhs
Esempio n. 3
0
def test_imap(caplog, maps, test, expected, error_msg):
    caplog.set_level(logging.DEBUG)
    setMode(Mode.insert)
    for m in maps:
        imap(m, maps[m])
    assert translate_keys(test) == expected, error_msg
    # Remove imaps again
    for m in maps:
        imap(m)
Esempio n. 4
0
def test_basic_motion_with_count(count):
    motion = 'l'
    motionVal = Motion.right.value
    inpt = str(count) + motion
    expected = motionVal * count
    setMode(Mode.normal)
    result = translate_keys(inpt)
    print("number of repeats in result: {}".format(result.count(motionVal)))
    print("current repeat count: {}".format(univisal.model.getRepeatCount()))
    assert result == expected, "motion with count {} returns wrong thing".format(
        count)
Esempio n. 5
0
def test_map_with_joinchar(caplog, maps, test, expected, error_msg):
    caplog.set_level(logging.DEBUG)
    univisal.adapter_maps.adapter_maps = {Keys.multikey_join_char.value: "+"}
    assert univisal.adapter_maps.getJoinChar() != ""
    setMode(Mode.insert)
    for m in maps:
        imap(m, maps[m])
    assert translate_keys(test) == expected, error_msg
    # Remove imaps again
    for m in maps:
        imap(m)
Esempio n. 6
0
def test_f():
    assert Keys.requestSelectedText.value in translate_keys("fm")
    result = translate_keys("<clipboard>end of this is m and text")
    # TODO Account for deselect, then movement.
    assert result == "<left>" + "<right>" * 16
Esempio n. 7
0
def test_imap_esc_followup(caplog):
    imap("jk", Keys.esc.value)
    setMode(Mode.insert)
    result = translate_keys("jkl")
    assert getMode() == Mode.normal
    assert result == Motion.right.value