Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
GEPARD
GEPARD
Commits
3ea1dd25
Commit
3ea1dd25
authored
Oct 14, 2020
by
Elisa Kanaki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Tiling2Develop' of
https://gitlab.ipfdd.de/GEPARD/gepard
into Tiling2Develop
parents
9b215a0d
9faf6df1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
21 deletions
+25
-21
sampleview.py
sampleview.py
+8
-7
specScan.py
specScan.py
+0
-1
unittests/runAllTests.py
unittests/runAllTests.py
+9
-3
unittests/test_specscanui.py
unittests/test_specscanui.py
+2
-10
unittests/test_workModes.py
unittests/test_workModes.py
+6
-0
No files found.
sampleview.py
View file @
3ea1dd25
...
...
@@ -206,13 +206,14 @@ class SampleView(QtWidgets.QGraphicsView):
Adds a new handler to the logger to create a log also in the dataset directory
:return:
"""
logPath
=
os
.
path
.
join
(
self
.
dataset
.
path
,
'gepardLog.txt'
)
self
.
logger
.
info
(
f
'creating new log handler to path:
{
logPath
}
'
)
self
.
logger
.
addHandler
(
logging
.
handlers
.
RotatingFileHandler
(
logPath
,
maxBytes
=
5
*
(
1
<<
20
),
backupCount
=
10
)
)
setDefaultLoggingConfig
(
self
.
logger
)
if
self
.
dataset
.
path
!=
''
:
logPath
=
os
.
path
.
join
(
self
.
dataset
.
path
,
'gepardLog.txt'
)
self
.
logger
.
info
(
f
'creating new log handler to path:
{
logPath
}
'
)
self
.
logger
.
addHandler
(
logging
.
handlers
.
RotatingFileHandler
(
logPath
,
maxBytes
=
5
*
(
1
<<
20
),
backupCount
=
10
)
)
setDefaultLoggingConfig
(
self
.
logger
)
def
setupParticleEditor
(
self
):
"""
...
...
specScan.py
View file @
3ea1dd25
...
...
@@ -100,7 +100,6 @@ def getShortestPath(_points: np.ndarray) -> List[int]:
:param _points: (N, 2) shape array of x, y coordinates
:returns: list of indices of shortest path to visit all points
"""
print
(
'SHORTEST PATH HERE'
)
numPoints
:
int
=
_points
.
shape
[
0
]
shortestPath
:
List
[
int
]
=
list
(
np
.
arange
(
numPoints
,
dtype
=
np
.
int
))
if
numPoints
>=
4
:
# the tsp needs at least four points (swap of two pairs of points concurrently)
...
...
unittests/runAllTests.py
View file @
3ea1dd25
...
...
@@ -6,6 +6,7 @@ imports work..). Then they have to be added to the allTests-List direclty below.
import
unittest
import
sys
import
inspect
import
os
scriptFolder
=
os
.
path
.
realpath
(
__file__
)
gepardParentFolder
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
scriptFolder
)))
# three levels up..
...
...
@@ -25,13 +26,18 @@ allTests: list = [TestCoordinateTransform, TestTSP, Test_FakeCamera, TestSimulat
def
makeTestSuiteRunnable
(
suite
:
unittest
.
TestSuite
):
"""The unittests need a runTest-Method when called this way.
Let's just create a fake one here on the fly.."""
def
passMethod
():
pass
def
makeRunTestLambda
(
_testCase
:
unittest
.
TestCase
):
return
lambda
:
runTestStartWith_test_
(
_testCase
)
def
runTestStartWith_test_
(
_testCase
:
unittest
.
TestCase
):
for
methodName
,
method
in
inspect
.
getmembers
(
_testCase
,
predicate
=
inspect
.
ismethod
):
if
methodName
.
startswith
(
"test_"
):
method
()
for
testCase
in
suite
.
_tests
:
runMethod
=
getattr
(
testCase
,
"runTest"
,
None
)
if
not
callable
(
runMethod
):
testCase
.
runTest
=
passMethod
testCase
.
runTest
=
makeRunTestLambda
(
testCase
)
testSuite
:
unittest
.
TestSuite
=
unittest
.
TestSuite
()
...
...
unittests/test_specscanui.py
View file @
3ea1dd25
import
unittest
import
sys
from
PyQt5
import
QtWidgets
from
.testhelpers
import
getDefaultSampleview
from
..gui.specscanui
import
SpecScanUI
app
:
QtWidgets
.
QApplication
=
QtWidgets
.
QApplication
(
sys
.
argv
)
class
TestSpecScanUI
(
unittest
.
TestCase
):
def
setUp
(
self
)
->
None
:
self
.
specScanUI
:
SpecScanUI
=
SpecScanUI
(
getDefaultSampleview
())
self
.
specScanUI
.
view
.
imparent
.
hide
()
def
testLayout
(
self
)
->
None
:
self
.
specScanUI
.
show
()
app
.
exec_
()
def
tearDown
(
self
)
->
None
:
app
.
closeAllWindows
()
\ No newline at end of file
def
test_layout
(
self
)
->
None
:
self
.
specScanUI
.
show
()
\ No newline at end of file
unittests/test_workModes.py
View file @
3ea1dd25
...
...
@@ -44,6 +44,12 @@ class TestWorkModes(unittest.TestCase):
def
setImageCenter
(
self
,
center
=
None
):
pass
def
show
(
self
):
pass
def
hide
(
self
):
pass
sampleview
=
self
.
gepard
.
view
sampleview
.
moveStageToPosition
=
MagicMock
()
self
.
modeHandler
.
detectMode
.
widget
=
FakeDetectViewWidget
()
...
...
Write
Preview
Markdown
is supported
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