Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.editor
Commits
71baf4b3
Commit
71baf4b3
authored
Feb 20, 2019
by
Flavio TARSETTI
Committed by
Flavio TARSETTI
Feb 25, 2019
Browse files
[test] adding tests for reusable component description
parent
722ea169
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/editor/test/test_editors.py
View file @
71baf4b3
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment