ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #01089
[Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
Bartosz Kosiorek has proposed merging lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot.
Commit message:
Add validation of long string contains operator and number (example: square, cube, etc.).
Requested reviews:
Ubuntu Calculator Developers (ubuntu-calculator-dev)
For more details, see:
https://code.launchpad.net/~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number/+merge/254311
Add validation of long string contains operator and number (example: square, cube, etc.).
--
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot.
=== modified file 'app/engine/formula.js'
--- app/engine/formula.js 2015-03-12 22:05:37 +0000
+++ app/engine/formula.js 2015-03-26 21:20:56 +0000
@@ -85,8 +85,9 @@
}
function validateStringForAddingToFormula(formula, stringToAddToFormula) {
- if (isOperator(stringToAddToFormula)) {
- return couldAddOperator(formula, stringToAddToFormula);
+ // We are checking first character to validate strings with number eg. "^3"
+ if (isOperator(stringToAddToFormula[0])) {
+ return couldAddOperator(formula, stringToAddToFormula[0]);
}
if (stringToAddToFormula === ".") {
=== modified file 'app/tests/autopilot/ubuntu_calculator_app/tests/test_main.py'
--- app/tests/autopilot/ubuntu_calculator_app/tests/test_main.py 2015-03-12 22:54:25 +0000
+++ app/tests/autopilot/ubuntu_calculator_app/tests/test_main.py 2015-03-26 21:20:56 +0000
@@ -170,22 +170,36 @@
def test_divide_with_infinite_number_as_result(self):
self.app.main_view.insert('1/3=')
self._assert_result_is(u'0.3333333333333333')
+ self._assert_history_contains(u'1÷3=0.3333333333333333')
def test_operation_on_infinite_number(self):
self.app.main_view.insert('5/3=')
self._assert_result_is(u'1.6666666666666667')
+ self._assert_history_contains(u'5÷3=1.6666666666666667')
self.app.main_view.insert('-1=')
self._assert_result_is(u'0.6666666666666667')
def test_square(self):
- self.app.main_view.insert('2')
+ self.app.main_view.insert('4')
self.app.main_view.show_scientific_keyboard()
self.app.main_view.press('square')
self.app.main_view.hide_scientific_keyboard()
self.app.main_view.insert('=')
- self._assert_result_is(u'4')
+ self._assert_result_is(u'16')
+ self._assert_history_contains(u'4^2=16')
+
+ def test_adding_square_to_empty_formula(self):
+ self.app.main_view.show_scientific_keyboard()
+ self.app.main_view.press('square')
+ self._assert_result_is(u'')
+
+ def test_adding_square_after_operator(self):
+ self.app.main_view.insert('6/')
+ self.app.main_view.show_scientific_keyboard()
+ self.app.main_view.press('square')
+ self._assert_result_is(u'6÷')
def test_cube(self):
self.app.main_view.insert('3')
@@ -195,15 +209,17 @@
self.app.main_view.insert('=')
self._assert_result_is(u'27')
+ self._assert_history_contains(u'3^3=27')
def test_power(self):
self.app.main_view.insert('2')
self.app.main_view.show_scientific_keyboard()
self.app.main_view.press('power')
self.app.main_view.hide_scientific_keyboard()
- self.app.main_view.insert('3=')
+ self.app.main_view.insert('4=')
- self._assert_result_is(u'8')
+ self._assert_result_is(u'16')
+ self._assert_history_contains(u'2^4=16')
def test_loge(self):
self.app.main_view.show_scientific_keyboard()
=== modified file 'po/com.ubuntu.calculator.pot'
--- po/com.ubuntu.calculator.pot 2015-03-12 22:05:37 +0000
+++ po/com.ubuntu.calculator.pot 2015-03-26 21:20:56 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-03-12 23:05+0100\n"
+"POT-Creation-Date: 2015-03-26 22:15+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -17,7 +17,7 @@
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../app/engine/formula.js:167
+#: ../app/engine/formula.js:168
msgid "NaN"
msgstr ""
@@ -59,11 +59,21 @@
#. TRANSLATORS: this is a time formatting string, see
#. http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid
#. expressions
-#: ../app/ubuntu-calculator-app.qml:542 ../app/ui/FavouritePage.qml:80
+#: ../app/ubuntu-calculator-app.qml:542 ../app/ui/FavouritePage.qml:89
#: ../app/ui/Screen.qml:50
msgid "dd MMM yyyy"
msgstr ""
+#: ../app/ui/FavouritePage.qml:42
+msgid "No favourites"
+msgstr ""
+
+#: ../app/ui/FavouritePage.qml:43
+msgid ""
+"Swipe calculations to the left\n"
+"to mark as favourites"
+msgstr ""
+
#: ../app/ui/LandscapeKeyboard.qml:19 ../app/ui/PortraitKeyboard.qml:42
msgid "log"
msgstr ""
@@ -91,14 +101,14 @@
msgid "Yesterday"
msgstr ""
-#: /tmp/tmp.8YaHgSIjUW/po/ubuntu-calculator-app.desktop.in.in.h:1
+#: /tmp/tmp.d9b6OuAiba/po/ubuntu-calculator-app.desktop.in.in.h:1
msgid "Calculator"
msgstr ""
-#: /tmp/tmp.8YaHgSIjUW/po/ubuntu-calculator-app.desktop.in.in.h:2
+#: /tmp/tmp.d9b6OuAiba/po/ubuntu-calculator-app.desktop.in.in.h:2
msgid "A calculator for Ubuntu."
msgstr ""
-#: /tmp/tmp.8YaHgSIjUW/po/ubuntu-calculator-app.desktop.in.in.h:3
+#: /tmp/tmp.d9b6OuAiba/po/ubuntu-calculator-app.desktop.in.in.h:3
msgid "math;addition;subtraction;multiplication;division;"
msgstr ""
Follow ups
-
[Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: noreply, 2015-03-30
-
Re: [Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-30
-
[Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: Bartosz Kosiorek, 2015-03-30
-
[Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-30
-
Re: [Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-30
-
[Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: Riccardo Padovani, 2015-03-30
-
Re: [Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-30
-
[Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-30
-
[Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: Riccardo Padovani, 2015-03-30
-
Re: [Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: Riccardo Padovani, 2015-03-30
-
Re: [Merge] lp:~gang65/ubuntu-calculator-app/reboot-validation-string-contains-operator-and-number into lp:ubuntu-calculator-app/reboot
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-26