Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
64fdf6c6
Commit
64fdf6c6
authored
2 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Even more test coverage
parent
37f0f376
No related branches found
No related tags found
No related merge requests found
Pipeline
#88136
passed
2 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/test_gui.py
+51
-1
51 additions, 1 deletion
test/test_gui.py
test/test_gui/twotapfir.py
+1
-1
1 addition, 1 deletion
test/test_gui/twotapfir.py
with
52 additions
and
2 deletions
test/test_gui.py
+
51
−
1
View file @
64fdf6c6
from
qtpy
import
QtCore
import
pytest
import
pytest
try
:
try
:
...
@@ -35,7 +38,6 @@ def test_flip(qtbot, datadir):
...
@@ -35,7 +38,6 @@ def test_flip(qtbot, datadir):
assert
not
dragbutton
.
is_flipped
()
assert
not
dragbutton
.
is_flipped
()
dragbutton
.
_flip
()
dragbutton
.
_flip
()
assert
dragbutton
.
is_flipped
()
assert
dragbutton
.
is_flipped
()
widget
.
exit_app
()
widget
.
exit_app
()
...
@@ -52,3 +54,51 @@ def test_sfg_invalidated_by_remove_of_operation(qtbot, datadir):
...
@@ -52,3 +54,51 @@ def test_sfg_invalidated_by_remove_of_operation(qtbot, datadir):
assert
ops_before_remove
-
1
==
len
(
widget
.
operationDragDict
)
assert
ops_before_remove
-
1
==
len
(
widget
.
operationDragDict
)
widget
.
exit_app
()
widget
.
exit_app
()
def
test_select_operation
(
qtbot
,
datadir
):
widget
=
GUI
.
MainWindow
()
qtbot
.
addWidget
(
widget
)
widget
.
_load_from_file
(
datadir
.
join
(
'
twotapfir.py
'
))
sfg
=
widget
.
sfg_dict
[
'
twotapfir
'
]
op
=
sfg
.
find_by_name
(
"
cmul2
"
)[
0
]
dragbutton
=
widget
.
operationDragDict
[
op
]
assert
not
dragbutton
.
pressed
assert
not
widget
.
pressed_operations
# Click
qtbot
.
mouseClick
(
dragbutton
,
QtCore
.
Qt
.
MouseButton
.
LeftButton
)
assert
dragbutton
.
pressed
assert
len
(
widget
.
pressed_operations
)
==
1
# Click again, should unselect
qtbot
.
mouseClick
(
dragbutton
,
QtCore
.
Qt
.
MouseButton
.
LeftButton
)
# Currently failing
# assert not dragbutton.pressed
# assert not widget.pressed_operations
# Select another operation
op2
=
sfg
.
find_by_name
(
"
add1
"
)[
0
]
dragbutton2
=
widget
.
operationDragDict
[
op2
]
assert
not
dragbutton2
.
pressed
# Click
qtbot
.
mouseClick
(
dragbutton2
,
QtCore
.
Qt
.
MouseButton
.
LeftButton
)
assert
dragbutton2
.
pressed
# Unselect previous
assert
not
dragbutton
.
pressed
assert
len
(
widget
.
pressed_operations
)
==
1
# Control-click first
qtbot
.
mouseClick
(
dragbutton
,
QtCore
.
Qt
.
MouseButton
.
LeftButton
,
QtCore
.
Qt
.
KeyboardModifier
.
ControlModifier
)
assert
dragbutton2
.
pressed
assert
dragbutton
.
pressed
assert
len
(
widget
.
pressed_operations
)
==
2
# Control-click second
qtbot
.
mouseClick
(
dragbutton2
,
QtCore
.
Qt
.
MouseButton
.
LeftButton
,
QtCore
.
Qt
.
KeyboardModifier
.
ControlModifier
)
assert
not
dragbutton2
.
pressed
assert
dragbutton
.
pressed
assert
len
(
widget
.
pressed_operations
)
==
1
widget
.
exit_app
()
This diff is collapsed.
Click to expand it.
test/test_gui/twotapfir.py
+
1
−
1
View file @
64fdf6c6
...
@@ -14,7 +14,7 @@ out1 = Output(name="")
...
@@ -14,7 +14,7 @@ out1 = Output(name="")
# Operations:
# Operations:
t1
=
Delay
(
initial_value
=
0
,
name
=
""
)
t1
=
Delay
(
initial_value
=
0
,
name
=
""
)
cmul1
=
ConstantMultiplication
(
value
=
0.5
,
name
=
"
cmul2
"
,
latency_offsets
=
{
'
in0
'
:
None
,
'
out0
'
:
None
})
cmul1
=
ConstantMultiplication
(
value
=
0.5
,
name
=
"
cmul2
"
,
latency_offsets
=
{
'
in0
'
:
None
,
'
out0
'
:
None
})
add1
=
Addition
(
name
=
""
,
latency_offsets
=
{
'
in0
'
:
None
,
'
in1
'
:
None
,
'
out0
'
:
None
})
add1
=
Addition
(
name
=
"
add1
"
,
latency_offsets
=
{
'
in0
'
:
None
,
'
in1
'
:
None
,
'
out0
'
:
None
})
cmul2
=
ConstantMultiplication
(
value
=
0.5
,
name
=
"
cmul
"
,
latency_offsets
=
{
'
in0
'
:
None
,
'
out0
'
:
None
})
cmul2
=
ConstantMultiplication
(
value
=
0.5
,
name
=
"
cmul
"
,
latency_offsets
=
{
'
in0
'
:
None
,
'
out0
'
:
None
})
# Signals:
# Signals:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment