mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 14:31:39 +00:00
First batch of Pset Templates tests (#1772)
This commit is contained in:
@@ -5,4 +5,5 @@ markers =
|
|||||||
geometry
|
geometry
|
||||||
owner
|
owner
|
||||||
void
|
void
|
||||||
|
pset_template
|
||||||
spatial
|
spatial
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
@pset_template
|
||||||
|
Feature: Pset_Template
|
||||||
|
Covers property sets and property templates creation, edition, deletion.
|
||||||
|
|
||||||
|
Scenario: Add pset template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.add_pset_template"
|
||||||
|
Then nothing happens
|
||||||
|
|
||||||
|
Scenario: Remove pset template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.add_pset_template"
|
||||||
|
And I press "bim.remove_pset_template"
|
||||||
|
Then nothing happens
|
||||||
|
|
||||||
|
Scenario: Enable editing pset template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.add_pset_template"
|
||||||
|
And I press "bim.enable_editing_pset_template"
|
||||||
|
Then nothing happens
|
||||||
|
|
||||||
|
Scenario: Edit pset template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.add_pset_template"
|
||||||
|
And I press "bim.enable_editing_pset_template"
|
||||||
|
And I press "bim.edit_pset_template"
|
||||||
|
Then nothing happens
|
||||||
|
|
||||||
|
Scenario: Disable editing pset template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.add_pset_template"
|
||||||
|
And I press "bim.enable_editing_pset_template"
|
||||||
|
And I press "bim.disable_editing_pset_template"
|
||||||
|
Then nothing happens
|
||||||
|
|
||||||
|
Scenario: Save pset template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.save_pset_template_file"
|
||||||
|
Then nothing happens
|
||||||
|
|
||||||
|
Scenario: Add prop template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.add_pset_template"
|
||||||
|
And I press "bim.add_prop_template"
|
||||||
|
Then nothing happens
|
||||||
|
|
||||||
|
Scenario: Remove prop template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.add_pset_template"
|
||||||
|
And I press "bim.add_prop_template"
|
||||||
|
And the variable "prop_template" is "2"
|
||||||
|
And I press "bim.remove_prop_template(prop_template={prop_template})"
|
||||||
|
Then nothing happens
|
||||||
|
|
||||||
|
Scenario: Enable editing prop template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.add_pset_template"
|
||||||
|
And the variable "prop_template" is "2"
|
||||||
|
And I press "bim.enable_editing_prop_template(prop_template={prop_template})"
|
||||||
|
Then nothing happens
|
||||||
|
|
||||||
|
Scenario: Edit prop template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.add_pset_template"
|
||||||
|
And the variable "prop_template" is "2"
|
||||||
|
And I press "bim.enable_editing_prop_template(prop_template={prop_template})"
|
||||||
|
And I press "bim.edit_prop_template"
|
||||||
|
Then nothing happens
|
||||||
|
|
||||||
|
Scenario: Disable editing prop template
|
||||||
|
Given an empty IFC project
|
||||||
|
When I load a new pset template file
|
||||||
|
And I press "bim.add_pset_template"
|
||||||
|
And the variable "prop_template" is "2"
|
||||||
|
And I press "bim.enable_editing_prop_template(prop_template={prop_template})"
|
||||||
|
And I press "bim.disable_editing_prop_template"
|
||||||
|
Then nothing happens
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import bpy
|
import bpy
|
||||||
|
import ifcopenshell
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from pytest_bdd import scenarios, given, when, then, parsers
|
from pytest_bdd import scenarios, given, when, then, parsers
|
||||||
@@ -37,12 +38,23 @@ def replace_variables(value):
|
|||||||
def an_empty_ifc_project():
|
def an_empty_ifc_project():
|
||||||
IfcStore.purge()
|
IfcStore.purge()
|
||||||
bpy.ops.wm.read_homefile(app_template="")
|
bpy.ops.wm.read_homefile(app_template="")
|
||||||
while bpy.data.objects:
|
if len(bpy.data.objects) > 0:
|
||||||
bpy.data.objects.remove(bpy.data.objects[0])
|
while bpy.data.objects:
|
||||||
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=True)
|
bpy.data.objects.remove(bpy.data.objects[0])
|
||||||
|
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=True)
|
||||||
bpy.ops.bim.create_project()
|
bpy.ops.bim.create_project()
|
||||||
|
|
||||||
|
|
||||||
|
@when("I load a new pset template file")
|
||||||
|
def i_load_a_new_pset_template_file():
|
||||||
|
IfcStore.pset_template_path = os.path.join(
|
||||||
|
bpy.context.scene.BIMProperties.data_dir,
|
||||||
|
"pset",
|
||||||
|
bpy.context.scene.BIMPsetTemplateProperties.pset_template_files + ".ifc",
|
||||||
|
)
|
||||||
|
IfcStore.pset_template_file = ifcopenshell.open(IfcStore.pset_template_path)
|
||||||
|
|
||||||
|
|
||||||
@given("I add a cube")
|
@given("I add a cube")
|
||||||
@when("I add a cube")
|
@when("I add a cube")
|
||||||
def i_add_a_cube():
|
def i_add_a_cube():
|
||||||
|
|||||||
Reference in New Issue
Block a user