mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 14:31:39 +00:00
You can now edit attributes of contexts and subcontexts. Fix bug where 2D contexts were not created with the right dimensionality.
This commit is contained in:
@@ -17,18 +17,58 @@
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import blenderbim.core.context as subject
|
||||
from test.core.bootstrap import ifc
|
||||
from test.core.bootstrap import ifc, context_editor
|
||||
|
||||
|
||||
class TestAddContext:
|
||||
def test_adding_a_context(self, ifc):
|
||||
ifc.run(
|
||||
"context.add_context", context="Model", subcontext="Body", target_view="MODEL_VIEW"
|
||||
"context.add_context", context_type="Model", context_identifier=None, target_view=None, parent=None
|
||||
).should_be_called().will_return("context")
|
||||
assert subject.add_context(ifc, context="Model", subcontext="Body", target_view="MODEL_VIEW") == "context"
|
||||
assert (
|
||||
subject.add_context(ifc, context_type="Model", context_identifier=None, target_view=None, parent=None)
|
||||
== "context"
|
||||
)
|
||||
|
||||
def test_adding_a_subcontext(self, ifc):
|
||||
ifc.run(
|
||||
"context.add_context",
|
||||
context_type="Model",
|
||||
context_identifier="Body",
|
||||
target_view="MODEL_VIEW",
|
||||
parent="parent",
|
||||
).should_be_called().will_return("subcontext")
|
||||
assert (
|
||||
subject.add_context(
|
||||
ifc, context_type="Model", context_identifier="Body", target_view="MODEL_VIEW", parent="parent"
|
||||
)
|
||||
== "subcontext"
|
||||
)
|
||||
|
||||
|
||||
class TestRemoveContext:
|
||||
def test_removing_a_context(self, ifc):
|
||||
ifc.run("context.remove_context", context="context").should_be_called()
|
||||
subject.remove_context(ifc, context="context")
|
||||
|
||||
|
||||
class TestEnableEditingContext:
|
||||
def test_run(self, context_editor):
|
||||
context_editor.set_context("context").should_be_called()
|
||||
context_editor.import_attributes().should_be_called()
|
||||
subject.enable_editing_context(context_editor, context="context")
|
||||
|
||||
|
||||
class TestDisableEditingContext:
|
||||
def test_run(self, context_editor):
|
||||
context_editor.clear_context().should_be_called()
|
||||
subject.disable_editing_context(context_editor)
|
||||
|
||||
|
||||
class TestEditContext:
|
||||
def test_run(self, ifc, context_editor):
|
||||
context_editor.get_context().should_be_called().will_return("context")
|
||||
context_editor.export_attributes().should_be_called().will_return("attributes")
|
||||
ifc.run("context.edit_context", context="context", attributes="attributes").should_be_called()
|
||||
context_editor.clear_context().should_be_called()
|
||||
subject.edit_context(ifc, context_editor)
|
||||
|
||||
Reference in New Issue
Block a user