mirror of https://github.com/qt/qtdoc.git
Add Calqlatr Squish tests for Qt release
Adds example Squish test cases for Calqlatr demo. Task-number: QTBUG-138434 Task-number: QTBUG-138432 Pick-to: 6.10 Change-Id: Iec29b4ff197a7eda983654b51fd60d1b76c42546 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
58a08c9c74
commit
2a12d0efcc
|
@ -0,0 +1,57 @@
|
||||||
|
# Copyright (C) 2025 The Qt Company Ltd.
|
||||||
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
qQuickWindowQmlImpl = {"type": "QQuickWindowQmlImpl"}
|
||||||
|
portraitMode = {"container": qQuickWindowQmlImpl, "id": "portraitMode", "type": "ColumnLayout"}
|
||||||
|
landscapeMode = {"container": qQuickWindowQmlImpl, "id": "landscapeMode", "type": "RowLayout"}
|
||||||
|
|
||||||
|
# Digit buttons
|
||||||
|
digitButton0 = {"checkable": False, "container": qQuickWindowQmlImpl, "text": 0, "type": "DigitButton"}
|
||||||
|
digitButton1 = {"checkable": False, "container": qQuickWindowQmlImpl, "text": 1, "type": "DigitButton"}
|
||||||
|
digitButton2 = {"checkable": False, "container": qQuickWindowQmlImpl, "text": 2, "type": "DigitButton"}
|
||||||
|
digitButton3 = {"checkable": False, "container": qQuickWindowQmlImpl, "text": 3, "type": "DigitButton"}
|
||||||
|
digitButton4 = {"checkable": False, "container": qQuickWindowQmlImpl, "text": 4, "type": "DigitButton"}
|
||||||
|
digitButton5 = {"checkable": False, "container": qQuickWindowQmlImpl, "text": 5, "type": "DigitButton"}
|
||||||
|
digitButton6 = {"checkable": False, "container": qQuickWindowQmlImpl, "text": 6, "type": "DigitButton"}
|
||||||
|
digitButton7 = {"checkable": False, "container": qQuickWindowQmlImpl, "text": 7, "type": "DigitButton"}
|
||||||
|
digitButton8 = {"checkable": False, "container": qQuickWindowQmlImpl, "text": 8, "type": "DigitButton"}
|
||||||
|
digitButton9 = {"checkable": False, "container": qQuickWindowQmlImpl, "text": 9, "type": "DigitButton"}
|
||||||
|
decimal = {"checkable": False, "container": qQuickWindowQmlImpl, "text": ".", "type": "DigitButton"}
|
||||||
|
|
||||||
|
# Main operations
|
||||||
|
backspaceButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "bs", "type": "BackspaceButton"}
|
||||||
|
allClearButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "AC", "type": "OperatorButton"}
|
||||||
|
plusMinusButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "±", "type": "OperatorButton"}
|
||||||
|
equalsButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "=", "type": "OperatorButton"}
|
||||||
|
divisionButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "÷", "type": "OperatorButton"}
|
||||||
|
multiplicationButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "×", "type": "OperatorButton"}
|
||||||
|
plusButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "+", "type": "OperatorButton"}
|
||||||
|
minusButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "−", "type": "OperatorButton"}
|
||||||
|
|
||||||
|
# Scientific Digit buttons
|
||||||
|
digitButtonEuler = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "e", "type": "DigitButton"}
|
||||||
|
digitButtonPi = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "π", "type": "DigitButton"}
|
||||||
|
|
||||||
|
# Scientific operations
|
||||||
|
squaringButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "x²", "type": "OperatorButton"}
|
||||||
|
denominatorButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "⅟x", "type": "OperatorButton"}
|
||||||
|
squareRootButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "√", "type": "OperatorButton"}
|
||||||
|
cubedButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "x³", "type": "OperatorButton"}
|
||||||
|
sinButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "sin", "type": "OperatorButton"}
|
||||||
|
absValueButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "|x|", "type": "OperatorButton"}
|
||||||
|
logarithmButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "log", "type": "OperatorButton"}
|
||||||
|
cosButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "cos", "type": "OperatorButton"}
|
||||||
|
naturalLogarithmButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "ln", "type": "OperatorButton"}
|
||||||
|
tanButton = {"checkable": False, "container": qQuickWindowQmlImpl, "text": "tan", "type": "OperatorButton"}
|
||||||
|
|
||||||
|
# Display listview
|
||||||
|
calculationsListView = {"container": qQuickWindowQmlImpl, "id": "calculationsListView", "type": "ListView"}
|
||||||
|
line1ListViewItem = {"container": calculationsListView, "index": 0, "type": "Item"}
|
||||||
|
line2ListViewItem = {"container": calculationsListView, "index": 1, "type": "Item"}
|
||||||
|
line3ListViewItem = {"container": calculationsListView, "index": 2, "type": "Item"}
|
||||||
|
operatorTextline1 = {"container": line1ListViewItem, "type": "Text"}
|
||||||
|
inputTextline1 = {"container": line1ListViewItem, "occurrence": 2, "type": "Text"}
|
||||||
|
operatorTextline2 = {"container": line2ListViewItem, "type": "Text"}
|
||||||
|
inputTextline2 = {"container": line2ListViewItem, "occurrence": 2, "type": "Text"}
|
||||||
|
operatorTextline3 = {"container": line3ListViewItem, "type": "Text"}
|
||||||
|
inputTextline3 = {"container": line3ListViewItem, "occurrence": 2, "type": "Text"}
|
|
@ -0,0 +1,7 @@
|
||||||
|
AUT=
|
||||||
|
ENVVARS=envvars
|
||||||
|
LANGUAGE=Python
|
||||||
|
OBJECTMAPSTYLE=script
|
||||||
|
TEST_CASES=tst_numberpad tst_operatorsNotAvailable tst_buttonsAndClear tst_main_operations tst_scientific_operations_landscape
|
||||||
|
VERSION=3
|
||||||
|
WRAPPERS=Qt
|
|
@ -0,0 +1,77 @@
|
||||||
|
# Copyright (C) 2025 The Qt Company Ltd.
|
||||||
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
import names
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
attachToApplication("calqlatr")
|
||||||
|
|
||||||
|
# Digit buttons
|
||||||
|
button0 = waitForObjectExists(names.digitButton0)
|
||||||
|
button1 = waitForObjectExists(names.digitButton1)
|
||||||
|
button2 = waitForObjectExists(names.digitButton2)
|
||||||
|
button3 = waitForObjectExists(names.digitButton3)
|
||||||
|
button4 = waitForObjectExists(names.digitButton4)
|
||||||
|
button5 = waitForObjectExists(names.digitButton5)
|
||||||
|
button6 = waitForObjectExists(names.digitButton6)
|
||||||
|
button7 = waitForObjectExists(names.digitButton7)
|
||||||
|
button8 = waitForObjectExists(names.digitButton8)
|
||||||
|
button9 = waitForObjectExists(names.digitButton9)
|
||||||
|
decimal = waitForObjectExists(names.decimal)
|
||||||
|
|
||||||
|
allClear = waitForObjectExists(names.allClearButton)
|
||||||
|
backspace = waitForObjectExists(names.backspaceButton)
|
||||||
|
|
||||||
|
test.log("Test that '.' button is dimmed before digit button press")
|
||||||
|
test.compare(decimal.dimmed, True)
|
||||||
|
test.log("Check that digit buttons work and corresponding numbers appear on display")
|
||||||
|
test.log("Tap '0' digit button")
|
||||||
|
tapObject(button0)
|
||||||
|
test.log("Test that '.' button is not dimmed after digit button press")
|
||||||
|
test.compare(decimal.dimmed, False)
|
||||||
|
test.log("Tap '.' button")
|
||||||
|
tapObject(decimal)
|
||||||
|
test.log("Tap '1' digit button")
|
||||||
|
tapObject(button1)
|
||||||
|
test.log("Tap '2' digit button")
|
||||||
|
tapObject(button2)
|
||||||
|
test.log("Tap '3' digit button")
|
||||||
|
tapObject(button3)
|
||||||
|
test.log("Test that display shows a decimal numbers '0.123'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "0.123")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
test.log("Tap '4' digit button")
|
||||||
|
tapObject(button4)
|
||||||
|
test.log("Tap '5' digit button")
|
||||||
|
tapObject(button5)
|
||||||
|
test.log("Tap '6' digit button")
|
||||||
|
tapObject(button6)
|
||||||
|
test.log("Tap '7' digit button")
|
||||||
|
tapObject(button7)
|
||||||
|
test.log("Test that display shows numbers '4567'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "4567")
|
||||||
|
test.log("Tap '7' Backspace button")
|
||||||
|
tapObject(backspace)
|
||||||
|
test.log("Test that Backspace removed 7 from the display and current number is '456'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "456")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
test.log("Tap '8' digit button")
|
||||||
|
tapObject(button8)
|
||||||
|
test.log("Tap '9' digit button")
|
||||||
|
tapObject(button9)
|
||||||
|
test.log("Test that display shows numbers '89'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "89")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
test.log("After Clearing the display, check that there are no new items in it")
|
||||||
|
try:
|
||||||
|
findObject(names.inputTextline1)
|
||||||
|
test.xpasses("Unexpected Pass: Unexpectedly found new items")
|
||||||
|
except LookupError as err:
|
||||||
|
test.xfail("Expected Fail: No new items found", str(err))
|
|
@ -0,0 +1,94 @@
|
||||||
|
# Copyright (C) 2025 The Qt Company Ltd.
|
||||||
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
import names
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
attachToApplication("calqlatr")
|
||||||
|
|
||||||
|
button0 = waitForObjectExists(names.digitButton0)
|
||||||
|
button1 = waitForObjectExists(names.digitButton1)
|
||||||
|
button2 = waitForObjectExists(names.digitButton2)
|
||||||
|
button5 = waitForObjectExists(names.digitButton5)
|
||||||
|
|
||||||
|
division = waitForObjectExists(names.divisionButton)
|
||||||
|
multiplication = waitForObjectExists(names.multiplicationButton)
|
||||||
|
minus = waitForObjectExists(names.minusButton)
|
||||||
|
plus = waitForObjectExists(names.plusButton)
|
||||||
|
|
||||||
|
equals = waitForObjectExists(names.equalsButton)
|
||||||
|
allClear = waitForObjectExists(names.allClearButton)
|
||||||
|
|
||||||
|
# Division
|
||||||
|
test.log("Check that display shows 10 after pressing digits 1 and 0 in sequence")
|
||||||
|
tapObject(button1)
|
||||||
|
tapObject(button0)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "10")
|
||||||
|
test.log("Check that divide symbol (÷) is shown when tapping divide button")
|
||||||
|
tapObject(division)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "÷")
|
||||||
|
test.log("Check that number '5' is shown when tapping corresponding button")
|
||||||
|
tapObject(button5)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "5")
|
||||||
|
test.log("Check that equal symbol (=) is shown when tapping equal button")
|
||||||
|
tapObject(equals)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline3).text), "=")
|
||||||
|
test.log("Check that number '2' is shown after division operation")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline3).text), "2")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Multiplication
|
||||||
|
test.log("Check that number '5' is shown when tapping corresponding button")
|
||||||
|
tapObject(button5)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "5")
|
||||||
|
test.log("Check that multiply symbol (×) is shown when tapping multiply button")
|
||||||
|
tapObject(multiplication)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "×")
|
||||||
|
test.log("Check that number '5' is shown when tapping corresponding button for the second time")
|
||||||
|
tapObject(button5)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "5")
|
||||||
|
test.log("Check that equal symbol (=) is shown when tapping equal button")
|
||||||
|
doubleTap(equals)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline3).text), "=")
|
||||||
|
test.log("Check that number '25' is shown after multiplication operation")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline3).text), "25")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Subtraction
|
||||||
|
test.log("Check that number '5' is shown when tapping corresponding button")
|
||||||
|
tapObject(button5)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "5")
|
||||||
|
test.log("Check that subtract symbol (−) is shown when tapping subtract button")
|
||||||
|
tapObject(minus)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "−")
|
||||||
|
test.log("Check that number '2' is shown when tapping corresponding button")
|
||||||
|
tapObject(button2)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "2")
|
||||||
|
test.log("Check that equal symbol (=) is shown when tapping equal button")
|
||||||
|
tapObject(equals)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline3).text), "=")
|
||||||
|
test.log("Check that number '3' is shown after subtraction operation")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline3).text), "3")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Addition
|
||||||
|
test.log("Check that number '1' is shown when tapping corresponding button")
|
||||||
|
tapObject(button1)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "1")
|
||||||
|
test.log("Check that add symbol (+) is shown when tapping add button")
|
||||||
|
tapObject(plus)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "+")
|
||||||
|
test.log("Check that number '1' is shown when tapping corresponding button for the second time")
|
||||||
|
tapObject(button1)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "1")
|
||||||
|
test.log("Check that equal symbol (=) is shown when tapping equal button")
|
||||||
|
tapObject(equals)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline3).text), "=")
|
||||||
|
test.log("Check that number '2' is shown after addition operation")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline3).text), "2")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
|
@ -0,0 +1,176 @@
|
||||||
|
# Copyright (C) 2025 The Qt Company Ltd.
|
||||||
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
import names
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
attachToApplication("calqlatr")
|
||||||
|
|
||||||
|
# Digit buttons
|
||||||
|
button0 = waitForObjectExists(names.digitButton0)
|
||||||
|
button1 = waitForObjectExists(names.digitButton1)
|
||||||
|
button2 = waitForObjectExists(names.digitButton2)
|
||||||
|
button3 = waitForObjectExists(names.digitButton3)
|
||||||
|
button4 = waitForObjectExists(names.digitButton4)
|
||||||
|
button5 = waitForObjectExists(names.digitButton5)
|
||||||
|
button6 = waitForObjectExists(names.digitButton6)
|
||||||
|
button7 = waitForObjectExists(names.digitButton7)
|
||||||
|
button8 = waitForObjectExists(names.digitButton8)
|
||||||
|
button9 = waitForObjectExists(names.digitButton9)
|
||||||
|
decimal = waitForObjectExists(names.decimal)
|
||||||
|
|
||||||
|
# Main operations
|
||||||
|
backspace = waitForObjectExists(names.backspaceButton)
|
||||||
|
allClear = waitForObjectExists(names.allClearButton)
|
||||||
|
plusMinus = waitForObjectExists(names.plusMinusButton)
|
||||||
|
equals = waitForObjectExists(names.equalsButton)
|
||||||
|
division = waitForObjectExists(names.divisionButton)
|
||||||
|
multiplication = waitForObjectExists(names.multiplicationButton)
|
||||||
|
plus = waitForObjectExists(names.plusButton)
|
||||||
|
minus = waitForObjectExists(names.minusButton)
|
||||||
|
|
||||||
|
test.log("Test that Zero button is visible")
|
||||||
|
test.compare(button0.visible, True)
|
||||||
|
test.log("Test that Zero button has text '0'")
|
||||||
|
test.compare(button0.text, "0")
|
||||||
|
test.log("Test that One button is visible")
|
||||||
|
test.compare(button1.visible, True)
|
||||||
|
test.log("Test that One button has text '1'")
|
||||||
|
test.compare(button1.text, "1")
|
||||||
|
test.log("Test that Two button is visible")
|
||||||
|
test.compare(button2.visible, True)
|
||||||
|
test.log("Test that Two button has text '2'")
|
||||||
|
test.compare(button2.text, "2")
|
||||||
|
test.log("Test that Three button is visible")
|
||||||
|
test.compare(button3.visible, True)
|
||||||
|
test.log("Test that Three button has text '3'")
|
||||||
|
test.compare(button3.text, "3")
|
||||||
|
test.log("Test that Four button is visible")
|
||||||
|
test.compare(button4.visible, True)
|
||||||
|
test.log("Test that Four button has text '4'")
|
||||||
|
test.compare(button4.text, "4")
|
||||||
|
test.log("Test that Five button is visible")
|
||||||
|
test.compare(button5.visible, True)
|
||||||
|
test.log("Test that Five button has text '5'")
|
||||||
|
test.compare(button5.text, "5")
|
||||||
|
test.log("Test that Six button is visible")
|
||||||
|
test.compare(button6.visible, True)
|
||||||
|
test.log("Test that Six button has text '6'")
|
||||||
|
test.compare(button6.text, "6")
|
||||||
|
test.log("Test that Seven button is visible")
|
||||||
|
test.compare(button7.visible, True)
|
||||||
|
test.log("Test that Seven button has text '7'")
|
||||||
|
test.compare(button7.text, "7")
|
||||||
|
test.log("Test that Eight button is visible")
|
||||||
|
test.compare(button8.visible, True)
|
||||||
|
test.log("Test that Eight button has text '8'")
|
||||||
|
test.compare(button8.text, "8")
|
||||||
|
test.log("Test that Nine button is visible")
|
||||||
|
test.compare(button9.visible, True)
|
||||||
|
test.log("Test that Nine button has text '9'")
|
||||||
|
test.compare(button9.text, "9")
|
||||||
|
test.log("Test that Decimal button is visible")
|
||||||
|
test.compare(decimal.visible, True)
|
||||||
|
test.log("Test that Decimal button has text '.'")
|
||||||
|
test.compare(decimal.text, ".")
|
||||||
|
|
||||||
|
test.log("Test that Backspace button is visible")
|
||||||
|
test.compare(backspace.visible, True)
|
||||||
|
test.log("Test that All Clear button is visible")
|
||||||
|
test.compare(allClear.visible, True)
|
||||||
|
test.log("Test that All Clear button has text 'AC'")
|
||||||
|
test.compare(allClear.text, "AC")
|
||||||
|
test.log("Test that PlusMinus button is visible")
|
||||||
|
test.compare(plusMinus.visible, True)
|
||||||
|
test.log("Test that PlusMinus button has text '±'")
|
||||||
|
test.compare(plusMinus.text, "±")
|
||||||
|
test.log("Test that Equals button is visible")
|
||||||
|
test.compare(equals.visible, True)
|
||||||
|
test.log("Test that Equals button has text '='")
|
||||||
|
test.compare(equals.text, "=")
|
||||||
|
test.log("Test that Division button is visible")
|
||||||
|
test.compare(division.visible, True)
|
||||||
|
test.log("Test that Division button has text '÷'")
|
||||||
|
test.compare(division.text, "÷")
|
||||||
|
test.log("Test that Multiplication button is visible")
|
||||||
|
test.compare(multiplication.visible, True)
|
||||||
|
test.log("Test that Multiplication button has text '×'")
|
||||||
|
test.compare(multiplication.text, "×")
|
||||||
|
test.log("Test that Plus button is visible")
|
||||||
|
test.compare(plus.visible, True)
|
||||||
|
test.log("Test that Plus button has text '+'")
|
||||||
|
test.compare(plus.text, "+")
|
||||||
|
test.log("Test that Minus button is visible")
|
||||||
|
test.compare(minus.visible, True)
|
||||||
|
test.log("Test that Minus button has text '−'")
|
||||||
|
test.compare(minus.text, "−")
|
||||||
|
|
||||||
|
if waitForObjectExists(names.landscapeMode).visible:
|
||||||
|
test.log("Landscape mode extra tests")
|
||||||
|
|
||||||
|
# Scientific Digit buttons
|
||||||
|
euler = waitForObjectExists(names.digitButtonEuler)
|
||||||
|
pi = waitForObjectExists(names.digitButtonPi)
|
||||||
|
|
||||||
|
# Scientific operations
|
||||||
|
squaring = waitForObjectExists(names.squaringButton)
|
||||||
|
denominator = waitForObjectExists(names.denominatorButton)
|
||||||
|
squareroot = waitForObjectExists(names.squareRootButton)
|
||||||
|
cubed = waitForObjectExists(names.cubedButton)
|
||||||
|
sin = waitForObjectExists(names.sinButton)
|
||||||
|
absvalue = waitForObjectExists(names.absValueButton)
|
||||||
|
logarithm = waitForObjectExists(names.logarithmButton)
|
||||||
|
cos = waitForObjectExists(names.cosButton)
|
||||||
|
naturalogarithm = waitForObjectExists(names.naturalLogarithmButton)
|
||||||
|
tan = waitForObjectExists(names.tanButton)
|
||||||
|
|
||||||
|
test.log("Test that Euler e button is visible")
|
||||||
|
test.compare(euler.visible, True)
|
||||||
|
test.log("Test that Euler e button has text 'e'")
|
||||||
|
test.compare(euler.text, "e")
|
||||||
|
test.log("Test that PI button is visible")
|
||||||
|
test.compare(pi.visible, True)
|
||||||
|
test.log("Test that PI button has text 'π'")
|
||||||
|
test.compare(pi.text, "π")
|
||||||
|
|
||||||
|
test.log("Test that Squared button is visible")
|
||||||
|
test.compare(squaring.visible, True)
|
||||||
|
test.log("Test that Squared button has text 'x²'")
|
||||||
|
test.compare(squaring.text, "x²")
|
||||||
|
test.log("Test that Denominator button is visible")
|
||||||
|
test.compare(denominator.visible, True)
|
||||||
|
test.log("Test that Denominator Root button has text '⅟x'")
|
||||||
|
test.compare(denominator.text, "⅟x")
|
||||||
|
test.log("Test that Square Root button is visible")
|
||||||
|
test.compare(squareroot.visible, True)
|
||||||
|
test.log("Test that Square Root button has text '√'")
|
||||||
|
test.compare(squareroot.text, "√")
|
||||||
|
test.log("Test that Cubed button is visible")
|
||||||
|
test.compare(cubed.visible, True)
|
||||||
|
test.log("Test that Cubed button has text 'x³'")
|
||||||
|
test.compare(cubed.text, "x³")
|
||||||
|
test.log("Test that Sine button is visible")
|
||||||
|
test.compare(sin.visible, True)
|
||||||
|
test.log("Test that Sine button has text 'sin'")
|
||||||
|
test.compare(sin.text, "sin")
|
||||||
|
test.log("Test that Absolute Value button is visible")
|
||||||
|
test.compare(absvalue.visible, True)
|
||||||
|
test.log("Test that Absolute Value button has text '|x|'")
|
||||||
|
test.compare(absvalue.text, "|x|")
|
||||||
|
test.log("Test that Logarithm button is visible")
|
||||||
|
test.compare(logarithm.visible, True)
|
||||||
|
test.log("Test that Logarithm button has text 'log'")
|
||||||
|
test.compare(logarithm.text, "log")
|
||||||
|
test.log("Test that Cosine button is visible")
|
||||||
|
test.compare(cos.visible, True)
|
||||||
|
test.log("Test that Cosine button has text 'cos'")
|
||||||
|
test.compare(cos.text, "cos")
|
||||||
|
test.log("Test that Natural Logarithm button is visible")
|
||||||
|
test.compare(naturalogarithm.visible, True)
|
||||||
|
test.log("Test that Natural Logarithm button has text 'ln'")
|
||||||
|
test.compare(naturalogarithm.text, "ln")
|
||||||
|
test.log("Test that Tangent button is visible")
|
||||||
|
test.compare(tan.visible, True)
|
||||||
|
test.log("Test that Tangent button has text 'tan'")
|
||||||
|
test.compare(tan.text, "tan")
|
|
@ -0,0 +1,39 @@
|
||||||
|
# Copyright (C) 2025 The Qt Company Ltd.
|
||||||
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
import names
|
||||||
|
|
||||||
|
|
||||||
|
def operator_button_not_available(button_list):
|
||||||
|
for button in button_list:
|
||||||
|
test.log(f"Check that {button.text} button has been dimmed (disabled before number press)")
|
||||||
|
test.compare(button.dimmed, True)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
attachToApplication("calqlatr")
|
||||||
|
|
||||||
|
button_list = (waitForObjectExists(names.backspaceButton),
|
||||||
|
waitForObjectExists(names.allClearButton),
|
||||||
|
waitForObjectExists(names.plusMinusButton),
|
||||||
|
waitForObjectExists(names.equalsButton),
|
||||||
|
waitForObjectExists(names.divisionButton),
|
||||||
|
waitForObjectExists(names.multiplicationButton),
|
||||||
|
waitForObjectExists(names.plusButton),
|
||||||
|
waitForObjectExists(names.minusButton),
|
||||||
|
waitForObjectExists(names.decimal))
|
||||||
|
|
||||||
|
if waitForObjectExists(names.landscapeMode).visible:
|
||||||
|
test.log("Landscape mode extra tests")
|
||||||
|
scientific_button_list = (waitForObjectExists(names.squaringButton),
|
||||||
|
waitForObjectExists(names.denominatorButton),
|
||||||
|
waitForObjectExists(names.squareRootButton),
|
||||||
|
waitForObjectExists(names.cubedButton),
|
||||||
|
waitForObjectExists(names.sinButton),
|
||||||
|
waitForObjectExists(names.absValueButton),
|
||||||
|
waitForObjectExists(names.logarithmButton),
|
||||||
|
waitForObjectExists(names.cosButton),
|
||||||
|
waitForObjectExists(names.naturalLogarithmButton),
|
||||||
|
waitForObjectExists(names.tanButton))
|
||||||
|
button_list = button_list + scientific_button_list
|
||||||
|
|
||||||
|
operator_button_not_available(button_list)
|
|
@ -0,0 +1,172 @@
|
||||||
|
# Copyright (C) 2025 The Qt Company Ltd.
|
||||||
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
import names
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
attachToApplication("calqlatr")
|
||||||
|
|
||||||
|
if waitForObjectExists(names.portraitMode).visible:
|
||||||
|
test.log("Skip test case. Devices needs to be in Landscape mode")
|
||||||
|
else:
|
||||||
|
test.log("Landscape mode extra tests")
|
||||||
|
|
||||||
|
# Digit buttons
|
||||||
|
button0 = waitForObjectExists(names.digitButton0)
|
||||||
|
button1 = waitForObjectExists(names.digitButton1)
|
||||||
|
button2 = waitForObjectExists(names.digitButton2)
|
||||||
|
button3 = waitForObjectExists(names.digitButton3)
|
||||||
|
button4 = waitForObjectExists(names.digitButton4)
|
||||||
|
button5 = waitForObjectExists(names.digitButton5)
|
||||||
|
button6 = waitForObjectExists(names.digitButton6)
|
||||||
|
button7 = waitForObjectExists(names.digitButton7)
|
||||||
|
button8 = waitForObjectExists(names.digitButton8)
|
||||||
|
button9 = waitForObjectExists(names.digitButton9)
|
||||||
|
decimal = waitForObjectExists(names.decimal)
|
||||||
|
|
||||||
|
allClear = waitForObjectExists(names.allClearButton)
|
||||||
|
plusMinus = waitForObjectExists(names.plusMinusButton)
|
||||||
|
|
||||||
|
# Scientific Digit buttons
|
||||||
|
euler = waitForObjectExists(names.digitButtonEuler)
|
||||||
|
pi = waitForObjectExists(names.digitButtonPi)
|
||||||
|
|
||||||
|
# Scientific operations
|
||||||
|
squaring = waitForObjectExists(names.squaringButton)
|
||||||
|
denominator = waitForObjectExists(names.denominatorButton)
|
||||||
|
squareroot = waitForObjectExists(names.squareRootButton)
|
||||||
|
cubed = waitForObjectExists(names.cubedButton)
|
||||||
|
sin = waitForObjectExists(names.sinButton)
|
||||||
|
absvalue = waitForObjectExists(names.absValueButton)
|
||||||
|
logarithm = waitForObjectExists(names.logarithmButton)
|
||||||
|
cos = waitForObjectExists(names.cosButton)
|
||||||
|
naturallogarithm = waitForObjectExists(names.naturalLogarithmButton)
|
||||||
|
tan = waitForObjectExists(names.tanButton)
|
||||||
|
|
||||||
|
# Squared
|
||||||
|
test.log("Check that listView shows corresponding number when digit button '8' is tapped")
|
||||||
|
tapObject(button8)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "8")
|
||||||
|
test.log("Check that corresponding symbol (x²) appears in display when Square operator button is tapped")
|
||||||
|
tapObject(squaring)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "x²")
|
||||||
|
test.log("Check that corresponding value appears in display for the operation which should be '64'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "64")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Denominator
|
||||||
|
test.log("Check that listView shows corresponding number when digit button '2' is tapped")
|
||||||
|
test.log("Check that corresponding value appears in display when first '0' adding decimal point and then '2' digit buttons are tapped")
|
||||||
|
tapObject(button0)
|
||||||
|
tapObject(decimal)
|
||||||
|
tapObject(button2)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "0.2")
|
||||||
|
test.log("Check that corresponding symbol (⅟x) appears in display when Denominator operator button is tapped")
|
||||||
|
tapObject(denominator)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "⅟x")
|
||||||
|
test.log("Check that corresponding value appears in display for the operation which should be '5'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "5")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Square Root
|
||||||
|
test.log("Check that listView shows corresponding number when digit button '9' is tapped")
|
||||||
|
tapObject(button9)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "9")
|
||||||
|
test.log("Check that corresponding symbol (√) appears in display when Square Root operator button is tapped")
|
||||||
|
tapObject(squareroot)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "√")
|
||||||
|
test.log("Check that corresponding value appears in display for the operation which should be '3'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "3")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Cube
|
||||||
|
test.log("Check that listView shows corresponding number when digit button '3' is tapped")
|
||||||
|
tapObject(button3)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "3")
|
||||||
|
test.log("Check that corresponding symbol (x³) appears in display when Cubed operator button is tapped")
|
||||||
|
tapObject(cubed)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "x³")
|
||||||
|
test.log("Check that corresponding value appears in display for the operation which should be '27'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "27")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Sine
|
||||||
|
test.log("Check that listView shows corresponding number when digit button '1' is tapped")
|
||||||
|
tapObject(button1)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "1")
|
||||||
|
test.log("Check that corresponding symbol (sin) appears in display when Sine operator button is tapped")
|
||||||
|
tapObject(sin)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "sin")
|
||||||
|
test.log("Check that corresponding value appears in display for the operation which should be '0.8414710'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "0.8414710")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Absolute Value
|
||||||
|
test.log("Check that corresponding value appears in display when first '7' and then '5' digit buttons are tapped")
|
||||||
|
tapObject(button7)
|
||||||
|
tapObject(button5)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "75")
|
||||||
|
test.log("Check that corresponding number turns to negative when ± button is tapped")
|
||||||
|
tapObject(plusMinus)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "-75")
|
||||||
|
test.log("Check that corresponding symbol (|x|) appears in display when Absolute Value operator button is tapped")
|
||||||
|
tapObject(absvalue)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "|x|")
|
||||||
|
test.log("Check that corresponding value appears in display for the operation which should be '75'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "75")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Logarithm
|
||||||
|
test.log("Check that listView shows corresponding number when digit button '6' is tapped")
|
||||||
|
tapObject(button6)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "6")
|
||||||
|
test.log("Check that corresponding symbol (log) appears in display when Logarithm operator button is tapped")
|
||||||
|
tapObject(logarithm)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "log")
|
||||||
|
test.log("Check that corresponding value appears in display for the operation which should be '0.7781513'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "0.7781513")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Cosine
|
||||||
|
test.log("Check that listView shows corresponding number when digit button 'π' is tapped")
|
||||||
|
tapObject(pi)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "3.1415927")
|
||||||
|
test.log("Check that corresponding symbol (cos) appears in display when Cosine operator button is tapped")
|
||||||
|
tapObject(cos)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "cos")
|
||||||
|
test.log("Check that corresponding value appears in display for the operation which should be '1'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "-1.0000000")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Natural Logarithm
|
||||||
|
test.log("Check that listView shows corresponding number when digit button 'e' is tapped")
|
||||||
|
tapObject(euler)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "2.7182818")
|
||||||
|
test.log("Check that corresponding symbol (ln) appears in display when Natural Logarithm operator button is tapped")
|
||||||
|
tapObject(naturallogarithm)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "ln")
|
||||||
|
test.log("Check that corresponding value appears in display for the operation which should be '1'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "1.0000000")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
||||||
|
|
||||||
|
# Tangent
|
||||||
|
test.log("Check that listView shows corresponding number when digit button '4' is tapped")
|
||||||
|
tapObject(button4)
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline1).text), "4")
|
||||||
|
test.log("Check that corresponding symbol (tan) appears in display when Tangent operator button is tapped")
|
||||||
|
tapObject(tan)
|
||||||
|
test.compare(str(waitForObjectExists(names.operatorTextline2).text), "tan")
|
||||||
|
test.log("Check that corresponding value appears in display for the operation which should be '1.1578213'")
|
||||||
|
test.compare(str(waitForObjectExists(names.inputTextline2).text), "1.1578213")
|
||||||
|
test.log("Clear display")
|
||||||
|
tapObject(allClear)
|
Loading…
Reference in New Issue