properly update formula after first operation
This commit is contained in:
parent
be0dea16ae
commit
c8a10cd466
|
@ -158,7 +158,7 @@ public class MainActivityTest {
|
||||||
press(R.id.btn_2);
|
press(R.id.btn_2);
|
||||||
press(R.id.btn_equals);
|
press(R.id.btn_equals);
|
||||||
checkResult("2");
|
checkResult("2");
|
||||||
checkFormula("");
|
checkFormula("0+2");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -98,12 +98,8 @@ class CalculatorImpl(calculator: Calculator, val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun calculateResult() {
|
private fun calculateResult() {
|
||||||
if (!mIsFirstOperation) {
|
updateFormula()
|
||||||
updateFormula()
|
|
||||||
}
|
|
||||||
|
|
||||||
val operation = OperationFactory.forId(mLastOperation!!, mBaseValue, mSecondValue)
|
val operation = OperationFactory.forId(mLastOperation!!, mBaseValue, mSecondValue)
|
||||||
|
|
||||||
if (operation != null) {
|
if (operation != null) {
|
||||||
updateResult(operation.getResult())
|
updateResult(operation.getResult())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue