diff --git a/beat/editor/test/test_editors.py b/beat/editor/test/test_editors.py index 4ec4257c7586f1ac374fd57b05dcd4b9c8ea31b4..bf2e9f9016c5c023bba07198da37844626ab0f7e 100644 --- a/beat/editor/test/test_editors.py +++ b/beat/editor/test/test_editors.py @@ -33,6 +33,7 @@ from PyQt5.QtWidgets import QVBoxLayout from ..widgets.editor import AbstractAssetEditor from ..widgets.field import FieldWidget +from ..widgets.description import DescriptionWidget class MockAssetEditor(AbstractAssetEditor): @@ -76,6 +77,25 @@ class MockAssetEditor(AbstractAssetEditor): 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() def dataformat_model(): @@ -121,3 +141,12 @@ class TestMockEditor: field.format_type = "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