Skip to content

Commit bee355a

Browse files
authored
Fix the broken decimal key (#2038)
1 parent 4ba5365 commit bee355a

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

src/Calculator/Views/NumberPad.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@
110110
AutomationProperties.AutomationId="num9Button"
111111
AutomationProperties.Name="{utils:ResourceString Name=num9Button/[using:Windows.UI.Xaml.Automation]AutomationProperties/Name}"
112112
ButtonId="Nine"/>
113+
<!-- DO NOT REMOVE the common:KeyboardShortcutManager.Character from this element, it's value will be overwritten by the KeyboardShortcutManager -->
113114
<controls:CalculatorButton x:Name="DecimalSeparatorButton"
114115
Grid.Row="3"
115116
Grid.Column="2"
116117
Style="{Binding ElementName=ControlRoot, Path=ButtonStyle}"
118+
common:KeyboardShortcutManager.Character="."
117119
common:KeyboardShortcutManager.VirtualKey="{utils:ResourceVirtualKey Name=decimalSeparatorButton/[using:CalculatorApp.Common]KeyboardShortcutManager/VirtualKey}"
118120
AutomationProperties.AutomationId="decimalSeparatorButton"
119121
AutomationProperties.Name="{utils:ResourceString Name=decimalSeparatorButton/[using:Windows.UI.Xaml.Automation]AutomationProperties/Name}"

src/CalculatorUITests/StandardModeFunctionalTests.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,8 @@ public void KeyboardInput_InvertSquaredSevenEightNine()
316316
Assert.AreEqual("square (9)", page.CalculatorResults.GetCalculatorExpressionText()); //verifies squared hotkey
317317
}
318318

319-
// Ignore this test and add a new test KeyboardInput_PercentSquareRootBackspaceNegateOneZero below
320-
// to avoid the issue of decimal keyboard input
321319
[TestMethod]
322320
[Priority(1)]
323-
[Ignore]
324321
public void KeyboardInput_PercentSquareRootBackspaceDecimalNegateOneZero()
325322
{
326323
//Verifies the %, square root, backspace, decimal, negate, 1, and 0 button
@@ -348,34 +345,6 @@ public void KeyboardInput_PercentSquareRootBackspaceDecimalNegateOneZero()
348345
Assert.AreEqual("9.9", page.CalculatorResults.GetCalculatorResultText()); //verifies calculation with decimal point and negative number
349346
}
350347

351-
[TestMethod]
352-
[Priority(1)]
353-
public void KeyboardInput_PercentSquareRootBackspaceNegateOneZero()
354-
{
355-
//Verifies the %, square root, backspace, negate, 1, and 0 button
356-
CalculatorApp.EnsureCalculatorHasFocus();
357-
CalculatorApp.Window.SendKeys("100");
358-
CalculatorApp.Window.SendKeys(Keys.Backspace);
359-
Assert.AreEqual("10", page.CalculatorResults.GetCalculatorResultText()); // verifies using the 1 key, the 0 key, and the backspace key
360-
CalculatorApp.Window.SendKeys(Keys.Add);
361-
CalculatorApp.EnsureCalculatorHasFocus();
362-
CalculatorApp.Window.SendKeys(Keys.Shift + "5" + Keys.Shift);
363-
Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText()); //verifies percent calculation
364-
Assert.AreEqual("10 + 1", page.CalculatorResults.GetCalculatorExpressionText()); //verifies percent hotkey
365-
CalculatorApp.Window.SendKeys(Keys.Shift);
366-
CalculatorApp.Window.SendKeys(Keys.Shift + "5" + Keys.Shift);
367-
CalculatorApp.Window.SendKeys(Keys.Shift);
368-
CalculatorApp.Window.SendKeys(Keys.Shift + "2" + Keys.Shift);
369-
Assert.AreEqual("0.3162277660168379", page.CalculatorResults.GetCalculatorResultText()); //verifies square root calculation
370-
Assert.AreEqual("10 + √(0.1)", page.CalculatorResults.GetCalculatorExpressionText()); //verifies 2√x hotkey
371-
CalculatorApp.Window.SendKeys("1");
372-
CalculatorApp.Window.SendKeys(Keys.Shift + "5" + Keys.Shift);
373-
CalculatorApp.Window.SendKeys(Keys.F9);
374-
Assert.AreEqual("-0.1", page.CalculatorResults.GetCalculatorResultText()); //verifies negate hotkey
375-
page.StandardOperators.EqualButton.Click();
376-
Assert.AreEqual("9.9", page.CalculatorResults.GetCalculatorResultText()); //verifies calculation with decimal point and negative number
377-
}
378-
379348
[TestMethod]
380349
[Priority(1)]
381350
public void KeyboardInput_MemoryHotkeys()

0 commit comments

Comments
 (0)