Fix prefix 0s after deleting decimal point (#825)
This commit is contained in:
parent
a21b4a2d1a
commit
9e52256196
@ -231,6 +231,10 @@ void CalcInput::Backspace()
|
||||
if (!m_base.IsEmpty())
|
||||
{
|
||||
m_base.value.pop_back();
|
||||
if (m_base.value == L"0")
|
||||
{
|
||||
m_base.value.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_base.value.size() <= m_decPtIndex)
|
||||
|
@ -184,6 +184,17 @@ public void Operator_Delete()
|
||||
Assert.AreEqual("-1,234", page.GetCalculatorResultText());
|
||||
}
|
||||
|
||||
// Issue #817: Prefixed multiple zeros
|
||||
[TestMethod]
|
||||
public void Operator_Delete_Prefix_Zeros()
|
||||
{
|
||||
page.StandardOperators.NumberPad.Input(0.1); // To enter decimal point
|
||||
page.StandardOperators.BackSpaceButton.Click();
|
||||
page.StandardOperators.BackSpaceButton.Click();
|
||||
page.StandardOperators.NumberPad.Input(0);
|
||||
Assert.AreEqual("0", page.GetCalculatorResultText());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Operator_ClearAll()
|
||||
{
|
||||
|
@ -252,6 +252,16 @@ namespace CalculatorEngineTests
|
||||
m_calcInput.Backspace();
|
||||
VERIFY_ARE_EQUAL(L"1.2", m_calcInput.ToString(10), L"Verify input after backspace.");
|
||||
}
|
||||
// Issue #817: Prefixed multiple zeros
|
||||
TEST_METHOD(BackspaceZeroDecimalWithoutPrefixZeros)
|
||||
{
|
||||
m_calcInput.TryAddDigit(0, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryAddDecimalPt();
|
||||
VERIFY_ARE_EQUAL(L"0.", m_calcInput.ToString(10), L"Verify input before backspace.")
|
||||
m_calcInput.Backspace();
|
||||
m_calcInput.TryAddDigit(0, 10, false, L"999", 64, 32);
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10), L"Verify input after backspace.")
|
||||
}
|
||||
|
||||
TEST_METHOD(SetDecimalSymbol)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user