← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

Review: Needs Fixing

See comment inline.

Diff comments:

> === 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')

You could also check last history result with command:
  self.assert_history_contains(u'5×5=25')
to make sure that calculation is present in history.

> +        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=')
> 


-- 
https://code.launchpad.net/~nikwen/ubuntu-calculator-app/autopilot-test-equals-doesnt-change-numbers/+merge/262794
Your team Ubuntu Calculator Developers is subscribed to branch lp:ubuntu-calculator-app.


References