Esempio n. 1
0
            public void GetKeyMappingResult_RemainderIsMappable()
            {
                var result = _map.GetKeyMappingResult("dog", KeyRemapMode.Normal).AsPartiallyMapped();

                Assert.Equal(KeyInputSetUtil.OfString("d"), result.Item1);
                Assert.Equal(KeyInputSetUtil.OfString("og"), result.Item2);
            }
Esempio n. 2
0
            public void HandleLessThanEscapeLiteral()
            {
                Assert.True(_map.MapWithNoRemap("a", "<lt>lt>", KeyRemapMode.Normal));
                var result = _map.GetKeyMappingResult("a", KeyRemapMode.Normal);

                Assert.Equal(KeyInputSetUtil.OfString("<lt>"), result.AsMapped().Item);
            }
Esempio n. 3
0
            public void HandleLessThanEscapeLiteral()
            {
                Assert.True(_map.AddKeyMapping("a", "<lt>lt>", allowRemap: false, KeyRemapMode.Normal));
                var result = _map.Map("a", KeyRemapMode.Normal);

                Assert.Equal(KeyInputSetUtil.OfString("<lt>"), result.AsMapped().KeyInputSet);
            }
Esempio n. 4
0
        public void MapWithNoRemap_EscapeLessThanSymbol()
        {
            Assert.IsTrue(_map.MapWithNoRemap("a", @"\<Home>", KeyRemapMode.Normal));
            var result = _map.GetKeyMappingResult("a", KeyRemapMode.Normal);

            Assert.AreEqual(KeyInputSetUtil.OfString("<Home>"), result.AsMapped().Item);
        }
Esempio n. 5
0
        protected void AssertMapping(KeyInputSet lhs, string expected, KeyRemapMode mode = null)
        {
            mode = mode ?? KeyRemapMode.Normal;
            var ret = _map.GetKeyMappingResult(lhs, mode);

            Assert.True(ret.IsMapped);
            Assert.Equal(KeyInputSetUtil.OfString(expected), ret.GetMappedKeyInputs());
        }
Esempio n. 6
0
            public void Ambiguous_ResolveLonger()
            {
                Assert.True(_map.MapWithNoRemap("aa", "foo", KeyRemapMode.Normal));
                Assert.True(_map.MapWithNoRemap("aaa", "bar", KeyRemapMode.Normal));
                var ret = _map.GetKeyMappingResult("aaa", KeyRemapMode.Normal);

                Assert.True(ret.IsMapped);
                Assert.Equal(KeyInputSetUtil.OfString("bar"), ret.AsMapped().Item);
            }
Esempio n. 7
0
            public void Ambiguous_ResolveLonger()
            {
                Assert.True(_map.AddKeyMapping("aa", "foo", allowRemap: false, KeyRemapMode.Normal));
                Assert.True(_map.AddKeyMapping("aaa", "bar", allowRemap: false, KeyRemapMode.Normal));
                var ret = _map.Map("aaa", KeyRemapMode.Normal);

                Assert.True(ret.IsMapped);
                Assert.Equal(KeyInputSetUtil.OfString("bar"), ret.AsMapped().KeyInputSet);
            }
Esempio n. 8
0
        protected void AssertPartialMapping(KeyInputSet lhs, string expectedMapped, string expectedRemaining, KeyRemapMode mode = null)
        {
            mode = mode ?? KeyRemapMode.Normal;
            var ret = _map.GetKeyMappingResult(lhs, mode);

            Assert.True(ret.IsPartiallyMapped);

            var partiallyMapped = ret.AsPartiallyMapped();

            Assert.Equal(KeyInputSetUtil.OfString(expectedMapped), partiallyMapped.Item1);
            Assert.Equal(KeyInputSetUtil.OfString(expectedRemaining), partiallyMapped.Item2);
        }
Esempio n. 9
0
 protected static void AssertMany(string input, string result)
 {
     AssertMany(input, KeyInputSetUtil.OfString(result));
 }
Esempio n. 10
0
 protected void AssertPartialMapping(string lhs, string expectedMapped, string expectedRemaining, KeyRemapMode mode = null)
 {
     AssertPartialMapping(KeyInputSetUtil.OfString(lhs), expectedMapped, expectedRemaining, mode);
 }