ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #02825
Re: [Merge] lp:~nskaggs/ubuntu-calculator-app/fix-testability into lp:ubuntu-calculator-app
Review: Needs Fixing
Nice improvement.
I think you forget to uncomment one "objectName:".
Please take a look at inline comment.
Diff comments:
> === modified file 'app/ui/Screen.qml'
> --- app/ui/Screen.qml 2015-03-12 21:21:47 +0000
> +++ app/ui/Screen.qml 2015-06-15 22:22:34 +0000
> @@ -23,6 +23,7 @@
>
> ListItemWithActions {
> id: root
> + objectName: "screenroot" + model.index
>
> function formatDate(date) {
> var now = new Date();
> @@ -89,6 +90,7 @@
> }
> Row {
> id: calculationRow
> + objectName: "historyrow"
> width: parent.width
> anchors.right: parent.right
>
> @@ -97,7 +99,7 @@
>
> Text {
> id: result
> - objectName: "result"
> + objectName: "result" + model.index
>
> anchors.bottom: formula.bottom
>
> @@ -110,6 +112,7 @@
>
> Text {
> id: equal
> + //objectName: "equal" + model.index
Why this line was commented ?
If it is not needed then just remove it.
>
> anchors.bottom: formula.bottom
>
> @@ -122,7 +125,7 @@
>
> Text {
> id: formula
> - objectName: "formula"
> + objectName: "formula" + model.index
>
> width: parent.width - equal.width - result.width
> anchors.bottom: parent.bottom
>
> === modified file 'tests/autopilot/ubuntu_calculator_app/__init__.py'
> --- tests/autopilot/ubuntu_calculator_app/__init__.py 2015-06-12 10:07:20 +0000
> +++ tests/autopilot/ubuntu_calculator_app/__init__.py 2015-06-15 22:22:34 +0000
> @@ -42,25 +42,43 @@
> def contains(self, entry):
> found = False
>
> - calculations = self.app.select_many('QQuickRectangle',
> - objectName='mainItem')
> -
> - for calculation in calculations:
> - if entry.strip() == self._get_entry(calculation):
> + history = self.get_all_history_entries()
> + for line in history:
> + calculation = self._get_entry(line)
> + if calculation == entry.strip():
> found = True
> + break
>
> return found
>
> - def _get_entry(self, calc):
> - return self._get_formula(calc) + '=' + self._get_result(calc)
> -
> - def _get_formula(self, calc):
> - return calc.wait_select_single('QQuickText',
> - objectName='formula').text.strip()
> -
> - def _get_result(self, calc):
> - return calc.wait_select_single('QQuickText',
> - objectName='result').text.strip()
> + def get_all_history_entries(self):
> + return self.app.select_many('QQuickRow', objectName='historyrow')
> +
> + def get_history_entry(self, entry):
> + return self.app.select_single('QQuickText',
> + objectName='result' + str(entry))
> +
> + def get_formula_entry(self, entry=0):
> + return self.app.select_single('QQuickText',
> + objectName='formula' + str(entry))
> +
> + def get_formula_value(self, entry=0):
> + return self.get_formula_entry(entry).text.strip()
> +
> + def get_result_value(self, entry=0):
> + return self.get_history_entry(entry).text.strip()
> +
> + def _get_entry(self, line):
> + values = line.select_many('QQuickText')
> + result = ''
> + formula = ''
> + for value in values:
> + if 'result' in value.objectName:
> + result = value.text.strip()
> + elif 'formula' in value.objectName:
> + formula = value.text.strip()
> +
> + return formula + '=' + result
>
>
> class MainView(ubuntuuitoolkit.MainView):
>
> === modified file 'tests/autopilot/ubuntu_calculator_app/tests/__init__.py'
> --- tests/autopilot/ubuntu_calculator_app/tests/__init__.py 2015-04-30 08:33:46 +0000
> +++ tests/autopilot/ubuntu_calculator_app/tests/__init__.py 2015-06-15 22:22:34 +0000
> @@ -97,7 +97,7 @@
> os.path.expanduser('~'),
> '.local',
> 'share',
> - 'com.ubuntu.calculator_reboot'
> + 'com.ubuntu.calculator'
> )
>
> if os.path.exists(calculator_database_path):
>
--
https://code.launchpad.net/~nskaggs/ubuntu-calculator-app/fix-testability/+merge/262019
Your team Ubuntu Calculator Developers is subscribed to branch lp:ubuntu-calculator-app.
Follow ups
References