public void MathInputButtonsHaveTransparentBackgroundByDefault(MathKeyboardInput mathKeyboardInput) { var mathInputButton = new MathInputButton { Input = mathKeyboardInput }; Assert.Equal(Color.Transparent, mathInputButton.BackgroundColor); }
public void AllMathInputButtonsHaveLatexContent(MathKeyboardInput mathKeyboardInput) { var mathInputButton = new MathInputButton { Input = mathKeyboardInput }; Assert.False(string.IsNullOrEmpty(mathInputButton.Content?.LaTeX)); }
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); }
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); }
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); }
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); } }
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}{😀}"); }
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}{■}"); }
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); }
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}{😐}"); }
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()); }
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}{😐}"); }
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()); }