Esempio n. 1
0
    def setUp(self):
        '''
        Stardard init method: runs before each test_* method

        Initializes a QtGui.QApplication and ReportEditorApp object.
        ReportEditorApp() causes the UI to be rendered.
        '''
        settings.configdir = tempfile.mkdtemp()

        self.app = QtGui.QApplication([])
        self.report_editor = ReportEditorApp()
        self.report_editor.show()
Esempio n. 2
0
    def setUp(self):
        '''
        Stardard init method: runs before each test_* method

        Initializes a QtGui.QApplication and ReportEditorApp object.
        ReportEditorApp() causes the UI to be rendered.
        '''
        self.profile_manager = ProfileManager(tempfile.mkdtemp())
        profile = self.profile_manager.get('testing')
        config = profile.get_config('freeseer.conf', settings.FreeseerConfig, storage_args=['Global'], read_only=False)
        db = profile.get_database()

        self.app = QtGui.QApplication([])
        self.report_editor = ReportEditorApp(config, db)
        self.report_editor.show()
Esempio n. 3
0
def launch_reporteditor():
    """Launch the Report Editor GUI"""
    import sys
    from PyQt4 import QtGui
    from freeseer.frontend.reporteditor.reporteditor import ReportEditorApp

    profile = settings.profile_manager.get()
    config = profile.get_config('freeseer.conf', settings.FreeseerConfig,
                                storage_args=['Global'], read_only=True)
    db = profile.get_database()

    app = QtGui.QApplication(sys.argv)
    main = ReportEditorApp(config, db)
    main.show()
    sys.exit(app.exec_())
Esempio n. 4
0
def launch_reporteditor():
    """Launch the Report Editor GUI"""
    import sys
    from PyQt4 import QtGui
    from freeseer.frontend.reporteditor.reporteditor import ReportEditorApp

    profile = settings.profile_manager.get()
    config = profile.get_config('freeseer.conf',
                                settings.FreeseerConfig,
                                storage_args=['Global'],
                                read_only=True)
    db = profile.get_database()

    app = QtGui.QApplication(sys.argv)
    main = ReportEditorApp(config, db)
    main.show()
    sys.exit(app.exec_())
Esempio n. 5
0
	def setUp(self):
		'''
		Stardard init method: runs before each test_* method

		Initializes a QtGui.QApplication and ReportEditorApp object.
		ReportEditorApp() causes the UI to be rendered.
		'''

		self.app = QtGui.QApplication([])
		self.report_editor = ReportEditorApp()
		self.report_editor.show()
Esempio n. 6
0
class TestReportEditorApp(unittest.TestCase):
    '''
    Test cases for ReportEditorApp.
    '''

    def setUp(self):
        '''
        Stardard init method: runs before each test_* method

        Initializes a QtGui.QApplication and ReportEditorApp object.
        ReportEditorApp() causes the UI to be rendered.
        '''
        self.profile_manager = ProfileManager(tempfile.mkdtemp())
        profile = self.profile_manager.get('testing')
        config = profile.get_config('freeseer.conf', settings.FreeseerConfig, storage_args=['Global'], read_only=False)
        db = profile.get_database()

        self.app = QtGui.QApplication([])
        self.report_editor = ReportEditorApp(config, db)
        self.report_editor.show()

    def tearDown(self):
        shutil.rmtree(self.profile_manager._base_folder)
        del self.app
        del self.report_editor.app

    def test_close_report_editor(self):
        '''
        Tests closing the ReportEditorApp
        '''

        QtTest.QTest.mouseClick(self.report_editor.editorWidget.closeButton, Qt.Qt.LeftButton)
        self.assertFalse(self.report_editor.editorWidget.isVisible())

    def test_file_menu_quit(self):
        '''
        Tests ReportEditorApp's File->Quit
        '''

        self.assertTrue(self.report_editor.isVisible())

        # File->Menu
        self.report_editor.actionExit.trigger()
        self.assertFalse(self.report_editor.isVisible())

    def test_help_menu_about(self):
        '''
        Tests ReportEditorApp's Help->About
        '''

        self.assertTrue(self.report_editor.isVisible())

        # Help->About
        self.report_editor.actionAbout.trigger()
        self.assertFalse(self.report_editor.hasFocus())
        self.assertTrue(self.report_editor.aboutDialog.isVisible())

        # Click "Close"
        QtTest.QTest.mouseClick(self.report_editor.aboutDialog.closeButton, Qt.Qt.LeftButton)
        self.assertFalse(self.report_editor.aboutDialog.isVisible())
Esempio n. 7
0
class TestReportEditorApp(unittest.TestCase):
    '''
    Test cases for ReportEditorApp. 
    '''

    def setUp(self):
        '''
        Stardard init method: runs before each test_* method

        Initializes a QtGui.QApplication and ReportEditorApp object.
        ReportEditorApp() causes the UI to be rendered.
        '''
        settings.configdir = tempfile.mkdtemp()

        self.app = QtGui.QApplication([])
        self.report_editor = ReportEditorApp()
        self.report_editor.show()

    def tearDown(self):
        shutil.rmtree(settings.configdir)
        del self.app
        del self.report_editor.app


    def test_close_report_editor(self):
        '''
        Tests closing the ReportEditorApp
        '''

        QtTest.QTest.mouseClick(self.report_editor.editorWidget.closeButton, Qt.Qt.LeftButton)
        self.assertFalse(self.report_editor.editorWidget.isVisible())

    
    def test_file_menu_quit(self):
        '''
        Tests ReportEditorApp's File->Quit
        '''

        self.assertTrue(self.report_editor.isVisible())

        # File->Menu
        self.report_editor.actionExit.trigger()
        self.assertFalse(self.report_editor.isVisible())

    def test_help_menu_about(self):
        '''
        Tests ReportEditorApp's Help->About
        '''

        self.assertTrue(self.report_editor.isVisible())

        # Help->About   
        self.report_editor.actionAbout.trigger()
        self.assertFalse(self.report_editor.hasFocus())
        self.assertTrue(self.report_editor.aboutDialog.isVisible())

        # Click "Close"
        QtTest.QTest.mouseClick(self.report_editor.aboutDialog.closeButton, Qt.Qt.LeftButton)
        self.assertFalse(self.report_editor.aboutDialog.isVisible())
Esempio n. 8
0
class TestReportEditorApp(unittest.TestCase):
    '''
    Test cases for ReportEditorApp.
    '''
    def setUp(self):
        '''
        Stardard init method: runs before each test_* method

        Initializes a QtGui.QApplication and ReportEditorApp object.
        ReportEditorApp() causes the UI to be rendered.
        '''
        settings.configdir = tempfile.mkdtemp()

        self.app = QtGui.QApplication([])
        self.report_editor = ReportEditorApp()
        self.report_editor.show()

    def tearDown(self):
        shutil.rmtree(settings.configdir)
        del self.app
        del self.report_editor.app

    def test_close_report_editor(self):
        '''
        Tests closing the ReportEditorApp
        '''

        QtTest.QTest.mouseClick(self.report_editor.editorWidget.closeButton,
                                Qt.Qt.LeftButton)
        self.assertFalse(self.report_editor.editorWidget.isVisible())

    def test_file_menu_quit(self):
        '''
        Tests ReportEditorApp's File->Quit
        '''

        self.assertTrue(self.report_editor.isVisible())

        # File->Menu
        self.report_editor.actionExit.trigger()
        self.assertFalse(self.report_editor.isVisible())

    def test_help_menu_about(self):
        '''
        Tests ReportEditorApp's Help->About
        '''

        self.assertTrue(self.report_editor.isVisible())

        # Help->About
        self.report_editor.actionAbout.trigger()
        self.assertFalse(self.report_editor.hasFocus())
        self.assertTrue(self.report_editor.aboutDialog.isVisible())

        # Click "Close"
        QtTest.QTest.mouseClick(self.report_editor.aboutDialog.closeButton,
                                Qt.Qt.LeftButton)
        self.assertFalse(self.report_editor.aboutDialog.isVisible())

    def test_pep8(self):
        checker = pep8.StyleGuide(**pep8_options)
        report = checker.check_files([
            'freeseer/tests/frontend/reporteditor',
            'freeseer/frontend/reporteditor'
        ])
        pep8_report(self, report)