Merge lp:~gang65/ubuntu-calculator-app/reboot_fix_temporary_result into lp:ubuntu-calculator-app

Proposed by Bartosz Kosiorek
Status: Merged
Approved by: Bartosz Kosiorek
Approved revision: 60
Merged at revision: 58
Proposed branch: lp:~gang65/ubuntu-calculator-app/reboot_fix_temporary_result
Merge into: lp:ubuntu-calculator-app
Diff against target: 122 lines (+33/-20)
3 files modified
app/engine/math.js (+1/-1)
app/tests/autopilot/ubuntu_calculator_app/__init__.py (+6/-4)
app/tests/autopilot/ubuntu_calculator_app/tests/test_main.py (+26/-15)
To merge this branch: bzr merge lp:~gang65/ubuntu-calculator-app/reboot_fix_temporary_result
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Andrea Cerisara (community) Approve
Review via email: mp+246047@code.launchpad.net

Commit message

Fix temporarly result and add new autopilot tests to cover that

Description of the change

Fix temporarly result and add new autopilot tests to cover that.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Cerisara (acerisara) wrote :

Assuming it is fine to switch back from bignumber to number, looks good to me.

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/engine/math.js'
2--- app/engine/math.js 2014-12-24 22:10:30 +0000
3+++ app/engine/math.js 2015-01-10 21:38:55 +0000
4@@ -115,7 +115,7 @@
5 matrix: 'matrix',
6
7 // type of default number output. Choose 'number' (default) or 'bignumber'
8- number: 'bignumber',
9+ number: 'number',
10
11 // number of significant digits in BigNumbers
12 precision: 64,
13
14=== modified file 'app/tests/autopilot/ubuntu_calculator_app/__init__.py'
15--- app/tests/autopilot/ubuntu_calculator_app/__init__.py 2015-01-06 19:52:00 +0000
16+++ app/tests/autopilot/ubuntu_calculator_app/__init__.py 2015-01-10 21:38:55 +0000
17@@ -66,10 +66,12 @@
18 """Calculator MainView Autopilot emulator."""
19
20 BUTTONS = {'clear': 'clearButton', '*': 'multiplyButton',
21- '8': 'eightButton', '9': 'nineButton', '=': 'equalsButton',
22- '+': 'plusButton', '1': 'oneButton', '0': 'zeroButton',
23- '/': 'divideButton', '.': 'pointButton', '2': 'twoButton',
24- '5': 'fiveButton', '6': 'sixButton', '-': 'minusButton'}
25+ '/': 'divideButton', '.': 'pointButton',
26+ '=': 'equalsButton', '-': 'minusButton', '+': 'plusButton',
27+ '0': 'zeroButton', '1': 'oneButton', '2': 'twoButton',
28+ '3': 'threeButton', '4': 'fourButton', '5': 'fiveButton',
29+ '6': 'sixButton', '7': 'sevenButton', '8': 'eightButton',
30+ '9': 'nineButton'}
31
32 def __init__(self, *args):
33 super(MainView, self).__init__(*args)
34
35=== modified file 'app/tests/autopilot/ubuntu_calculator_app/tests/test_main.py'
36--- app/tests/autopilot/ubuntu_calculator_app/tests/test_main.py 2015-01-05 20:44:51 +0000
37+++ app/tests/autopilot/ubuntu_calculator_app/tests/test_main.py 2015-01-10 21:38:55 +0000
38@@ -13,50 +13,61 @@
39 def setUp(self):
40 super(MainTestCase, self).setUp()
41
42+ def test_temporarly_result(self):
43+ self.app.main_view.insert('2450.1*369+')
44+
45+ self._assert_result_is(u'904086.9+')
46+ self.app.main_view.insert('3.1=')
47+
48+ self._assert_result_is(u'904090')
49+ self._assert_history_contains(u'2450.1×369+3.1=9.0409e+5')
50+
51 def test_operation_after_clear(self):
52 self.app.main_view.insert('8*8=')
53
54- self._assert_result_is('64')
55- self._assert_history_contains('8×8=64')
56+ self._assert_result_is(u'64')
57+ self._assert_history_contains(u'8×8=64')
58
59 self.app.main_view.clear()
60 self.app.main_view.insert('9*9=')
61
62- self._assert_result_is('81')
63- self._assert_history_contains('9×9=81')
64+ self._assert_result_is(u'81')
65+ self._assert_history_contains(u'9×9=81')
66
67 def test_small_numbers(self):
68 self.app.main_view.insert('0.000000001+1=')
69- self._assert_result_is('1.000000001')
70+ self._assert_result_is(u'1.000000001')
71+ self._assert_history_contains(u'0.000000001+1=1.000000001')
72
73 self.app.main_view.clear()
74
75 self.app.main_view.insert('0.000000001/10=')
76- self._assert_result_is('1e−10')
77+ self._assert_result_is(u'1e−10')
78+ self._assert_history_contains(u'0.000000001÷10=1e-10')
79
80 def test_operators_precedence(self):
81 self.app.main_view.insert('2+2*2=')
82
83- self._assert_result_is('6')
84- self._assert_history_contains('2+2×2=6')
85+ self._assert_result_is(u'6')
86+ self._assert_history_contains(u'2+2×2=6')
87
88 self.app.main_view.clear()
89 self.app.main_view.insert('2-2*2=')
90
91- self._assert_result_is('−2')
92- self._assert_history_contains('2−2×2=-2')
93+ self._assert_result_is(u'−2')
94+ self._assert_history_contains(u'2−2×2=-2')
95
96 self.app.main_view.clear()
97 self.app.main_view.insert('5+6/2=')
98
99- self._assert_result_is('8')
100- self._assert_history_contains('5+6÷2=8')
101+ self._assert_result_is(u'8')
102+ self._assert_history_contains(u'5+6÷2=8')
103
104 def test_divide_with_zero(self):
105 self.app.main_view.insert('0/5=')
106
107- self._assert_result_is('0')
108- self._assert_history_contains('0÷5=0')
109+ self._assert_result_is(u'0')
110+ self._assert_history_contains(u'0÷5=0')
111
112 def test_divide_by_zero(self):
113 self.app.main_view.insert('5/0=')
114@@ -67,7 +78,7 @@
115 def test_divide_zero_by_zero(self):
116 self.app.main_view.insert('0/0=')
117
118- self._assert_result_is("NaN")
119+ self._assert_result_is(u"NaN")
120 self._assert_history_contains(u'0÷0=NaN')
121
122 def _assert_result_is(self, value):

Subscribers

People subscribed via source and target branches