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
7a8e807d
Commit
7a8e807d
authored
5 years ago
by
morkolai
Browse files
Options
Downloads
Patches
Plain Diff
#96 Fullført tester.
parent
16e77a22
No related branches found
Branches containing commit
No related tags found
1 merge request
!57
#96 Telefonliste & Fiks til høyde på tabeller (rundt oppløsning)
Pipeline
#83639
failed
5 years ago
Stage: lint
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_module_phonebook.py
+32
-11
32 additions, 11 deletions
test/test_module_phonebook.py
with
32 additions
and
11 deletions
test/test_module_phonebook.py
+
32
−
11
View file @
7a8e807d
...
...
@@ -4,7 +4,12 @@ import unittest
from
PySide2.QtGui
import
qApp
,
QKeySequence
from
PySide2.QtCore
import
Qt
,
QTimer
from
PySide2.QtTest
import
QTest
from
PySide2.QtWidgets
import
QApplication
,
QCheckBox
,
QPushButton
from
PySide2.QtWidgets
import
(
QApplication
,
QCheckBox
,
QPushButton
,
QTableWidgetItem
,
)
from
soitool.soi
import
SOI
from
soitool.modules.module_phonebook
import
(
PhonebookModule
,
...
...
@@ -30,14 +35,14 @@ class TestPhonebokkModule(unittest.TestCase):
"""
Test header is correct.
"""
self
.
assertEqual
(
self
.
phonebook
.
header
.
text
(),
"
Telefonliste
"
)
def
test_
type_table
(
self
):
def
test_
resize_width
(
self
):
"""
Test able to type in table and resize to content.
"""
rambo_quote
=
"
Live for nothing or die for something.
"
self
.
phonebook
.
table
.
setCurrentCell
(
1
,
0
)
QTest
.
keyClicks
(
self
.
phonebook
.
table
,
rambo_quote
)
print
(
self
.
phonebook
.
table
.
currentItem
().
text
()
)
# TODO
item
=
QTableWidgetItem
(
rambo_quote
)
old_width
=
self
.
phonebook
.
minimumWidth
(
)
self
.
phonebook
.
table
.
setItem
(
1
,
0
,
item
)
new_width
=
self
.
phonebook
.
minimumWidth
()
self
.
assertGreater
(
new_width
,
old_width
)
def
test_popup
(
self
):
"""
Test popup is shown and i able to edit columns.
"""
...
...
@@ -64,18 +69,21 @@ class TestPhonebokkModule(unittest.TestCase):
new_column_count
=
visible_columns_in
(
self
.
phonebook
.
table
)
self
.
assertEqual
(
new_column_count
,
old_column_count
+
1
)
def
test_add_row
(
self
):
"""
Test adding row.
"""
def
test_add_row
_and_resize
(
self
):
"""
Test adding row
and resizes acordingly
.
"""
old_row_count
=
self
.
phonebook
.
table
.
rowCount
()
old_height
=
self
.
phonebook
.
minimumHeight
()
QTest
.
keySequence
(
self
.
phonebook
,
QKeySequence
(
Qt
.
ControlModifier
+
Qt
.
Key_Plus
)
)
new_row_count
=
self
.
phonebook
.
table
.
rowCount
()
new_height
=
self
.
phonebook
.
minimumHeight
()
self
.
assertEqual
(
new_row_count
,
old_row_count
+
1
)
self
.
assertGreater
(
new_height
,
old_height
)
def
test_remove_row
(
self
):
"""
Test removing row.
"""
self
.
phonebook
.
table
.
setRowCount
(
self
.
phonebook
.
table
.
rowCount
()
+
1
)
self
.
phonebook
.
table
.
setRowCount
(
self
.
phonebook
.
table
.
rowCount
()
+
5
)
old_row_count
=
self
.
phonebook
.
table
.
rowCount
()
self
.
phonebook
.
table
.
setCurrentCell
(
1
,
0
)
QTest
.
keySequence
(
...
...
@@ -84,8 +92,14 @@ class TestPhonebokkModule(unittest.TestCase):
new_row_count
=
self
.
phonebook
.
table
.
rowCount
()
self
.
assertEqual
(
new_row_count
,
old_row_count
-
1
)
def
test_buttons_visibility
(
self
):
"""
Test buttons only are visible when mouse is in widgets space.
"""
self
.
assertFalse
(
self
.
phonebook
.
buttons
.
isVisible
())
QTest
.
mouseMove
(
self
.
phonebook
.
buttons
)
self
.
assertTrue
(
self
.
phonebook
.
table
.
isVisible
())
def
test_add_to_soi_smoke_test
(
self
):
"""
Test that can add to SOI sccessfully.
"""
"""
Test that can add to SOI s
u
ccessfully.
"""
soi
=
SOI
()
test_name
=
"
Test name
"
soi
.
add_module
(
test_name
,
self
.
phonebook
,
False
)
...
...
@@ -125,6 +139,13 @@ class TestPhonebookModuleWithDataParameter(unittest.TestCase):
current_text
,
self
.
data
[
column_header
][
row_index
-
1
]
)
def
test_add_to_soi_smoketest
(
self
):
"""
Test that can add to SOI successfully.
"""
soi
=
SOI
()
test_name
=
"
Test name
"
soi
.
add_module
(
test_name
,
self
.
phonebook
,
False
)
self
.
assertTrue
(
soi
.
module_name_taken
(
test_name
))
def
visible_columns_in
(
table
):
"""
Count number of visible columns in a table.
...
...
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