From: spo Date: Mon, 21 Dec 2015 08:54:59 +0000 (+0300) Subject: Fix issue #1127: parameter is not created X-Git-Tag: V_2.1.0~131 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2081dfe66b07a06cff00e43e8b39110d6a5c723d;p=modules%2Fshaper.git Fix issue #1127: parameter is not created --- diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp index 961182a71..803ea9e43 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp @@ -107,7 +107,7 @@ double ParametersPlugin_Parameter::evaluate(const std::string& theExpression, st // Currently there is no way to get parent document, so we get PartSet for all. DocumentPtr aDocument = document(); if (data()->name() == aVariableName) { - if (aDocument = ModelAPI_Session::get()->moduleDocument()) + if (aDocument == ModelAPI_Session::get()->moduleDocument()) continue; aDocument = ModelAPI_Session::get()->moduleDocument(); } diff --git a/test.squish/objects_salome.map b/test.squish/objects_salome.map index bff72d555..79fb2b4cb 100644 --- a/test.squish/objects_salome.map +++ b/test.squish/objects_salome.map @@ -153,9 +153,11 @@ :Parameter_ExpressionEditor {container=':SALOME*.Parameter_XGUI_PropertyPanel' type='ExpressionEditor' unnamed='1' visible='1'} :Parameter_QFrame {container=':SALOME*.Parameter_XGUI_PropertyPanel' type='QFrame' unnamed='1' visible='1'} :Parameter_QLineEdit {container=':SALOME*.Parameter_XGUI_PropertyPanel' type='QLineEdit' unnamed='1' visible='1'} +:Parameters (1).a = 32_QModelIndex {column='0' container=':Part_1.Parameters (1)_QModelIndex' text='a = 32' type='QModelIndex'} :Parameters.E = _QModelIndex {column='0' container=':Part_1.Parameters_QModelIndex' text?='E = *' type='QModelIndex'} :Parameters.L = _QModelIndex {column='0' container=':Part_1.Parameters_QModelIndex' text?='L = *' type='QModelIndex'} :Parameters.P = _QModelIndex {column='0' container=':Part_1.Parameters_QModelIndex' text?='P = *' type='QModelIndex'} +:Part_1.Parameters (1)_QModelIndex {column='0' container=':Part_1_QModelIndex' text='Parameters (1)' type='QModelIndex'} :Part_1.Parameters_QModelIndex {column='0' container=':Part_1_QModelIndex' text?='Parameters*' type='QModelIndex'} :Part_1_QModelIndex {column='0' container=':Object browser_XGUI_DataTree' text='Part_1' type='QModelIndex'} :Part_QMenu {title='Part' type='QMenu' unnamed='1' visible='1'} diff --git a/test.squish/suite_FEATURE_PARAMETERS/shared/scripts/bdd_hooks.py b/test.squish/suite_FEATURE_PARAMETERS/shared/scripts/bdd_hooks.py new file mode 100644 index 000000000..6a71199ca --- /dev/null +++ b/test.squish/suite_FEATURE_PARAMETERS/shared/scripts/bdd_hooks.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +# This file contains hook functions to run as the .feature file is executed. +# +# A common use-case is to use the OnScenarioStart/OnScenarioEnd hooks to +# start and stop an AUT, e.g. +# +# @OnScenarioStart +# def hook(context): +# startApplication("addressbook") +# +# @OnScenarioEnd +# def hook(context): +# currentApplicationContext().detach() +# +# See the section 'Performing Actions During Test Execution Via Hooks' in the Squish +# manual for a complete reference of the available API. + +import __builtin__ + +# Detach (i.e. potentially terminate) all AUTs at the end of a scenario +@OnScenarioEnd +def hook(context): + source(findFile("scripts", "common.py")) + close_application() + + for ctx in applicationContextList(): + ctx.detach() + diff --git a/test.squish/suite_FEATURE_PARAMETERS/shared/steps/steps.py b/test.squish/suite_FEATURE_PARAMETERS/shared/steps/steps.py new file mode 100644 index 000000000..ad69b6393 --- /dev/null +++ b/test.squish/suite_FEATURE_PARAMETERS/shared/steps/steps.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +# A quick introduction to implementing scripts for BDD tests: +# +# This file contains snippets of script code to be executed as the .feature +# file is processed. See the section 'Behaviour Driven Testing' in the 'API +# Reference Manual' chapter of the Squish manual for a comprehensive reference. +# +# The decorators Given/When/Then/Step can be used to associate a script snippet +# with a pattern which is matched against the steps being executed. Optional +# table/multi-line string arguments of the step are passed via a mandatory +# 'context' parameter: +# +# @When("I enter the text") +# def whenTextEntered(context): +# +# +# The pattern is a plain string without the leading keyword, but a couple of +# placeholders including |any|, |word| and |integer| are supported which can be +# used to extract arbitrary, alphanumeric and integer values resp. from the +# pattern; the extracted values are passed as additional arguments: +# +# @Then("I get |integer| different names") +# def namesReceived(context, numNames): +# +# +# Instead of using a string with placeholders, a regular expression can be +# specified. In that case, make sure to set the (optional) 'regexp' argument +# to True. + +import __builtin__ + +@Given("Launch application in salome mode") +def step(context): + startApplication("salome_run.sh") + clickButton(waitForObject(":SALOME*.NewGeom_QToolButton")) + clickButton(waitForObject(":Activate module.New_QPushButton")) + +@When("Create parameter a=30") +def step(context): + activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) + activateItem(waitForObjectItem(":Part_QMenu", "Parameter")) + mouseClick(waitForObject(":Parameter_QLineEdit"), 10, 10, 0, Qt.LeftButton) + type(waitForObject(":Parameter_QLineEdit"), "a") + mouseClick(waitForObject(":Parameter_ExpressionEditor"), 10, 10, 0, Qt.LeftButton) + type(waitForObject(":Parameter_ExpressionEditor"), "30") + clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) + +@When("Create part") +def step(context): + activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) + activateItem(waitForObjectItem(":Part_QMenu", "New part")) + +@When("Create parameter a=a+2") +def step(context): + activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) + activateItem(waitForObjectItem(":Part_QMenu", "Parameter")) + mouseClick(waitForObject(":Parameter_QLineEdit"), 10, 10, 0, Qt.LeftButton) + type(waitForObject(":Parameter_QLineEdit"), "a") + mouseClick(waitForObject(":Parameter_ExpressionEditor"), 10, 10, 0, Qt.LeftButton) + type(waitForObject(":Parameter_ExpressionEditor"), "a+2") + clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) + +@Then("the parameter in the part should exist") +def step(context): + waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (1)") + clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (1)", -10, 10, 0, Qt.LeftButton) + waitFor("object.exists(':Parameters (1).a = 32_QModelIndex')", 20000) + test.compare(findObject(":Parameters (1).a = 32_QModelIndex").text, "a = 32") diff --git a/test.squish/suite_FEATURE_PARAMETERS/suite.conf b/test.squish/suite_FEATURE_PARAMETERS/suite.conf index bae54b56b..739cb8424 100644 --- a/test.squish/suite_FEATURE_PARAMETERS/suite.conf +++ b/test.squish/suite_FEATURE_PARAMETERS/suite.conf @@ -5,6 +5,6 @@ HOOK_SUB_PROCESSES=true IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAP=../objects_salome.map -TEST_CASES=tst_BASE +TEST_CASES=tst_BASE tst_1127 VERSION=3 WRAPPERS=Qt diff --git a/test.squish/suite_FEATURE_PARAMETERS/tst_1127/test.feature b/test.squish/suite_FEATURE_PARAMETERS/tst_1127/test.feature new file mode 100644 index 000000000..48633eee4 --- /dev/null +++ b/test.squish/suite_FEATURE_PARAMETERS/tst_1127/test.feature @@ -0,0 +1,11 @@ +Feature: Two parameters with the same name could exist in PartSet and Part + + Each part can have its local parameter with any value. + + Scenario: Parameter in part should be created + + Given Launch application in salome mode + When Create parameter a=30 + And Create part + And Create parameter a=a+2 + Then the parameter in the part should exist diff --git a/test.squish/suite_FEATURE_PARAMETERS/tst_1127/test.py b/test.squish/suite_FEATURE_PARAMETERS/tst_1127/test.py new file mode 100644 index 000000000..75e47d0b3 --- /dev/null +++ b/test.squish/suite_FEATURE_PARAMETERS/tst_1127/test.py @@ -0,0 +1,8 @@ +source(findFile('scripts', 'python/bdd.py')) + +setupHooks('../shared/scripts/bdd_hooks.py') +collectStepDefinitions('./steps', '../shared/steps') + +def main(): + testSettings.throwOnFailure = True + runFeatureFile('test.feature')