← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~nikwen/ubuntu-calculator-app/autopilot-test-equals-doesnt-change-numbers into lp:ubuntu-calculator-app

 

Niklas Wenzel has proposed merging lp:~nikwen/ubuntu-calculator-app/autopilot-test-equals-doesnt-change-numbers into lp:ubuntu-calculator-app.

Commit message:
Improve test_equals_doesnt_change_numbers according to LP: #1400890

Requested reviews:
  Ubuntu Calculator Developers (ubuntu-calculator-dev)
Related bugs:
  Bug #1400890 in Ubuntu Calculator App: "[Autopilot] Need to implement test_equals_dont_change_numbers"
  https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1400890

For more details, see:
https://code.launchpad.net/~nikwen/ubuntu-calculator-app/autopilot-test-equals-doesnt-change-numbers/+merge/262794

Improve test_equals_doesnt_change_numbers according to LP: #1400890

(My first real autopilot test! \o/)
-- 
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~nikwen/ubuntu-calculator-app/autopilot-test-equals-doesnt-change-numbers into lp:ubuntu-calculator-app.
=== modified file 'tests/autopilot/ubuntu_calculator_app/__init__.py'
--- tests/autopilot/ubuntu_calculator_app/__init__.py	2015-06-16 15:11:50 +0000
+++ tests/autopilot/ubuntu_calculator_app/__init__.py	2015-06-23 21:19:18 +0000
@@ -54,6 +54,9 @@
     def get_all_history_entries(self):
         return self.app.select_many('QQuickRow', objectName='historyrow')
 
+    def get_history_entry_count(self):
+        return len(self.get_all_history_entries())
+
     def get_history_entry(self, entry):
         return self.app.select_single('QQuickText',
                                       objectName='result' + str(entry))

=== modified file 'tests/autopilot/ubuntu_calculator_app/tests/test_main.py'
--- tests/autopilot/ubuntu_calculator_app/tests/test_main.py	2015-04-26 22:41:49 +0000
+++ tests/autopilot/ubuntu_calculator_app/tests/test_main.py	2015-06-23 21:19:18 +0000
@@ -173,11 +173,17 @@
         self._assert_history_contains(u'0÷0=NaN')
 
     def test_equals_doesnt_change_numbers(self):
-        self.app.main_view.insert('125')
-        self._assert_result_is(u'125')
-
-        self.app.main_view.insert('=')
-        self._assert_result_is(u'125')
+        count_one = self.app.main_view.get_history().get_history_entry_count()
+
+        self.app.main_view.insert('5*5=')
+        self._assert_result_is(u'25')
+        count_two = self.app.main_view.get_history().get_history_entry_count()
+        self.assertTrue(count_one == count_two - 1)
+
+        self.app.main_view.insert('===')
+        self._assert_result_is(u'25')
+        count_three = self.app.main_view.get_history().get_history_entry_count()
+        self.assertTrue(count_two == count_three)
 
     def test_divide_with_infinite_number_as_result(self):
         self.app.main_view.insert('1/3=')


Follow ups