Example #1
0
        void Walk(KeyLayout key)
        {
            var character = key as CharacterKeyLayout;

            if (character != null)
            {
                var unshifted = character.Value ?? character.Caption;
                _keystrokes.Add(KeyboardHost.AutoEscape(unshifted));
                KeystrokeCasesTest.CheckCovered(unshifted);

                var shifted = character.ShiftValue ?? character.ShiftCaption ?? (unshifted.ToUpperInvariant() != unshifted ? unshifted.ToUpperInvariant() : unshifted);
                _keystrokes.Add(KeyboardHost.AutoEscape(shifted));
                KeystrokeCasesTest.CheckCovered(shifted);

                switch (unshifted)
                {
                case "{HOME}":
                case "{END}":
                case "{LEFT}":
                case "{RIGHT}":
                    Assert.AreEqual("+" + unshifted, shifted, "Special case shifts");
                    break;
                }
            }
            else
            {
                var group = key as ConditionalGroupLayout;
                if (group != null)
                {
                    foreach (var conditional in group.Conditionals)
                    {
                        foreach (var childKey in conditional.Keys)
                        {
                            Walk(childKey);
                        }
                    }
                }
            }
        }
        internal static void CheckCovered(string keystrokeValue)
        {
            var escapedKeystrokeValue = KeyboardHost.AutoEscape(keystrokeValue);

            Assert.IsTrue(strokeToSlice.ContainsKey(escapedKeystrokeValue), "Tested keystroke");
        }
        static void Simple(string keystroke)
        {
            var escapedKeystroke = KeyboardHost.AutoEscape(keystroke);

            strokeToSlice.Add(escapedKeystroke, new TextSlice("AB C" + keystroke + "D EF", Before.Start + keystroke.Length, 0, true));
        }