← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-test into lp:ubuntu-calculator-app

 

Bartosz Kosiorek has proposed merging lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-test into lp:ubuntu-calculator-app.

Commit message:
Add test for physical keyboard (LP: #1442794)

Requested reviews:
  Ubuntu Calculator Developers (ubuntu-calculator-dev)
Related bugs:
  Bug #1442794 in Ubuntu Calculator App: "[Autopilot] Need test of keyboard support"
  https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1442794

For more details, see:
https://code.launchpad.net/~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-test/+merge/264458

Add test for physical keyboard (LP: #1442794)
-- 
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-test into lp:ubuntu-calculator-app.
=== modified file 'debian/changelog'
--- debian/changelog	2015-07-09 20:48:21 +0000
+++ debian/changelog	2015-07-10 21:08:51 +0000
@@ -19,12 +19,19 @@
   [ Victor Thompson ]
   * Change favorites translatable string (LP: #1464463)
 
+<<<<<<< TREE
   [ Bartosz Kosiorek ]
   * Fix calculator name in the store (LP: #1472559)
   * Allow add comma without number (LP: #1465979)
   * Fix confusing error messages (LP: #1469533)
 
  -- Bartosz Kosiorek <gang65@xxxxxxxxxxxxxx>  Thu, 09 Jul 2015 22:41:57 +0200
+=======
+  [ Bartosz Kosiorek ]
+  * Add test for physical keyboard (LP: #1442794)
+
+ -- Bartosz Kosiorek <gang65@xxxxxxxxxxxxxx>  Fri, 10 Jul 2015 23:06:05 +0200
+>>>>>>> MERGE-SOURCE
 
 ubuntu-calculator-app (2.0.182) vivid; urgency=medium
   * Add haptic feedback to buttons

=== modified file 'tests/autopilot/ubuntu_calculator_app/__init__.py'
--- tests/autopilot/ubuntu_calculator_app/__init__.py	2015-06-23 21:17:39 +0000
+++ tests/autopilot/ubuntu_calculator_app/__init__.py	2015-07-10 21:08:51 +0000
@@ -177,3 +177,19 @@
 
         # TODO: Find a better implementation to avoid this, if possible.
         sleep(2)
+
+    def enter_text_via_keyboard(self, textToEnter):
+        """Enter specific formula with keyboard
+
+        :param text: text to enter via keyboard
+
+        """
+        ubuntuuitoolkit.get_keyboard().type(textToEnter, delay=0.1)
+
+    def press_and_release_key(self, keyToPress):
+        """Press and release specific key
+
+        :param keyToPress: key to press
+
+        """
+        ubuntuuitoolkit.get_keyboard().press_and_release(keyToPress, delay=0.1)

=== modified file 'tests/autopilot/ubuntu_calculator_app/tests/test_main.py'
--- tests/autopilot/ubuntu_calculator_app/tests/test_main.py	2015-07-04 20:07:48 +0000
+++ tests/autopilot/ubuntu_calculator_app/tests/test_main.py	2015-07-10 21:08:51 +0000
@@ -13,6 +13,22 @@
     def setUp(self):
         super(MainTestCase, self).setUp()
 
+    def test_simple_calculation_via_keyboard(self):
+        self.app.main_view.enter_text_via_keyboard('.9')
+        self._assert_result_is(u'0.9')
+
+        self.app.main_view.enter_text_via_keyboard('*9/')
+        self._assert_result_is(u'8.1÷')
+
+        self.app.main_view.enter_text_via_keyboard('.3=')
+        self._assert_result_is(u'27')
+        self._assert_history_contains(u'0.9×9÷0.3=27')
+
+        self.app.main_view.enter_text_via_keyboard('+3')
+        self.app.main_view.press_and_release_key('Enter')
+        self._assert_result_is(u'30')
+        self._assert_history_contains(u'0.9×9÷0.3=27')
+
     def test_add_operator_after_result(self):
         self.app.main_view.insert('9*9=')
 


Follow ups