Merge lp:~roignac/mago/gcalctool into lp:~mago-contributors/mago/mago-testsuite

Proposed by Vadim Rutkovsky
Status: Needs review
Proposed branch: lp:~roignac/mago/gcalctool
Merge into: lp:~mago-contributors/mago/mago-testsuite
Diff against target: 735 lines (+725/-0)
2 files modified
gnome-calculator/mago_gcalctool.py (+171/-0)
gnome-calculator/test_gnome-calculator.py (+554/-0)
To merge this branch: bzr merge lp:~roignac/mago/gcalctool
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement Pending
Mago Contributors Pending
Review via email: mp+70711@code.launchpad.net

Description of the change

The branch contains tests for Gnome Calculator (smoke test cases + several regression checks)

To post a comment you must log in.
lp:~roignac/mago/gcalctool updated
41. By Vadim Rutkovsky

Added classfile

Unmerged revisions

41. By Vadim Rutkovsky

Added classfile

40. By Vadim Rutkovsky

Added test for bug 302115

39. By Vadim Rutkovsky

Added test for bug 288446

38. By Vadim Rutkovsky

Added input_from_keyboard function

37. By Vadim Rutkovsky

Clean up, added more tests

36. By Vadim Rutkovsky

* Moved object definition to mago_gnome-calculator.py
* Added cases bug515280 and bug499211

35. By Vadim Rutkovsky

Refactored cases

34. By Vadim Rutkovsky

Added case for lp:#204682

33. By Vadim Rutkovsky

Added case for lp:#32200

32. By Vadim Rutkovsky

Added case for lp:#28928

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'gnome-calculator'
=== added file 'gnome-calculator/mago_gcalctool.py'
--- gnome-calculator/mago_gcalctool.py 1970-01-01 00:00:00 +0000
+++ gnome-calculator/mago_gcalctool.py 2011-08-08 09:54:34 +0000
@@ -0,0 +1,171 @@
1#!/usr/bin/ipython
2# -*- coding: utf-8 -*-
3# Copyright (C) 2010 Canonical Ltd
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19import ldtp, ooldtp
20
21class GnomeCalculator():
22 menu = {
23 'Calculator' : {
24 'Menu' : 'mnuCalculator',
25 'Copy' : 'mnuCopy',
26 'Paste' : 'mnuPaste',
27 'Undo' : 'mnuUndo',
28 'Preferences': 'mnuPreferences',
29 'Quit' : 'mnuQuit',
30 },
31 'Mode' : {
32 'Menu' : 'mnuMode',
33 'Basic' : 'mnuBasic',
34 'Advanced' : 'mnuAdvanced',
35 'Financial' : 'mnuFinancial',
36 'Programming': 'mnuProgramming'
37 },
38 'Help' : {
39 'Menu' : 'mnuHelp',
40 'Contents' : 'mnuContents',
41 'Get Help Online' : 'mnuGetHelpOnline',
42 'Translate' : 'mnuTranslateThisApplication',
43 'Report a Problem': 'mnuReportaProblem',
44 'About' : 'mnuAbout'
45 }
46 }
47
48 controls = {
49 'Output' : 'txt0',
50 'Error' : 'txt1',
51 '1' : 'btn1',
52 '2' : 'btn2',
53 '3' : 'btn3',
54 '4' : 'btn4',
55 '5' : 'btn5',
56 '6' : 'btn6',
57 '7' : 'btn7',
58 '8' : 'btn8',
59 '9' : 'btn9',
60 '0' : 'btn0',
61 '.' : 'btnnumericpoint',
62 '%' : 'btnpercentage',
63 '+' : 'btnadd',
64 '-' : 'btnsubtract',
65 '*' : 'btnmultiply',
66 '/' : 'btndivide',
67 '=' : 'btnresult',
68 '(' : 'btnstartgroup',
69 ')' : 'btnendgroup',
70 '^2' : 'btnxsquared',
71 'sqroot' : 'btnsquareroot',
72 'undo' : 'btnundo',
73 'clear' : 'btnclear',
74 'i' : 'btnimaginary',
75 'x' : 'btnmemory',
76 'e' : 'btneulersnumber',
77 '!' : 'btnfactorial',
78 'pi' : 'btnpi',
79 're' : 'btnrealportion',
80 'im' : 'btnimaginaryportion',
81 'ln' : 'btnnaturallogarithm',
82 'arg' : 'btnarg',
83 'exp' : 'btnexponential',
84 'mod' : 'btnmodulusdivide',
85 'sup' : 'tbtnsuperscript',
86 'sub' : 'tbtnsubscript',
87 'cos' : 'btncosine',
88 'sin' : 'btnsine',
89 'tan' : 'btntangent',
90 'log' : 'btnlogarithm',
91 '|x|' : 'btnabs',
92 'f(x)' : 'btnfunction',
93 'cosh' : 'btnhyperboliccosine',
94 'sinh' : 'btnhyperbolicsine',
95 'tanh' : 'btnhyperbolictangent',
96 'conj' : 'btnconjugate',
97 'root' : 'btnroot',
98 'undo' : 'btnundo',
99 'xpowy' : 'btnxpowy',
100 'clear' : 'btnclear',
101 'factor' : 'btnfactor',
102 'inverse': 'btninverse',
103 'degrees': 'cboDegrees',
104 'radians': 'cboRadians',
105 'convert': u'btn\u21c6',
106
107 'ctrm' : 'btnfinccompoundingterm',
108 'gpm' : 'btnfincgrossprofitmargin',
109 'rate' : 'btnfincperiodicinterestrate',
110 'ddb' : 'btnfincperiodicinterestrate',
111 'pmt' : 'btnfincperiodicpayment',
112 'sln' : 'btnfincstraightlinedepreciation',
113 'term' : 'btnfincterm',
114 'fv' : 'btnfincfuturevalue',
115 'pv' : 'btnfincpresentvalue',
116 'syd' : 'btnfincsumoftheyearsdigitsdepreciation',
117
118 'Binary' : 'cboBinary',
119 'Octal' : 'cboOctal',
120 'Decimal': 'cboDecimal',
121 'Hex' : 'cboHexadecimal',
122 'A' : 'btnA',
123 'B' : 'btnB',
124 'C' : 'btnC',
125 'D' : 'btnD',
126 'E' : 'btnE',
127 'F' : 'btnF',
128 'AND' : 'btnand',
129 'OR' : 'btnor',
130 'XOR' : 'btnxor',
131 '<' : 'btnshiftleft',
132 'ones' : 'btnonescomplement',
133 'NOT' : 'btnnot',
134 '>' : 'btnshiftright',
135 'ones' : 'btntwoscomplement',
136 'a' : 'btncharacter',
137 'trunc' : 'btntrunc',
138 'int' : 'btnintegerportion',
139 'frac' : 'btnfractionalportion'
140 }
141
142 a = None
143
144 def switch_to(self, mode):
145 """ Switch to mode """
146 self.a.click(self.menu['Mode'][mode])
147
148 def input(self, expression):
149 """ Input expression (each char = one button) """
150 for char in expression:
151 self.a.click(self.controls[char])
152
153 def click(self, button):
154 """ Click some button (for complex expressions) """
155 self.a.click(self.controls[button])
156
157 def input_from_keyboard(self, string):
158 """ Input string from keyboard """
159 self.a.enterstring(self.controls['Output'], string)
160
161 def get_result(self):
162 """ Get calculation result """
163 # A pause for calculation
164 ldtp.wait(2)
165 return self.a.gettextvalue(self.controls['Output'])
166
167 def get_error_message(self):
168 """ Get error message for calculation """
169 # A pause for calculation
170 ldtp.wait(2)
171 return self.a.gettextvalue(self.controls['Error'])
0172
=== added file 'gnome-calculator/test_gnome-calculator.py'
--- gnome-calculator/test_gnome-calculator.py 1970-01-01 00:00:00 +0000
+++ gnome-calculator/test_gnome-calculator.py 2011-08-08 09:54:34 +0000
@@ -0,0 +1,554 @@
1#!/usr/bin/python
2# -*- coding: utf-8 -*-
3# Copyright (C) 2010 Canonical Ltd
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19"""Template Test
20
21This is a template to create tests for Mago
22
23To run it with:
24$ mago <path_to_this_file>
25
26The only mandatory element is 'launcher'
27If no 'window_name' property is set, then mago will try to guess it from the
28XID of the window
29
30set setupOnce to False to launch/close the app for each test
31
32"""
33
34from mago import TestCase
35import unittest
36import ldtp, ooldtp
37from mago_gcalctool import GnomeCalculator
38
39class TestGCalcTool(TestCase):
40 """
41 Tests for gcalctool (Gnome Calculator)
42 """
43 launcher = 'gnome-calculator'
44 window = 'frmCalculator'
45 gcalctool = None
46 setupOnce = False
47 gcalctool = GnomeCalculator()
48 gcalctool.a = ooldtp.context(window)
49
50 def test_cal002_1(self):
51 """
52 cal-002-1: Basic Mode: 1+1
53 requires: gcalctool
54 command: gnome-calculator
55 _description:
56 PURPOSE:
57 Switch to Basic mode and calculate 1+1
58 STEPS:
59 1. 1+1 = 2
60 VERIFICATION:
61 1. Check that the calculator is calculating expression correctly
62 """
63
64 self.gcalctool.switch_to('Basic')
65
66 self.gcalctool.input('1+1=')
67 self.assertEquals(self.gcalctool.get_result(), '2')
68
69 def test_cal002_2(self):
70 """ cal-002-2
71 cal-002-2: Basic Mode: 3*4
72 requires: gcalctool
73 command: gnome-calculator
74 _description:
75 PURPOSE:
76 Switch to Basic mode and calculate 3*4
77 STEPS:
78 1. 3*4 = 12
79 VERIFICATION:
80 1. Check that the calculator is calculating expression correctly
81 """
82 self.gcalctool.switch_to('Basic')
83
84 self.gcalctool.input('3*4=')
85 self.assertEquals(self.gcalctool.get_result(), '12')
86
87 def test_cal002_3(self):
88 """
89 cal-002-3: Basic Mode: √9
90 requires: gcalctool
91 command: gnome-calculator
92 _description:
93 PURPOSE:
94 Switch to Basic mode and calculate √9
95 STEPS:
96 1. √9 = 3
97 VERIFICATION:
98 1. Check that the calculator is calculating expression correctly
99 """
100 self.gcalctool.switch_to('Basic')
101
102 self.gcalctool.click('sqroot')
103 self.gcalctool.input('9=')
104 self.assertEquals(self.gcalctool.get_result(), '3')
105
106 def test_cal003_1(self):
107 """
108 cal-003-1: Advanced Mode: log 100
109 requires: gcalctool
110 command: gnome-calculator
111 _description:
112 PURPOSE:
113 Switch to Advanced mode and calculate log 100
114 STEPS:
115 1. log 100 = 2
116 VERIFICATION:
117 1. Check that the calculator is calculating expression correctly
118 """
119
120 self.gcalctool.switch_to('Advanced')
121
122 self.gcalctool.click('log')
123 self.gcalctool.input('100=')
124 self.assertEquals(self.gcalctool.get_result(), '2')
125
126 def test_cal003_2(self):
127 """
128 ccal-003-2: Advanced Mode: sin 45 = 0.707106781
129 requires: gcalctool
130 command: gnome-calculator
131 _description:
132 PURPOSE:
133 Switch to Advanced mode and calculate sin 45
134 STEPS:
135 1. sin 45 = 0.707106781
136 VERIFICATION:
137 1. Check that the calculator is calculating expression correctly
138 """
139 self.gcalctool.switch_to('Advanced')
140
141 self.gcalctool.click('sin')
142 self.gcalctool.input('45=')
143 self.assertEquals(self.gcalctool.get_result(), '0.707106781')
144
145 def test_cal003_3(self):
146 """
147 cal-003-3: Advanced Mode: 6!
148 requires: gcalctool
149 command: gnome-calculator
150 _description:
151 PURPOSE:
152 Switch to Advanced mode and calculate 6!
153 STEPS:
154 1. 6! = 720
155 VERIFICATION:
156 1. Check that the calculator is calculating expression correctly
157 """
158 self.gcalctool.switch_to('Advanced')
159
160 self.gcalctool.input('6!=')
161 self.assertEquals(self.gcalctool.get_result(), '720')
162
163 def test_cal004_1(self):
164 """
165 cal-004-1: Financial Mode: 140+15%
166 requires: gcalctool
167 command: gnome-calculator
168 _description:
169 PURPOSE:
170 Switch to Financial mode and calculate 140+15%
171 STEPS:
172 1. 140+15% = 161
173 VERIFICATION:
174 1. Check that the calculator is calculating expression correctly
175 """
176 self.gcalctool.switch_to('Financial')
177
178 self.gcalctool.input('140+15%=')
179 self.assertEquals(self.gcalctool.get_result(), '161')
180
181 def test_cal004_2(self):
182 """
183 cal-004-2: Financial Mode: 100-20%
184 requires: gcalctool
185 command: gnome-calculator
186 _description:
187 PURPOSE:
188 Switch to Financial mode and calculate 100-20%
189 STEPS:
190 1. 100-20% = 80
191 VERIFICATION:
192 1. Check that the calculator is calculating expression correctly
193 """
194 self.gcalctool.switch_to('Financial')
195
196 self.gcalctool.input('100-20%=')
197 self.assertEquals(self.gcalctool.get_result(), '80')
198
199 def test_cal005_1(self):
200 """
201 cal-005-1: Programming Mode: 0 AND 1 = 0
202 requires: gcalctool
203 command: gnome-calculator
204 _description:
205 PURPOSE:
206 Switch to Programming mode and calculate 0 AND 1
207 STEPS:
208 1. 0 AND 1 = 0
209 VERIFICATION:
210 1. Check that the calculator is calculating expression correctly
211 """
212 self.a = ooldtp.context(self.window)
213 self.gcalctool.switch_to('Programming')
214
215 self.gcalctool.input('0')
216 self.gcalctool.click('AND')
217 self.gcalctool.input('1')
218 self.gcalctool.input('=')
219
220 self.assertEquals(self.gcalctool.get_result(), '0')
221
222 def test_cal005_2(self):
223 """
224 cal-005-2: Programming Mode: 0 OR 1 = 1
225 requires: gcalctool
226 command: gnome-calculator
227 _description:
228 PURPOSE:
229 Switch to Programming mode and calculate 0 OR 1
230 STEPS:
231 1. 0 OR 1 = 1
232 VERIFICATION:
233 1. Check that the calculator is calculating expression correctly
234 """
235 self.gcalctool.switch_to('Programming')
236
237 self.gcalctool.input('0')
238 self.gcalctool.click('OR')
239 self.gcalctool.input('1')
240 self.gcalctool.input('=')
241
242 self.assertEquals(self.gcalctool.get_result(), '1')
243
244 def test_cal007(self):
245 """
246 cal-007: Advanced Mode: 7921 mod 14
247 requires: gcalctool
248 command: gnome-calculator
249 _description:
250 PURPOSE:
251 Switch to Advanced mode and calculate 7921 mod 14
252 STEPS:
253 1. 7921 mod 14 = 11
254 VERIFICATION:
255 1. Check that the calculator is calculating expression correctly
256 """
257 self.gcalctool.switch_to('Advanced')
258
259 self.gcalctool.input('7921')
260 self.gcalctool.click('mod')
261 self.gcalctool.input('14=')
262 self.assertEquals(self.gcalctool.get_result(), '11')
263
264 def test_cal008(self):
265 """
266 cal-008: Programming Mode: 4 AND B
267 requires: gcalctool
268 command: gnome-calculator
269 _description:
270 PURPOSE:
271 Switch to Programming mode and calculate 4 AND B
272 STEPS:
273 1. 4 AND B
274 VERIFICATION:
275 1. Error occurs. Invalid variable 'B'
276 """
277 self.gcalctool.switch_to('Programming')
278
279 self.gcalctool.input('4')
280 self.gcalctool.click('AND')
281 self.gcalctool.input('B')
282 self.gcalctool.input('=')
283
284 self.assertEquals(self.gcalctool.get_result(), u'4\u2227B')
285 self.assertEquals(self.gcalctool.get_error_message(), "Unknown variable 'B'")
286
287 def test_bug756277(self):
288 """
289 bug756277: Incorrect Evaluation Order for Implied Multiplication
290 requires: gcalctool
291 command: gnome-calculator
292 _description:
293 PURPOSE:
294 Check calculation of evalution order, when multiplication is implied
295 LP:#756277
296 STEPS:
297 1. Input expression "48/2(9+3)"
298 VERIFICATION:
299 1. Result is 288
300 """
301 self.gcalctool.switch_to('Basic')
302
303 self.gcalctool.input('48/2(9+3)=')
304 self.assertEquals(self.gcalctool.get_result(), '288')
305
306 def test_bug28928(self):
307 """
308 bug28928: Sqrt function for expression with brackets
309 requires: gcalctool
310 command: gnome-calculator
311 _description:
312 PURPOSE:
313 Check sqrt function for expressions with brackets
314 LP:#28928
315 STEPS:
316 1. Input expression "root((9))"
317 VERIFICATION:
318 1. Result is 3
319 """
320 self.gcalctool.switch_to('Basic')
321
322 self.gcalctool.click('sqroot')
323 self.gcalctool.input('(9)=')
324
325 self.assertEquals(self.gcalctool.get_result(), '3')
326
327 def test_bug32200(self):
328 """
329 bug32200: Bitwise operations on results
330 requires: gcalctool
331 command: gnome-calculator
332 _description:
333 PURPOSE:
334 Check bitwise operations on results
335 LP:#32200
336 STEPS:
337 1. Input expression "2 AND 3"
338 2. Click "="
339 3. Input expression "OR 5"
340 4. Click "="
341 VERIFICATION:
342 1. Result is 7
343 """
344 self.gcalctool.switch_to('Programming')
345
346 self.gcalctool.input('2')
347 self.gcalctool.click('AND')
348 self.gcalctool.input('3')
349 self.gcalctool.input('=')
350
351 ldtp.wait(2)
352
353 self.gcalctool.click('OR')
354 self.gcalctool.input('5')
355 self.gcalctool.input('=')
356
357 self.assertEquals(self.gcalctool.get_result(), '7')
358
359 def test_bug204682(self):
360 """
361 bug204682: Powering negative numbers
362 requires: gcalctool
363 command: gnome-calculator
364 _description:
365 PURPOSE:
366 Check powering of negative numbers
367 LP:#204682
368 STEPS:
369 1. Calculate expression "-10^2"
370 2. Calculate expression "-(10)^2"
371 3. Calculate expression "(-10)^2"
372 VERIFICATION:
373 1. Result is -100
374 2. Result is -100
375 3. Result is 100
376 """
377 self.gcalctool.switch_to('Advanced')
378
379 self.gcalctool.input('-10')
380 self.gcalctool.click('xpowy')
381 self.gcalctool.input('2=')
382 self.assertEquals(self.gcalctool.get_result(), u'\u2212100') # -100
383
384 self.gcalctool.click('clear')
385 self.gcalctool.input('-(10)')
386 self.gcalctool.click('xpowy')
387 self.gcalctool.input('2=')
388 self.assertEquals(self.gcalctool.get_result(), u'\u2212100') # -100
389
390 self.gcalctool.click('clear')
391 self.gcalctool.input('(-10)')
392 self.gcalctool.click('xpowy')
393 self.gcalctool.input('2=')
394 self.assertEquals(self.gcalctool.get_result(), '100')
395
396 def test_bug499211(self):
397 """
398 bug499211: Type < and > from keyboard
399 requires: gcalctool
400 command: gnome-calculator
401 _description:
402 PURPOSE:
403 Check typing of < and > symbols from keyboard
404 LP:#499211
405 STEPS:
406 1. Type ">"
407 2. Type "<"
408 VERIFICATION:
409 1. The app doesn't crash
410 """
411 self.gcalctool.switch_to('Programming')
412
413 # Press > and < from keyboard, check that the app doesn't crash
414 self.gcalctool.input_from_keyboard('>')
415 self.gcalctool.input_from_keyboard('<')
416
417 def test_bug515280(self):
418 """
419 bug515280: Twice root out of -1
420 requires: gcalctool
421 command: gnome-calculator
422 _description:
423 PURPOSE:
424 LP:#515280
425 STEPS:
426 1. Calculate expression "root(root(-1))"
427 VERIFICATION:
428 1. Result is 7,071067812×10⁻¹7,071067812i×10⁻¹
429 """
430 self.gcalctool.switch_to('Advanced')
431
432 self.gcalctool.click('sqroot')
433 self.gcalctool.click('sqroot')
434 self.gcalctool.input('-1')
435 self.gcalctool.input('=')
436 self.assertEquals(self.gcalctool.get_result(), u'7,071067812\xd710\u207b\xb97,071067812i\xd710\u207b\xb9')
437 #'7,071067812×10⁻¹7,071067812i×10⁻¹' = root(i)
438
439 def test_bug215663(self):
440 """
441 bug215663: Zero result instead of -0
442 requires: gcalctool
443 command: gnome-calculator
444 _description:
445 PURPOSE:
446 Check that 0 is displayed instead of -0
447 LP:#215663
448 STEPS:
449 1. Calculate expression "4^2-16"
450 VERIFICATION:
451 1. Result is 0
452 """
453 self.gcalctool.switch_to('Advanced')
454
455 self.gcalctool.input('4')
456 self.gcalctool.click('xpowy')
457 self.gcalctool.input('2')
458 self.gcalctool.input('-16')
459 self.gcalctool.input('=')
460 self.assertEquals(self.gcalctool.get_result(), '0')
461
462 def test_bug215663(self):
463 """
464 bug215663: mod operation after x^y
465 requires: gcalctool
466 command: gnome-calculator
467 _description:
468 PURPOSE:
469 Check that 2^2 MOD 2 is calculated correctly
470 LP:#215663
471 STEPS:
472 1. Calculate expression "2^2 MOD 2"
473 VERIFICATION:
474 1. Result is 0
475 """
476 self.gcalctool.switch_to('Advanced')
477
478 self.gcalctool.input('2')
479 self.gcalctool.click('xpowy')
480 self.gcalctool.input('2')
481 self.gcalctool.click('mod')
482 self.gcalctool.input('2')
483 self.gcalctool.input('=')
484 self.assertEquals(self.gcalctool.get_result(), '0')
485
486 def test_bug446939(self):
487 """
488 bug446939: rand function
489 requires: gcalctool
490 command: gnome-calculator
491 _description:
492 PURPOSE:
493 Check that rand function works correctly
494 LP:#446939
495 STEPS:
496 1. Calculate expression "rand = "
497 VERIFICATION:
498 1. Result is a random number, error message is empty
499 """
500 self.gcalctool.switch_to('Advanced')
501
502 self.gcalctool.input_from_keyboard('rand')
503 self.gcalctool.input('=')
504 self.assertNotEquals(self.gcalctool.get_result(), '')
505 self.assertEquals(self.gcalctool.get_error_message(), '')
506
507 def test_bug288446(self):
508 """
509 bug288446: powering negative number in fractional number
510 requires: gcalctool
511 command: gnome-calculator
512 _description:
513 PURPOSE:
514 Check that (-4)^(1/7) is calculated correctly
515 LP:#288446
516 STEPS:
517 1. Calculate expression "(-4)^(1/7)"
518 VERIFICATION:
519 1. Result is −1,219013654
520 """
521 self.gcalctool.switch_to('Advanced')
522
523 self.gcalctool.input('(-4)')
524 self.gcalctool.click('xpowy')
525 self.gcalctool.input('(1/7)')
526 self.gcalctool.input('=')
527 self.assertEquals(self.gcalctool.get_result(), u'\u22121,219013654') #−1,219013654
528
529 def test_bug302115(self):
530 """
531 bug302115: Bitwise operations precedence
532 requires: gcalctool
533 command: gnome-calculator
534 _description:
535 PURPOSE:
536 Check bitwise operations on results
537 LP:#302115
538 STEPS:
539 1. Input expression "~1 AND 1"
540 VERIFICATION:
541 1. Result is 0
542 """
543 self.gcalctool.switch_to('Programming')
544
545 self.gcalctool.input_from_keyboard('~')
546 self.gcalctool.input('1')
547 self.gcalctool.click('AND')
548 self.gcalctool.input('1')
549 self.gcalctool.input('=')
550
551 self.assertEquals(self.gcalctool.get_result(), '0')
552
553if __name__ == "__main__":
554 unittest.main()

Subscribers

People subscribed via source and target branches