Exemplo n.º 1
0
        public void PrepareEZLayout_ColorKey(string layerColor, string keyColor, string expectedColor)
        {
            // Arrange
            var ergodoxLayer = new ErgodoxLayer {
                Color = layerColor, Keys = new List <ErgodoxKey> {
                    new ErgodoxKey {
                        GlowColor = keyColor
                    }
                }
            };
            ErgodoxLayout ergodoxLayout = new ErgodoxLayout
            {
                Title = "", HashId = "", Revision = new Revision {
                    HashId = HashId, Layers = new List <ErgodoxLayer> {
                        ergodoxLayer
                    }
                }
            };

            EZLayout ezLayoutResult;

            // Act
            var ezLayoutMaker = new EZLayoutMaker();

            ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);

            // Assert
            Assert.Equal(expectedColor, ezLayoutResult.EZLayers.First().EZKeys.First().Color);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void PrepareEZLayout_InitializeEZLayer(int expectedIndex, string expectedTitle, string expectedColor)
        {
            // Arrange
            var ergodoxLayer = new ErgodoxLayer()
            {
                Color = expectedColor, Title = expectedTitle, Position = expectedIndex, Keys = new List <ErgodoxKey>()
            };
            ErgodoxLayout ergodoxLayout = new ErgodoxLayout
            {
                Title = "", HashId = "", Revision = new Revision {
                    HashId = HashId, Layers = new List <ErgodoxLayer> {
                        ergodoxLayer
                    }
                }
            };

            EZLayout ezLayoutResult;

            // Act
            var ezLayoutMaker = new EZLayoutMaker();

            ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);

            // Assert
            Assert.Single(ezLayoutResult.EZLayers);
            Assert.Equal(expectedTitle, ezLayoutResult.EZLayers.First().Name);
            Assert.Equal(expectedIndex, ezLayoutResult.EZLayers.First().Index);
            Assert.Equal(expectedColor, ezLayoutResult.EZLayers.First().Color);
        }
Exemplo n.º 4
0
        public void PrepareEZLayout_KeyCategoryShortcuts(string keyCode, string command, string expectedLabel, KeyCategory expectedCategory)
        {
            // Arrange
            var ergodoxKey = new ErgodoxKey()
            {
                GlowColor = "", Code = keyCode, Command = command
            };
            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.Null(keyResult.Modifier);
            Assert.Equal(expectedCategory, keyResult.KeyCategory);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        /// <inheritdoc />
        public EZLayout PrepareEZLayout(ErgodoxLayout ergodoxLayout)
        {
            Logger.TraceMethod();

            var      ezLayoutMaker = new EZLayoutMaker();
            EZLayout ezLayout      = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);

            return(ezLayout);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        public void PrepareEZLayout_InitializeEZKey(string expectedKeyCode, string expectedColor)
        {
            // Arrange
            var ergodoxKey = new ErgodoxKey()
            {
                GlowColor = expectedColor, Code = expectedKeyCode
            };
            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);
            Assert.Equal(expectedColor, ezLayoutResult.EZLayers.First().EZKeys.First().Color);
        }
Exemplo n.º 9
0
        public void PrepareEZLayout_InitializeEZLayout(string expectedTitle, string expectedHashId)
        {
            // Arrange
            var revision = new Revision {
                Layers = new List <ErgodoxLayer>()
            };
            ErgodoxLayout ergodoxLayout = new ErgodoxLayout {
                Title = expectedTitle, HashId = expectedHashId, Revision = new Revision {
                    HashId = HashId
                }
            };

            ergodoxLayout.Revision = revision;
            EZLayout ezLayoutResult;

            // Act
            var ezLayoutMaker = new EZLayoutMaker();

            ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);

            // Assert
            Assert.Equal(expectedTitle, ezLayoutResult.Name);
            Assert.Equal(expectedHashId, ezLayoutResult.HashId);
        }
Exemplo n.º 10
0
        public void PrepareEZLayout_KeyCodeUnknown()
        {
            // Arrange
            var ergodoxKey = new ErgodoxKey()
            {
                GlowColor = "", Code = "KC_UNKNOWN_ADSLKFJ"
            };
            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);
            Assert.Equal("", ezLayoutResult.EZLayers.First().EZKeys.First().Label.Content);
            Assert.False(ezLayoutResult.EZLayers.First().EZKeys.First().Label.IsGlyph);
        }