From f476fc97f66241490ccf5636d30fbe5b6b91eaa3 Mon Sep 17 00:00:00 2001 From: spo Date: Wed, 3 Jun 2015 12:56:15 +0300 Subject: [PATCH] Add basic SQUISH test --- test.squish/objects.map | 38 +++++++++++++++++ test.squish/suite_ISSUES/envvars | 0 .../suite_ISSUES/shared/scripts/common.py | 41 +++++++++++++++++++ test.squish/suite_ISSUES/suite.conf | 10 +++++ test.squish/suite_ISSUES/tst_BASE/test.py | 10 +++++ 5 files changed, 99 insertions(+) create mode 100644 test.squish/objects.map create mode 100644 test.squish/suite_ISSUES/envvars create mode 100644 test.squish/suite_ISSUES/shared/scripts/common.py create mode 100644 test.squish/suite_ISSUES/suite.conf create mode 100644 test.squish/suite_ISSUES/tst_BASE/test.py diff --git a/test.squish/objects.map b/test.squish/objects.map new file mode 100644 index 000000000..3de686e4b --- /dev/null +++ b/test.squish/objects.map @@ -0,0 +1,38 @@ +:Basic.Circle_AppElements_Button {container=':Sketch.Basic_AppElements_MenuGroupPanel' text='Circle' type='AppElements_Button' unnamed='1' visible='1'} +:Basic.Sketch_AppElements_Button {container=':Sketch.Basic_AppElements_MenuGroupPanel' text='Sketch' type='AppElements_Button' unnamed='1' visible='1'} +:Center.X:_ModuleBase_ParamSpinBox {container=':Circle.Center_QGroupBox' leftWidget=':Center.X:_QLabel' type='ModuleBase_ParamSpinBox' unnamed='1' visible='1'} +:Center.X:_QLabel {container=':Circle.Center_QGroupBox' text='X:' type='QLabel' unnamed='1' visible='1'} +:Center.Y:_ModuleBase_ParamSpinBox {container=':Circle.Center_QGroupBox' leftWidget=':Center.Y:_QLabel' type='ModuleBase_ParamSpinBox' unnamed='1' visible='1'} +:Center.Y:_QLabel {container=':Circle.Center_QGroupBox' text='Y:' type='QLabel' unnamed='1' visible='1'} +:Circle.Center_QGroupBox {container=':OpenParts*.Circle_XGUI_PropertyPanel' title='Center' type='QGroupBox' unnamed='1' visible='1'} +:Circle.CircleRadius_ModuleBase_ParamSpinBox {container=':OpenParts*.Circle_XGUI_PropertyPanel' name='CircleRadius' type='ModuleBase_ParamSpinBox' visible='1'} +:Circle.property_panel_ok_QToolButton {container=':OpenParts*.Circle_XGUI_PropertyPanel' name='property_panel_ok' type='QToolButton' visible='1'} +:Circle.qt_spinbox_lineedit_QLineEdit {container=':OpenParts*.Circle_XGUI_PropertyPanel' name='qt_spinbox_lineedit' occurrence='3' type='QLineEdit' visible='1'} +:Extrusion.Extrusion_AppElements_Button {container=':Features.Extrusion_AppElements_MenuGroupPanel' text='Extrusion' type='AppElements_Button' unnamed='1' visible='1'} +:Extrusion.Select a sketch face_QLabel {container=':OpenParts*.Extrusion_XGUI_PropertyPanel' text='Select a sketch face' type='QLabel' unnamed='1' visible='1'} +:Extrusion.Select a sketch face_QListWidget {aboveWidget=':Extrusion.Select a sketch face_QLabel' container=':OpenParts*.Extrusion_XGUI_PropertyPanel' type='QListWidget' unnamed='1' visible='1'} +:Extrusion.property_panel_ok_QToolButton {container=':OpenParts*.Extrusion_XGUI_PropertyPanel' name='property_panel_ok' type='QToolButton' visible='1'} +:Extrusion_ModuleBase_PageWidget {container=':OpenParts*.Extrusion_XGUI_PropertyPanel' occurrence='2' type='ModuleBase_PageWidget' unnamed='1' visible='1'} +:Features.Extrusion_AppElements_MenuGroupPanel {container=':qt_tabwidget_stackedwidget.Features_AppElements_Workbench' name='Extrusion' type='AppElements_MenuGroupPanel' visible='1'} +:General.qt_tabwidget_stackedwidget_QStackedWidget {container=':OpenParts*.General_AppElements_DockWidget' name='qt_tabwidget_stackedwidget' type='QStackedWidget' visible='1'} +:General.qt_tabwidget_tabbar_QTabBar {container=':OpenParts*.General_AppElements_DockWidget' name='qt_tabwidget_tabbar' type='QTabBar' visible='1'} +:OpenParts*.Circle_XGUI_PropertyPanel {name='property_panel_dock' type='XGUI_PropertyPanel' visible='1' window=':OpenParts*_AppElements_MainWindow' windowTitle='Circle'} +:OpenParts*.Extrusion_XGUI_PropertyPanel {name='property_panel_dock' type='XGUI_PropertyPanel' visible='1' window=':OpenParts*_AppElements_MainWindow' windowTitle='Extrusion'} +:OpenParts*.General_AppElements_DockWidget {type='AppElements_DockWidget' unnamed='1' visible='1' window=':OpenParts*_AppElements_MainWindow' windowTitle='General'} +:OpenParts*.Parameter_XGUI_PropertyPanel {name='property_panel_dock' type='XGUI_PropertyPanel' visible='1' window=':OpenParts*_AppElements_MainWindow' windowTitle='Parameter'} +:OpenParts*.Sketch_XGUI_PropertyPanel {name='property_panel_dock' type='XGUI_PropertyPanel' visible='1' window=':OpenParts*_AppElements_MainWindow' windowTitle='Sketch'} +:OpenParts*_AppElements_MainWindow {type='AppElements_MainWindow' unnamed='1' visible='1' windowTitle?='OpenParts*'} +:OpenParts*_AppElements_ViewPort {type='AppElements_ViewPort' unnamed='1' visible='1' window=':OpenParts*_AppElements_MainWindow'} +:Operations.New part_AppElements_Button {container=':Part.Operations_AppElements_MenuGroupPanel' text='New part' type='AppElements_Button' unnamed='1' visible='1'} +:Parameter.property_panel_ok_QToolButton {container=':OpenParts*.Parameter_XGUI_PropertyPanel' name='property_panel_ok' type='QToolButton' visible='1'} +:Parameter_ExpressionEditor {container=':OpenParts*.Parameter_XGUI_PropertyPanel' type='ExpressionEditor' unnamed='1' visible='1'} +:Parameter_QLineEdit {container=':OpenParts*.Parameter_XGUI_PropertyPanel' type='QLineEdit' unnamed='1' visible='1'} +:Parameters.Parameter_AppElements_Button {container=':Part.Parameters_AppElements_MenuGroupPanel' text='Parameter' type='AppElements_Button' unnamed='1' visible='1'} +:Part.Operations_AppElements_MenuGroupPanel {container=':qt_tabwidget_stackedwidget.Part_AppElements_Workbench' name='Operations' type='AppElements_MenuGroupPanel' visible='1'} +:Part.Parameters_AppElements_MenuGroupPanel {container=':qt_tabwidget_stackedwidget.Part_AppElements_Workbench' name='Parameters' type='AppElements_MenuGroupPanel' visible='1'} +:Sketch.Basic_AppElements_MenuGroupPanel {container=':qt_tabwidget_stackedwidget.Sketch_AppElements_Workbench' name='Basic' type='AppElements_MenuGroupPanel' visible='1'} +:Sketch.property_panel_ok_QToolButton {container=':OpenParts*.Sketch_XGUI_PropertyPanel' name='property_panel_ok' type='QToolButton' visible='1'} +:qt_tabwidget_stackedwidget.Features_AppElements_Workbench {container=':General.qt_tabwidget_stackedwidget_QStackedWidget' name='Features' type='AppElements_Workbench' visible='1'} +:qt_tabwidget_stackedwidget.Part_AppElements_Workbench {container=':General.qt_tabwidget_stackedwidget_QStackedWidget' name='Part' type='AppElements_Workbench' visible='1'} +:qt_tabwidget_stackedwidget.Sketch_AppElements_Workbench {container=':General.qt_tabwidget_stackedwidget_QStackedWidget' name='Sketch' type='AppElements_Workbench' visible='1'} +:to_size_ModuleBase_ParamSpinBox {container=':Extrusion_ModuleBase_PageWidget' name='to_size' type='ModuleBase_ParamSpinBox' visible='1'} diff --git a/test.squish/suite_ISSUES/envvars b/test.squish/suite_ISSUES/envvars new file mode 100644 index 000000000..e69de29bb diff --git a/test.squish/suite_ISSUES/shared/scripts/common.py b/test.squish/suite_ISSUES/shared/scripts/common.py new file mode 100644 index 000000000..0abcfc1f7 --- /dev/null +++ b/test.squish/suite_ISSUES/shared/scripts/common.py @@ -0,0 +1,41 @@ +def parameter_create(name, expression): + clickButton(waitForObject(":Parameters.Parameter_AppElements_Button")) + type(waitForObject(":Parameter_QLineEdit"), name) + type(waitForObject(":Parameter_ExpressionEditor"), expression) + clickButton(waitForObject(":Parameter.property_panel_ok_QToolButton")) + +def part_create(): + clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Part") + clickButton(waitForObject(":Operations.New part_AppElements_Button")) + +def sketch_create(point, actions): + clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Sketch") + clickButton(waitForObject(":Basic.Sketch_AppElements_Button")) + mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton) + + actions() + + clickButton(waitForObject(":Sketch.property_panel_ok_QToolButton")) + +def circle_create(x, y, radius): + clickButton(waitForObject(":Basic.Circle_AppElements_Button")) + type(waitForObject(":Center.X:_ModuleBase_ParamSpinBox"), "") + type(waitForObject(":Center.X:_ModuleBase_ParamSpinBox"), x) + type(waitForObject(":Center.Y:_ModuleBase_ParamSpinBox"), "") + type(waitForObject(":Center.Y:_ModuleBase_ParamSpinBox"), y) + type(waitForObject(":Circle.CircleRadius_ModuleBase_ParamSpinBox"), "") + type(waitForObject(":Circle.CircleRadius_ModuleBase_ParamSpinBox"), radius) + clickButton(waitForObject(":Circle.property_panel_ok_QToolButton")) + +def extrusion_feature(points, to_size): + clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features") + clickButton(waitForObject(":Extrusion.Extrusion_AppElements_Button")) + + mouseClick(waitForObject(":Extrusion.Select a sketch face_QListWidget"), 10, 10, 0, Qt.LeftButton) + for point in points: + mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton) + + type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), "") + type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), to_size) + + clickButton(waitForObject(":Extrusion.property_panel_ok_QToolButton")) diff --git a/test.squish/suite_ISSUES/suite.conf b/test.squish/suite_ISSUES/suite.conf new file mode 100644 index 000000000..235e3e435 --- /dev/null +++ b/test.squish/suite_ISSUES/suite.conf @@ -0,0 +1,10 @@ +AUT=GeomApp +CWD= +ENVVARS=envvars +HOOK_SUB_PROCESSES=false +IMPLICITAUTSTART=0 +LANGUAGE=Python +OBJECTMAP=../objects.map +TEST_CASES=tst_BASE +VERSION=3 +WRAPPERS=Qt diff --git a/test.squish/suite_ISSUES/tst_BASE/test.py b/test.squish/suite_ISSUES/tst_BASE/test.py new file mode 100644 index 000000000..cd646fb9d --- /dev/null +++ b/test.squish/suite_ISSUES/tst_BASE/test.py @@ -0,0 +1,10 @@ +def main(): + source(findFile("scripts", "common.py")) + + startApplication("GeomApp") + parameter_create("a", "100") + part_create() + point = (446, 297) # one of the construction planes + sketch_create(point, lambda: circle_create(0, 0, "a")) + points = [(489, 319)] # circle + extrusion_feature(points, "a") -- 2.39.2