Beispiel #1
0
        public void PrepareEZLayout_ProcessModifiers(bool leftAlt,
                                                     bool leftCtrl,
                                                     bool leftShift,
                                                     bool leftWin,
                                                     bool rightAlt,
                                                     bool rightCtrl,
                                                     bool rightShift,
                                                     bool rightWin,
                                                     string expectedSubLabel,
                                                     KeyDisplayType expectedDisplayType)
        {
            // Arrange
            var modifiers = new ErgodoxModifiers
            {
                LeftAlt    = leftAlt,
                LeftCtrl   = leftCtrl,
                LeftShift  = leftShift,
                LeftWin    = leftWin,
                RightAlt   = rightAlt,
                RightCtrl  = rightCtrl,
                RightShift = rightShift,
                RightWin   = rightWin
            };
            var ergodoxKey = new ErgodoxKey()
            {
                GlowColor = "", Code = "KC_A", Modifiers = modifiers
            };
            ErgodoxLayout ergodoxLayout = InitializeDataTree();

            ergodoxLayout.Revision.Layers.First().Keys.Add(ergodoxKey);

            EZLayout ezLayoutResult;

            // Act
            var ezLayoutMaker = new EZLayoutMaker();

            ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);

            // Assert
            Assert.Single(ezLayoutResult.EZLayers);
            Assert.Single(ezLayoutResult.EZLayers.First().EZKeys);
            var keyResult = ezLayoutResult.EZLayers.First().EZKeys.First();

            Assert.Equal("A", keyResult.Label.Content);

            if (expectedDisplayType == KeyDisplayType.SimpleLabel)
            {
                Assert.Null(keyResult.Modifier);
            }
            else
            {
                Assert.Equal(expectedSubLabel, keyResult.Modifier.Content);
                Assert.False(keyResult.Modifier.IsGlyph);
            }

            Assert.Equal(expectedDisplayType, keyResult.DisplayType);
        }
Beispiel #2
0
        public void PrepareEZLayout_KeyCategoryLayerShortcut(string keyCode,
                                                             string command,
                                                             string expectedLabel,
                                                             string expectedSubLabel,
                                                             KeyDisplayType expectedDisplayType,
                                                             KeyCategory expectedCategory)
        {
            // Arrange
            var ergodoxKey = new ErgodoxKey()
            {
                GlowColor = "", Code = keyCode, Command = command, Layer = 1
            };
            ErgodoxLayout ergodoxLayout = InitializeDataTree();

            ergodoxLayout.Revision.Layers.First().Keys.Add(ergodoxKey);

            EZLayout ezLayoutResult;

            // Act
            var ezLayoutMaker = new EZLayoutMaker();

            ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);

            // Assert
            Assert.Single(ezLayoutResult.EZLayers);
            Assert.Single(ezLayoutResult.EZLayers.First().EZKeys);
            var keyResult = ezLayoutResult.EZLayers.First().EZKeys.First();

            Assert.Equal(expectedLabel, keyResult.Label.Content);

            if (expectedDisplayType == KeyDisplayType.SimpleLabel)
            {
                Assert.Null(keyResult.Modifier);
            }
            else
            {
                Assert.Equal(expectedSubLabel, keyResult.Modifier.Content);
                Assert.False(keyResult.Modifier.IsGlyph);
            }

            Assert.Equal(expectedCategory, keyResult.KeyCategory);
        }
Beispiel #3
0
        public void PrepareEZLayout_KeyCategoryWithGlyphs(string keyCode, string expectedLabel, KeyDisplayType expectedDisplayType, KeyCategory expectedCategory, bool expectedIsGlyph)
        {
            // Arrange
            var ergodoxKey = new ErgodoxKey()
            {
                GlowColor = "", Code = keyCode
            };
            ErgodoxLayout ergodoxLayout = InitializeDataTree();

            ergodoxLayout.Revision.Layers.First().Keys.Add(ergodoxKey);

            EZLayout ezLayoutResult;

            // Act
            var ezLayoutMaker = new EZLayoutMaker();

            ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);

            // Assert
            Assert.Single(ezLayoutResult.EZLayers);
            Assert.Single(ezLayoutResult.EZLayers.First().EZKeys);
            var keyResult = ezLayoutResult.EZLayers.First().EZKeys.First();

            Assert.Equal(expectedLabel, keyResult.Label.Content);
            Assert.Equal(expectedIsGlyph, keyResult.Label.IsGlyph);
            Assert.Equal(expectedDisplayType, keyResult.DisplayType);
            Assert.Equal(expectedCategory, keyResult.KeyCategory);
        }