Skip to content
Snippets Groups Projects
Commit 71baf4b3 authored by Flavio TARSETTI's avatar Flavio TARSETTI Committed by Flavio TARSETTI
Browse files

[test] adding tests for reusable component description

parent 722ea169
No related branches found
No related tags found
1 merge request!55Reusable widget short description
...@@ -33,6 +33,7 @@ from PyQt5.QtWidgets import QVBoxLayout ...@@ -33,6 +33,7 @@ from PyQt5.QtWidgets import QVBoxLayout
from ..widgets.editor import AbstractAssetEditor from ..widgets.editor import AbstractAssetEditor
from ..widgets.field import FieldWidget from ..widgets.field import FieldWidget
from ..widgets.description import DescriptionWidget
class MockAssetEditor(AbstractAssetEditor): class MockAssetEditor(AbstractAssetEditor):
...@@ -76,6 +77,25 @@ class MockAssetEditor(AbstractAssetEditor): ...@@ -76,6 +77,25 @@ class MockAssetEditor(AbstractAssetEditor):
return json_data return json_data
def set_description(self, desc):
"""Sets the text description of the asset"""
description = DescriptionWidget()
description.short_description = desc
self.layout().addWidget(description)
def get_description(self):
"""Returns the text description of the asset"""
description_list = self.findChildren(DescriptionWidget)
text_data = None
description = description_list[0]
text_data = description.short_description
return text_data
@pytest.fixture() @pytest.fixture()
def dataformat_model(): def dataformat_model():
...@@ -121,3 +141,12 @@ class TestMockEditor: ...@@ -121,3 +141,12 @@ class TestMockEditor:
field.format_type = "float64" field.format_type = "float64"
assert widget.dump_json() == {"value32": "float32", "value64": "float64"} assert widget.dump_json() == {"value32": "float32", "value64": "float64"}
def test_description_set_and_get(self, qtbot, dataformat_model):
text_reference = "short descr1iption of a beat object"
widget = MockAssetEditor()
widget.set_dataformat_model(dataformat_model)
widget.set_description(text_reference)
assert widget.get_description() == text_reference
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment