-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import pytest | ||
|
||
import mapmanagercore.data | ||
|
||
from pymapmanager.interface2 import PyMapManagerApp | ||
from pymapmanager.interface2.stackWidgets import stackWidget2 | ||
from pymapmanager.interface2.stackWidgets.event.spineEvent import EditSpinePropertyEvent, DeleteSpineEvent | ||
from pymapmanager._logger import logger | ||
|
||
# this makes qapp be our PyMapManagerApp, it is derived from QApplication | ||
@pytest.fixture(scope="session") | ||
def qapp_cls(): | ||
return PyMapManagerApp | ||
|
||
@pytest.fixture | ||
def stackWidgetObject(qtbot, qapp): | ||
# path = '../PyMapManager-Data/maps/rr30a/rr30a_s0_ch2.tif' | ||
path = mapmanagercore.data.getSingleTimepointMap() | ||
sw = stackWidget2(path=path) | ||
|
||
# sw.showScatterPlot2(show=True) | ||
# sw.showAnalysisParams() | ||
|
||
return sw | ||
|
||
def test_deleteSpine(stackWidgetObject, qapp): | ||
spineID = 2 | ||
dse = DeleteSpineEvent(stackWidgetObject, spineID=spineID) | ||
|
||
def test_editSpineProperty(stackWidgetObject, qapp): | ||
logger.info('') | ||
|
||
assert stackWidgetObject is not None | ||
assert isinstance(stackWidgetObject, stackWidget2) | ||
|
||
# path = '../PyMapManager-Data/maps/rr30a/rr30a_s0_ch2.tif' | ||
# sw = stackWidget2(path=path) | ||
|
||
spineID = 2 | ||
col = 'userType' | ||
value = 12 | ||
|
||
esp = EditSpinePropertyEvent(stackWidgetObject, spineID=spineID, col=col, value=value) | ||
|
||
spineID = 5 | ||
col = 'accept' | ||
value = True # str, int, float | ||
esp.addEdit(spineID, col, value) | ||
|
||
for idx, oneEdit in enumerate(esp): | ||
print(' ', idx, oneEdit) | ||
|
||
# print('getList:', esp.getList()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import os | ||
import sys | ||
import pytest | ||
|
||
import mapmanagercore.data | ||
|
||
from pymapmanager.interface2.pyMapManagerApp2 import PyMapManagerApp | ||
from pymapmanager.interface2.stackWidgets import stackWidget2 | ||
|
||
from pymapmanager._logger import logger | ||
|
||
# this makes qapp be our PyMapManagerApp, it is derived from QApplication | ||
@pytest.fixture(scope="session") | ||
def qapp_cls(): | ||
return PyMapManagerApp | ||
|
||
# def test_stack_plugins(): | ||
# # logger.info(f'calling pyMapManagerApp.loadPlugins()') | ||
|
||
# app = PyMapManagerApp() | ||
|
||
# _stack = app.getStackPluginDict() | ||
# _map = app.getMapPluginDict() | ||
|
||
# # for k,v in pluginDict.items(): | ||
# # logger.info(k) | ||
# # # logger.info(v) | ||
# # for k2, v2 in v.items(): | ||
# # logger.info(f' {k2}: {v2}') | ||
|
||
def test_plugins(qtbot, qapp): | ||
"""Run all plugins through a number of different tests. | ||
""" | ||
|
||
print('qapp:', qapp) | ||
|
||
mmapPath = mapmanagercore.data.getSingleTimepointMap() | ||
|
||
logger.info(f'opening stack widget path {mmapPath}') | ||
stackWidgetWindow = stackWidget2(path=mmapPath) | ||
|
||
# get list of all stack widgets from app, keys are class of plugin | ||
stackPluginDict = qapp.getStackPluginDict() | ||
|
||
for pluginName, _dict in stackPluginDict.items(): | ||
# if pluginName in ['Point List', 'Line List', 'Histogram', 'Search Widget', 'Selection Widget']: | ||
# stackWidgetWindow.runPlugin(pluginName) | ||
|
||
if pluginName in ['Stack Widget', 'line plot', 'point plot', 'not assigned']: | ||
# stack widget is special | ||
continue | ||
|
||
logger.info(f'running plugin: {pluginName}') | ||
stackWidgetWindow.runPlugin(pluginName) | ||
|
||
stackWidgetWindow.zoomToPointAnnotation(5) | ||
|
||
if __name__ == '__main__': | ||
pass |