Пример #1
0
class FiddleTestFixture(unittest.TestCase):
    def setUp(self):
        self.app = app
        self.form = MainWindow(app=app)
        self.this_dir = os.path.dirname(__file__)
        self.data_dir = os.path.join(self.this_dir, 'data')

    def tearDown(self):
        self.form.stop()
Пример #2
0
    def __init__(self, *args):
        QtGui.QApplication.__init__(self, *args)
        pargs = parser.parse_args()

        self.main = MainWindow(self, files=pargs.files)
        self.main.setStyleSheet(WINDOW_STYLE)

        self.aboutToQuit.connect(self.byebye)
        self.main.show()
        self.main.raise_()
Пример #3
0
 def setUp(self):
     self.app = app
     self.form = MainWindow(app=app)
     self.this_dir = os.path.dirname(__file__)
     self.data_dir = os.path.join(self.this_dir, 'data')
Пример #4
0
class FiddleFiletypesTest(unittest.TestCase):
    def setUp(self):
        self.app = app
        self.form = MainWindow(app=app)
        self.this_dir = os.path.dirname(__file__)
        self.data_dir = os.path.join(self.this_dir, 'data')

    def tearDown(self):
        self.form.stop()

    def test_unicode_open_saveas(self):
        srcpath = os.path.join(self.data_dir, 'utf8_test.txt')
        destpath = os.path.join(self.this_dir, 'utf8_test_temp.txt')
        srchash = sha_hash_file(srcpath)
        self.form.open_filepath(srcpath)
        tab = self.form.ui.documents_tabWidget.currentWidget()
        tab._write_file(destpath)
        desthash = sha_hash_file(destpath)
        self.assertEqual(srchash, desthash)
        os.remove(destpath)

    def test_win1252_open_saveas(self):
        srcpath = os.path.join(self.data_dir, 'win1252_test.txt')
        destpath = os.path.join(self.this_dir, 'win1252_test_temp.txt')
        srchash = sha_hash_file(srcpath)
        self.form.open_filepath(srcpath)
        tab = self.form.ui.documents_tabWidget.currentWidget()
        tab._write_file(destpath)
        desthash = sha_hash_file(destpath)
        self.assertEqual(srchash, desthash)
        os.remove(destpath)

    def test_pyfile_open(self):
        srcpath = os.path.join(self.data_dir, 'server.py')
        self.form.open_filepath(srcpath)
        tab = self.form.ui.documents_tabWidget.currentWidget()
        self.assertIsInstance(tab.editor, PythonEditor)

    def test_jsfile_open(self):
        srcpath = os.path.join(self.data_dir, 'main.js')
        self.form.open_filepath(srcpath)
        tab = self.form.ui.documents_tabWidget.currentWidget()
        self.assertIsInstance(tab.editor, JavascriptEditor)

    def test_htmlfile_open(self):
        srcpath = os.path.join(self.data_dir, 'index.html')
        self.form.open_filepath(srcpath)
        tab = self.form.ui.documents_tabWidget.currentWidget()
        self.assertIsInstance(tab.editor, HTMLEditor)

    def test_cssfile_open(self):
        srcpath = os.path.join(self.data_dir, 'main.css')
        self.form.open_filepath(srcpath)
        tab = self.form.ui.documents_tabWidget.currentWidget()
        self.assertIsInstance(tab.editor, CSSEditor)