コード例 #1
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void MathInputButtonsHaveTransparentBackgroundByDefault(MathKeyboardInput mathKeyboardInput)
        {
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput
            };

            Assert.Equal(Color.Transparent, mathInputButton.BackgroundColor);
        }
コード例 #2
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void AllMathInputButtonsHaveLatexContent(MathKeyboardInput mathKeyboardInput)
        {
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput
            };

            Assert.False(string.IsNullOrEmpty(mathInputButton.Content?.LaTeX));
        }
コード例 #3
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void MathInputButtonsHaveBlackTextColorByDefault(MathKeyboardInput mathKeyboardInput)
        {
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput
            };

            // At the time of writing this test, phatom = @"{\color{#00FFFFFF}{|}}" (Xamarin.Forms.Color.Transparent = "#00FFFFFF") is used as there is no \phantom command yet.
            // As soon as \phantom has been implemented, the call .Replace(LatexHelper.phantom, "") can be removed.
            Assert.DoesNotContain(@"\color", mathInputButton.Content.NotNull().LaTeX.NotNull().Replace(LatexHelper.phantom, ""));
            Assert.Equal(Color.Black, mathInputButton.TextColor);
        }
コード例 #4
0
ファイル: CaretTests.cs プロジェクト: yoshiask/CSharpMath
        public async Task Test(MathKeyboardInput input)
        {
            var keyboard = new MathKeyboard <TestFont, TGlyph>(TestTypesettingContexts.Instance, new TestFont())
            {
                InsertionPositionHighlighted = true
            };

            Assert.True(keyboard.ShouldDrawCaret);
            keyboard.KeyPress(input);
            Assert.False(keyboard.ShouldDrawCaret);
            await Task.Delay((int)MathKeyboard <TestFont, TGlyph> .DefaultBlinkMilliseconds + CaretBlinks.MillisecondBuffer);

            Assert.False(keyboard.ShouldDrawCaret);
        }
コード例 #5
0
ファイル: CaretTests.cs プロジェクト: kharbSachin/CSharpMath
        public async Task Test(MathKeyboardInput input)
        {
            var keyboard = new MathKeyboard <TestFont, char>(TestTypesettingContexts.Instance, new TestFont())
            {
                CaretState = MathKeyboardCaretState.Shown
            };

            Assert.Equal(MathKeyboardCaretState.Shown, keyboard.CaretState);
            keyboard.KeyPress(input);
            Assert.Equal(MathKeyboardCaretState.Hidden, keyboard.CaretState);
            await Task.Delay((int)MathKeyboard <TestFont, char> .DefaultBlinkMilliseconds + CaretBlinks.MillisecondBuffer);

            Assert.Equal(MathKeyboardCaretState.Hidden, keyboard.CaretState);
        }
コード例 #6
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void MathInputButton_Command(MathKeyboardInput mathKeyboardInput)
        {
            var mathKeyboardClassThatProcessesKeyPresses = new MathKeyboard();
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput, Keyboard = mathKeyboardClassThatProcessesKeyPresses
            };

            mathInputButton.Command.Execute(null); // Simulate a MathInputButton key press
            Assert.Equal(expectedResult(), mathKeyboardClassThatProcessesKeyPresses.LaTeX);
            string expectedResult()
            {
                var kb = new MathKeyboard();

                kb.KeyPress(mathKeyboardInput);
                return(kb.LaTeX);
            }
        }
コード例 #7
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void MathInputButtonTwoPlaceholdersWithSameNucleusColorsAreOverridable(MathKeyboardInput mathKeyboardInput)
        {
            LaTeXSettings.PlaceholderActiveNucleus = LaTeXSettings.PlaceholderRestingNucleus = "😀";
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput, PlaceholderActiveColor = Color.Black, PlaceholderRestingColor = Color.LightGray
            };

            Assert.Equal(Color.Black, mathInputButton.PlaceholderActiveColor);
            Assert.Equal(Color.LightGray, mathInputButton.PlaceholderRestingColor);
            TestTwoButtonDisplayPlaceholders(mathInputButton, @"\color{#FF000000}{😀}", @"\color{#FFD3D3D3}{😀}");
        }
コード例 #8
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void MathInputButtonTwoPlaceholdersWithSameNucleusColorsSameAsEditorOutput(MathKeyboardInput mathKeyboardInput)
        {
            LaTeXSettings.PlaceholderActiveNucleus = LaTeXSettings.PlaceholderRestingNucleus = "■";
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput
            };

            Assert.Null(mathInputButton.PlaceholderActiveColor);
            Assert.Null(mathInputButton.PlaceholderRestingColor);
            TestTwoButtonDisplayPlaceholders(mathInputButton, @"\color{green}{■}", @"\color{blue}{■}");
        }
コード例 #9
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void SameNucleusPlaceholders_MathInputButtonPlaceholderWithSinglePlaceholderIsActive(MathKeyboardInput mathKeyboardInput)
        {
            LaTeXSettings.PlaceholderActiveNucleus = LaTeXSettings.PlaceholderRestingNucleus = "■";
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput
            };

            Assert.Null(mathInputButton.PlaceholderActiveColor);
            Assert.Null(mathInputButton.PlaceholderRestingColor);
            var latex = mathInputButton.Content.NotNull().LaTeX.NotNull();

            Assert.Contains(@"\color{green}{■}", latex);
            Assert.DoesNotContain(@"\color{blue}", latex);
        }
コード例 #10
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void MathInputButtonPlaceholderColorsAreOverridableForDoublePlaceholders(MathKeyboardInput mathKeyboardInput)
        {
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput, PlaceholderActiveColor = Color.Black, PlaceholderRestingColor = Color.LightGray
            };

            Assert.Equal(Color.Black, mathInputButton.PlaceholderActiveColor);
            Assert.Equal(Color.LightGray, mathInputButton.PlaceholderRestingColor);
            TestTwoButtonDisplayPlaceholders(mathInputButton, @"\color{#FF000000}{😀}", @"\color{#FFD3D3D3}{😐}");
        }
コード例 #11
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void MathInputButtonPlaceholderColorsAreOverridableForSinglePlaceholder(MathKeyboardInput mathKeyboardInput)
        {
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput, PlaceholderActiveColor = Color.Red
            };

            Assert.Equal(Color.Red, mathInputButton.PlaceholderActiveColor);
            Assert.Null(mathInputButton.PlaceholderRestingColor);
            Assert.Contains(@"\color{#FFFF0000}{😀}", mathInputButton.Content.NotNull().LaTeX.NotNull());
        }
コード例 #12
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void MathInputButtonPlaceholdersAreSameAsEditorOutputByDefaultForDoublePlaceholders(MathKeyboardInput mathKeyboardInput)
        {
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput
            };

            Assert.Null(mathInputButton.PlaceholderActiveColor);
            Assert.Null(mathInputButton.PlaceholderRestingColor);
            TestTwoButtonDisplayPlaceholders(mathInputButton, @"\color{green}{😀}", @"\color{blue}{😐}");
        }
コード例 #13
0
ファイル: ButtonTests.cs プロジェクト: yoshiask/CSharpMath
        public void MathInputButtonPlaceholdersAreSameAsEditorOutputByDefaultForSinglePlaceholder(MathKeyboardInput mathKeyboardInput)
        {
            var mathInputButton = new MathInputButton {
                Input = mathKeyboardInput
            };

            Assert.Null(mathInputButton.PlaceholderActiveColor);
            Assert.Null(mathInputButton.PlaceholderRestingColor);
            Assert.Contains(@"\color{green}{😀}", mathInputButton.Content.NotNull().LaTeX.NotNull());
        }