import sys import logging logging.root.setLevel(logging.DEBUG) from PyQt4.QtGui import QApplication,QMainWindow,QTextEdit import Path from Vispa.Gui.ToolBoxContainer import ToolBoxContainer from Vispa.Share import Profiling class ToolBoxContainerTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ +': testExample()') self.app = QApplication(sys.argv) self.window = QMainWindow() self.window.setWindowTitle("test ToolBoxContainer") self.app.setActiveWindow(self.window) self.window.show() container = ToolBoxContainer(self.window) self.window.setCentralWidget(container) container.addWidget(QTextEdit("ganz viel text\n mit zeilenumbruechen\n.")) container.addWidget(QTextEdit("anderer inhalt.")) container.show() if not hasattr(unittest,"NO_GUI_TEST"): self.app.exec_() if __name__ == "__main__": Profiling.analyze("unittest.main()",__file__,"ToolBoxContainer")
from TestDataAccessor import TestDataAccessor from Vispa.Share import Profiling class LineDecayViewTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ + ': testExample()') try: from pxl.algorithms import AutoLayout except Exception: logging.info("LineDecayView needs PXL: " + exception_traceback()) return self.app = QApplication(sys.argv) self.window = QMainWindow() self.window.setWindowTitle("test LineDecayView") self.window.resize(300,300) self.app.setActiveWindow(self.window) self.window.show() self.scrollArea = ZoomableScrollArea(self.window) self.window.setCentralWidget(self.scrollArea) self.lineDecayView = LineDecayView() self.scrollArea.setWidget(self.lineDecayView) accessor=TestDataAccessor() self.lineDecayView.setDataAccessor(accessor) self.lineDecayView.setDataObjects(accessor.topLevelObjects()) self.lineDecayView.updateContent() if not hasattr(unittest,"NO_GUI_TEST"): self.app.exec_() if __name__ == "__main__": Profiling.analyze("unittest.main()",__file__,"LineDecayView")
#! /usr/bin/env python import unittest import os.path import sys import logging logging.root.setLevel(logging.DEBUG) import Path from Vispa.Main.Application import Application Application.NO_PROCESS_EVENTS = True from Vispa.Share.ThreadChain import ThreadChain ThreadChain.NO_THREADS_FLAG = True from Vispa.Share import Profiling class MainWindowTestCase(unittest.TestCase): def testRun(self): logging.debug(self.__class__.__name__ + ': testRun()') self.app = Application(sys.argv) self.app.mainWindow().setWindowTitle("test no threads") self.app.run() if __name__ == "__main__": Profiling.analyze("unittest.main()", __file__)
from Vispa.Share.FindAlgorithm import FindAlgorithm from Vispa.Share import Profiling class FindDialogTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ +': testExample()') self.app = QApplication(sys.argv) self.window = QMainWindow() self.app.setActiveWindow(self.window) self._findAlgoritm=FindAlgorithm() accessor=TestDataAccessor() self._findAlgoritm.setDataAccessor(accessor) self._findAlgoritm.setDataObjects(accessor.topLevelObjects()) self._findDialog=FindDialog(self.window) self._findDialog.setFindAlgorithm(self._findAlgoritm) self._findDialog.setLabel("particle") self.app.connect(self._findDialog, SIGNAL("found"), self.found) self._found=False self._findDialog.findNext() self.assertEqual(self._found,True) self._findDialog.onScreen() if not hasattr(unittest,"NO_GUI_TEST"): self.app.exec_() def found(self,object): logging.debug(self.__class__.__name__ +': found '+str(object)) self._found=object=="particle1" if __name__ == "__main__": Profiling.analyze("unittest.main()",__file__,"FindDialog|FindAlgorithm")
self.assertEqual(accessor.numberOfEvents(),10) self.assertEqual(accessor.eventNumber(),1) # self.assertEqual(countMotherRelations(accessor),3) # self.assertEqual(countDaughterRelations(accessor),3) # self.assertEqual(int(float(accessor.propertyValue(accessor.children(accessor.children(accessor.topLevelObjects()[0])[0])[2],"Mass"))),92) accessor.next() self.assertEqual(accessor.eventNumber(),2) # self.assertEqual(int(float(accessor.propertyValue(accessor.children(accessor.children(accessor.topLevelObjects()[0])[0])[2],"Mass"))),96) accessor.first() self.assertEqual(accessor.eventNumber(),1) # self.assertEqual(int(float(accessor.propertyValue(accessor.children(accessor.children(accessor.topLevelObjects()[0])[0])[2],"Mass"))),92) accessor.last() self.assertEqual(accessor.eventNumber(),10) # self.assertEqual(int(float(accessor.propertyValue(accessor.children(accessor.children(accessor.topLevelObjects()[0])[0])[2],"Mass"))),91) accessor.previous() self.assertEqual(accessor.eventNumber(),9) # self.assertEqual(int(float(accessor.propertyValue(accessor.children(accessor.children(accessor.topLevelObjects()[0])[0])[2],"Mass"))),90) accessor.goto(8) self.assertEqual(accessor.eventNumber(),8) # self.assertEqual(int(float(accessor.propertyValue(accessor.children(accessor.children(accessor.topLevelObjects()[0])[0])[2],"Mass"))),89) self.assertEqual(accessor.numberOfEvents(),10) if __name__ == "__main__": Profiling.analyze("unittest.main()",__file__)
import Path from Vispa.Main.Directories import * from Vispa.Gui.ZoomableScrollArea import ZoomableScrollArea from Vispa.Gui.VispaWidget import VispaWidget from Vispa.Gui.ZoomableWidget import ZoomableWidget from TestDataAccessor import TestDataAccessor from Vispa.Share import Profiling class ZoomableWidgetTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ + ': testExample()') self.app = QApplication(sys.argv) self.window = QMainWindow() self.window.setWindowTitle("test ZoomableWidget") self.window.resize(300,300) self.app.setActiveWindow(self.window) self.window.show() self.scrollArea = ZoomableScrollArea(self.window) self.window.setCentralWidget(self.scrollArea) self.zoomableWidget = ZoomableWidget() self.scrollArea.setWidget(self.zoomableWidget) self.widget=VispaWidget(self.zoomableWidget) self.widget.move(10,10) self.widget.show() if not hasattr(unittest,"NO_GUI_TEST"): self.app.exec_() if __name__ == "__main__": Profiling.analyze("unittest.main()",__file__,"ZoomableScrollArea|VispaWidget|ZoomableWidget")
from PyQt4.QtGui import QApplication, QMainWindow import Path from Vispa.Main.Directories import * setBaseDirectory(baseDirectory) from Vispa.Gui.BoxContentDialog import BoxContentDialog from Vispa.Share import Profiling class BoxContentDialogTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ + ": testExample()") self.app = QApplication(sys.argv) self.window = QMainWindow() self.app.setActiveWindow(self.window) self._boxContentDialog = BoxContentDialog(self.window) self._boxContentDialog.addButton("&label", "str(object.label)") self.app.connect(self._boxContentDialog, SIGNAL("scriptChanged"), self.scriptChanged) self._boxContentDialog.onScreen() if not hasattr(unittest, "NO_GUI_TEST"): self.app.exec_() def scriptChanged(self, script): logging.debug(self.__class__.__name__ + ": script changed " + str(script)) if __name__ == "__main__": Profiling.analyze("unittest.main()", __file__, "BoxContentDialog")
logging.root.setLevel(logging.DEBUG) from PyQt4.QtCore import SIGNAL from PyQt4.QtGui import QApplication,QMainWindow import Path from Vispa.Main.Directories import * setBaseDirectory(baseDirectory) from Vispa.Gui.BoxContentDialog import BoxContentDialog from Vispa.Share import Profiling class BoxContentDialogTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ +': testExample()') self.app = QApplication(sys.argv) self.window = QMainWindow() self.app.setActiveWindow(self.window) self._boxContentDialog=BoxContentDialog(self.window) self._boxContentDialog.addButton("&label","str(object.label)") self.app.connect(self._boxContentDialog, SIGNAL("scriptChanged"), self.scriptChanged) self._boxContentDialog.onScreen() if not hasattr(unittest,"NO_GUI_TEST"): self.app.exec_() def scriptChanged(self,script): logging.debug(self.__class__.__name__ +': script changed '+str(script)) if __name__ == "__main__": Profiling.analyze("unittest.main()",__file__,"BoxContentDialog")
import logging logging.root.setLevel(logging.DEBUG) from PyQt4.QtGui import QApplication,QMainWindow import Path from Vispa.Main.Directories import * from Vispa.Views.PropertyView import PropertyView from TestDataAccessor import TestDataAccessor from Vispa.Share import Profiling class PropertyViewTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ +': testExample()') self.app = QApplication(sys.argv) self.window= QMainWindow() self.window.setWindowTitle("test PropertyView") self.app.setActiveWindow(self.window) self.window.show() self.propertyView=PropertyView(self.window) self.window.setCentralWidget(self.propertyView) self.propertyView.setDataAccessor(TestDataAccessor()) self.propertyView.setDataObject("particle1") self.propertyView.updateContent() if not hasattr(unittest,"NO_GUI_TEST"): self.app.exec_() if __name__ == "__main__": Profiling.analyze("unittest.main()",__file__,"PropertyView")
from PyQt4.QtGui import QApplication, QMainWindow import Path from Vispa.Main.Directories import * from Vispa.Views.PropertyView import PropertyView from TestDataAccessor import TestDataAccessor from Vispa.Share import Profiling class PropertyViewTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ + ': testExample()') self.app = QApplication(sys.argv) self.window = QMainWindow() self.window.setWindowTitle("test PropertyView") self.app.setActiveWindow(self.window) self.window.show() self.propertyView = PropertyView(self.window) self.window.setCentralWidget(self.propertyView) self.propertyView.setDataAccessor(TestDataAccessor()) self.propertyView.setDataObject("particle1") self.propertyView.updateContent() if not hasattr(unittest, "NO_GUI_TEST"): self.app.exec_() if __name__ == "__main__": Profiling.analyze("unittest.main()", __file__, "PropertyView")
from Vispa.Gui.ZoomableScrollArea import ZoomableScrollArea from Vispa.Gui.VispaWidget import VispaWidget from Vispa.Gui.ZoomableWidget import ZoomableWidget from TestDataAccessor import TestDataAccessor from Vispa.Share import Profiling class ZoomableWidgetTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ + ': testExample()') self.app = QApplication(sys.argv) self.window = QMainWindow() self.window.setWindowTitle("test ZoomableWidget") self.window.resize(300, 300) self.app.setActiveWindow(self.window) self.window.show() self.scrollArea = ZoomableScrollArea(self.window) self.window.setCentralWidget(self.scrollArea) self.zoomableWidget = ZoomableWidget() self.scrollArea.setWidget(self.zoomableWidget) self.widget = VispaWidget(self.zoomableWidget) self.widget.move(10, 10) self.widget.show() if not hasattr(unittest, "NO_GUI_TEST"): self.app.exec_() if __name__ == "__main__": Profiling.analyze("unittest.main()", __file__, "ZoomableScrollArea|VispaWidget|ZoomableWidget")
class FindDialogTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ + ': testExample()') self.app = QApplication(sys.argv) self.window = QMainWindow() self.app.setActiveWindow(self.window) self._findAlgoritm = FindAlgorithm() accessor = TestDataAccessor() self._findAlgoritm.setDataAccessor(accessor) self._findAlgoritm.setDataObjects(accessor.topLevelObjects()) self._findDialog = FindDialog(self.window) self._findDialog.setFindAlgorithm(self._findAlgoritm) self._findDialog.setLabel("particle") self.app.connect(self._findDialog, SIGNAL("found"), self.found) self._found = False self._findDialog.findNext() self.assertEqual(self._found, True) self._findDialog.onScreen() if not hasattr(unittest, "NO_GUI_TEST"): self.app.exec_() def found(self, object): logging.debug(self.__class__.__name__ + ': found ' + str(object)) self._found = object == "particle1" if __name__ == "__main__": Profiling.analyze("unittest.main()", __file__, "FindDialog|FindAlgorithm")
logging.root.setLevel(logging.DEBUG) from PyQt4.QtGui import QApplication,QMainWindow import Path from Vispa.Main.Directories import * from Vispa.Views.TreeView import TreeView from TestDataAccessor import TestDataAccessor from Vispa.Share import Profiling class TreeViewTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ +': testExample()') self.app = QApplication(sys.argv) self.window= QMainWindow() self.window.setWindowTitle("test TreeView") self.app.setActiveWindow(self.window) self.window.show() self.treeView = TreeView(self.window) self.window.setCentralWidget(self.treeView) accessor=TestDataAccessor() self.treeView.setDataAccessor(accessor) self.treeView.setDataObjects(accessor.topLevelObjects()) self.treeView.updateContent() if not hasattr(unittest,"NO_GUI_TEST"): self.app.exec_() if __name__ == "__main__": Profiling.analyze("unittest.main()",__file__,"TreeView")
from PyQt4.QtGui import QApplication, QMainWindow import Path from Vispa.Main.Directories import * from Vispa.Views.TreeView import TreeView from TestDataAccessor import TestDataAccessor from Vispa.Share import Profiling class TreeViewTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ + ': testExample()') self.app = QApplication(sys.argv) self.window = QMainWindow() self.window.setWindowTitle("test TreeView") self.app.setActiveWindow(self.window) self.window.show() self.treeView = TreeView(self.window) self.window.setCentralWidget(self.treeView) accessor = TestDataAccessor() self.treeView.setDataAccessor(accessor) self.treeView.setDataObjects(accessor.topLevelObjects()) self.treeView.updateContent() if not hasattr(unittest, "NO_GUI_TEST"): self.app.exec_() if __name__ == "__main__": Profiling.analyze("unittest.main()", __file__, "TreeView")
class LineDecayViewTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ + ': testExample()') try: from pxl.algorithms import AutoLayout except Exception: logging.info("LineDecayView needs PXL: " + exception_traceback()) return self.app = QApplication(sys.argv) self.window = QMainWindow() self.window.setWindowTitle("test LineDecayView") self.window.resize(300, 300) self.app.setActiveWindow(self.window) self.window.show() self.scrollArea = ZoomableScrollArea(self.window) self.window.setCentralWidget(self.scrollArea) self.lineDecayView = LineDecayView() self.scrollArea.setWidget(self.lineDecayView) accessor = TestDataAccessor() self.lineDecayView.setDataAccessor(accessor) self.lineDecayView.setDataObjects(accessor.topLevelObjects()) self.lineDecayView.updateContent() if not hasattr(unittest, "NO_GUI_TEST"): self.app.exec_() if __name__ == "__main__": Profiling.analyze("unittest.main()", __file__, "LineDecayView")