Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
soitool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bachelor-paa-bittet
soitool
Commits
d08a3637
Commit
d08a3637
authored
5 years ago
by
Thomas Holene Løkkeborg
Browse files
Options
Downloads
Patches
Plain Diff
#54 test for exception ved for store moduler
parent
98c2602a
No related branches found
Branches containing commit
No related tags found
1 merge request
!28
#54 Rectpack for reorganisering av moduler + litt black
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_soi.py
+41
-1
41 additions, 1 deletion
test/test_soi.py
with
41 additions
and
1 deletion
test/test_soi.py
+
41
−
1
View file @
d08a3637
...
...
@@ -14,7 +14,7 @@ import unittest
from
PySide2.QtWidgets
import
QApplication
,
QWidget
from
PySide2
import
QtGui
from
PySide2.QtGui
import
QPalette
,
QColor
from
soitool.soi
import
SOI
from
soitool.soi
import
SOI
,
ModuleLargerThanBinError
from
soitool.modules.module_base
import
ModuleBase
if
isinstance
(
QtGui
.
qApp
,
type
(
None
)):
...
...
@@ -157,3 +157,43 @@ class TestSOI(unittest.TestCase):
self
.
soi
.
add_reorganization_listener
(
listener
)
self
.
soi
.
reorganize
()
self
.
assertTrue
(
listener_was_called
)
def
test_reorganize_of_too_big_module
(
self
):
"""
Test exception thrown by reorganize in case of too large modules.
"""
maximum_width
=
self
.
soi
.
CONTENT_WIDTH
maximum_height
=
self
.
soi
.
CONTENT_HEIGHT
-
self
.
soi
.
HEADER_HEIGHT
module_too_wide
=
{
"
widget
"
:
TestModule
(
"
red
"
,
maximum_width
+
1
,
100
),
"
meta
"
:
{
"
x
"
:
0
,
"
y
"
:
0
,
"
page
"
:
1
,
"
name
"
:
"
tall_module
"
},
}
module_too_tall
=
{
"
widget
"
:
TestModule
(
"
red
"
,
100
,
maximum_height
+
1
),
"
meta
"
:
{
"
x
"
:
0
,
"
y
"
:
0
,
"
page
"
:
1
,
"
name
"
:
"
tall_module
"
},
}
module_maximum_size
=
{
"
widget
"
:
TestModule
(
"
red
"
,
maximum_width
,
maximum_height
),
"
meta
"
:
{
"
x
"
:
0
,
"
y
"
:
0
,
"
page
"
:
1
,
"
name
"
:
"
tall_module
"
},
}
# too wide module should raise exception
self
.
soi
.
modules
=
[
module_too_wide
]
self
.
assertRaises
(
ModuleLargerThanBinError
,
self
.
soi
.
reorganize
,
)
# too tall module should raise exception
self
.
soi
.
modules
=
[
module_too_tall
]
self
.
assertRaises
(
ModuleLargerThanBinError
,
self
.
soi
.
reorganize
,
)
# module with maximum size shouldn't cause any exception
self
.
soi
.
modules
=
[
module_maximum_size
]
try
:
self
.
soi
.
reorganize
()
except
ModuleLargerThanBinError
:
self
.
fail
(
"
ModuleLargerThanBinError was raised even though module was
"
"
not too large
"
)
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