def test_human(self): self.root.sete('delay', option.ao({}, 'delay', 'Time')['delay']) self.root.sete( 'delayStart', option.ao({}, 'delayStart', 'Boolean')['delayStart']) w = self.wgGen('delay') w1 = widgets.build(self.root, self.root, self.root.gete('delayStart')) w.lay.addWidget(w1) iutils_testing.show(w, __name__)
def test_nested_options(self): p = ConfigurationProxy() p.add_option('a', 'String', '') p.add_option('b', 'String', '', parent='a') p.add_option('c', 'String', '', parent='b') p.add_option('sec_d', 'String', '') obj = constructor.Interface(p, p, p.describe()) iutils_testing.show(obj, __name__)
def test_human(self): self.root.sete('delay', option.ao({}, 'delay', 'Time')['delay']) self.root.sete('delayStart', option.ao({}, 'delayStart', 'Boolean')['delayStart']) w = self.wgGen('delay') w1 = widgets.build(self.root, self.root, self.root.gete('delayStart')) w.lay.addWidget(w1) iutils_testing.show(w, __name__)
def test_role(self): w = widgets.build(self.root, self.root, self.root.gete('role')) self.assertEqual(w.current, ['/dev/', 'default']) e = widgets.RoleEditor(w) self.assertEqual(e.tree.current_fullpath(), '/dev/') self.assertEqual(e.config.itemData(e.config.currentIndex()), 'default') self.assertFalse(hasattr(e, 'io')) iutils_testing.show(w, __name__)
def test_MIN_MAX_dbl(self): self.root.sete( 'Test', option.ao({}, 'Test', 'Float', 5, 'Float bounds', min=-10, max=10)['Test']) w = self.wgGen() self.assertEqual(w.current, 5) self.assertTrue(w.slider) iutils_testing.show(w, __name__)
def test_openfile(self): shutil.copy(os.path.join(iutils_testing.data_dir, 'measure.h5'), test_file_name) main_window = browser.MainWindow() main_window.open_file(test_file_name) iutils_testing.show(main_window, __name__) main_window.close()
def test(self): doc = filedata.MisuraDocument(nativem4) doc.reloadData() self.p.set_doc(doc) self.nav.set_doc(doc) self.p.updateCurvesMenu() self.p.updateCurveActions() self.p.hide_show('0:hsm/sample0/Vol') iutils_testing.show(self.p, __name__)
def test_openfile(self): shutil.copy( os.path.join(iutils_testing.data_dir, 'measure.h5'), test_file_name) main_window = browser.MainWindow() main_window.open_file(test_file_name) iutils_testing.show(main_window, __name__) main_window.close()
def test_RoleProgress(self): self.root.sete( 'Test', option.ao({}, 'Test', 'Progress', current=3, max=10)['Test']) self.root.sete( 'Test2', option.ao({}, 'Test2', 'Progress', current=5, max=8)['Test2']) self.root.sete('progress', option.ao( {}, 'progress', 'List', current=['/Test', '/Test2'])['progress']) self.root.setattr('progress', 'kid', '/progress') widget = self.wgGen('progress') iutils_testing.show(widget, __name__)
def test_Properties(self): self.root.sete( 'Test', option.ao({}, 'Test', 'Float', 120, 'Properties', unit='second', precision=4)['Test']) w = self.wgGen() w.lay.addWidget(w.label_widget) iutils_testing.show(w, __name__)
def test_io(self): w = widgets.build(self.root, self.root, self.root.gete('roleio')) self.assertEqual(w.prop['options'], ['/dev/', 'default', 'value']) e = widgets.RoleEditor(w) self.assertEqual(e.tree.current_fullpath(), '/dev/') ci = e.config.currentIndex() self.assertEqual(e.config.itemData(ci), 'default') ei = e.io.currentIndex() self.assertEqual(e.io.itemData(ei), 'value') e.io.setCurrentIndex(ei - 1) nval = e.io.itemData(e.io.currentIndex()) e.apply() iutils_testing.show(w, __name__)
def test_integer(self): self.root.sete( 'Test', option.ao( {}, 'Test', 'Integer', 0, 'Integer', )['Test']) w = self.wgGen() self.assertEqual(w.current, 0) self.assertFalse(w.slider) iutils_testing.show(w, __name__)
def test(self): self.root.sete('test', option.ao({}, 'test', 'Button')['test']) # Test with short reply self.root['test'] = 'test text' widget = self.wgGen() msgBox = widget._msgBox() self.assertEqual(msgBox.informativeText(), 'test text') # Try with long reply self.root['test'] = 'test text\n' * 100 widget.current = self.root['test'] msgBox = widget._msgBox() self.assertTrue(str(msgBox.informativeText()).startswith('test text')) self.assertEqual(msgBox.detailedText(), self.root['test']) iutils_testing.show(widget, __name__)
def test_MIN_MAX_int(self): self.root.sete( 'Test', option.ao({}, 'Test', 'Integer', 59298, 'Integer bounds', min=0, max=59298, step=388)['Test']) w = self.wgGen() self.assertEqual(w.current, 59298) self.assertTrue(w.slider) iutils_testing.show(w, __name__)
def test_RoleProgress(self): self.root.sete( 'Test', option.ao({}, 'Test', 'Progress', current=3, max=10)['Test']) self.root.sete( 'Test2', option.ao({}, 'Test2', 'Progress', current=5, max=8)['Test2']) self.root.sete( 'progress', option.ao({}, 'progress', 'List', current=['/Test', '/Test2'])['progress']) self.root.setattr('progress', 'kid', '/progress') widget = self.wgGen('progress') iutils_testing.show(widget, __name__)
def test(self): self.root.sete( 'test', option.ao({}, 'test', 'Table', [[('ColStr', 'String'), ('ColInt', 'Integer'), ('ColFloat', 'Float')], ['pippo', 1, 0.5]])['test']) widget = self.wgGen() view = widget.table model = view.model() self.assertFalse(model.rotated) #Shape self.assertEqual(model.rowCount(), 1) self.assertEqual(model.columnCount(), 3) # Hor header self.assertEqual(model.headerData(0, QtCore.Qt.Horizontal), 'ColStr') self.assertEqual(model.headerData(1, QtCore.Qt.Horizontal), 'ColInt') self.assertEqual(model.headerData(2, QtCore.Qt.Horizontal), 'ColFloat') # The view should take care of column visibility self.assertTrue(model.visible_headers[0]) model.set_visible_col(0, 0) self.assertEqual(model.columnCount(), 3) self.assertEqual(model.headerData(0, QtCore.Qt.Horizontal), 'ColStr') model.set_visible_col(0, 1) model.set_visible_row(0, 0) self.assertEqual(model.rowCount(), 1) # Nothing left self.assertEqual(model.headerData(0, QtCore.Qt.Vertical), None) model.set_visible_row(0, 1) # Perp header self.assertEqual(model.headerData(0, QtCore.Qt.Vertical), None) model.perpendicular_header_col = 0 self.assertEqual(model.headerData(0, QtCore.Qt.Vertical), 'pippo') iutils_testing.show(widget, __name__)
def test_String(self): self.root.sete('test', option.ao({}, 'test', 'String')['test']) widget = self.wgGen() iutils_testing.show(widget, __name__)
def test_more(self): self.root.sete( 'Test', option.ao({}, 'Test', 'Progress', current=3, max=10)['Test']) widget = self.wgGen('Test') iutils_testing.show(widget, __name__)
def test_zero(self): self.root.sete('Test', option.ao({}, 'Test', 'Progress')['Test']) widget = self.wgGen('Test') self.assertEqual(widget.current, 0) iutils_testing.show(widget, __name__)
def test_TextArea(self): self.root.sete('test', option.ao({}, 'test', 'TextArea')['test']) widget = self.wgGen() iutils_testing.show(widget, __name__)
def test_zero(self): self.root.sete('Test', option.ao({}, 'Test', 'Progress')['Test']) widget = self.wgGen('Test') self.assertEqual(widget.current, 0) iutils_testing.show(widget, __name__)
def test_more(self): self.root.sete( 'Test', option.ao({}, 'Test', 'Progress', current=3, max=10)['Test']) widget = self.wgGen('Test') iutils_testing.show(widget, __name__)
def test_Properties(self): self.root.sete( 'Test', option.ao({}, 'Test', 'Float', current=120, unit='second', precision=4)['Test']) w = self.wgGen() w.lay.addWidget(w.label_widget) iutils_testing.show(w, __name__)
def test_interface(self): rem = self.conf.post.measure obj = constructor.Interface(self.conf, rem, rem.describe()) iutils_testing.show(obj, __name__)
def test_TextArea(self): self.root.sete('test', option.ao({}, 'test', 'TextArea')['test']) widget = self.wgGen() iutils_testing.show(widget, __name__)
def test(self): doc = filedata.MisuraDocument(nativem4) doc.reloadData() self.s.set_doc(doc) iutils_testing.show(self.s, __name__)
def test_String(self): self.root.sete('test', option.ao({}, 'test', 'Script')['test']) widget = self.wgGen() iutils_testing.show(widget, __name__)
def test_integer(self): self.root.sete('Test', option.ao({}, 'Test', 'Integer')['Test']) w = self.wgGen() self.assertEqual(w.current, 0) self.assertFalse(w.slider) iutils_testing.show(w, __name__)
def test_section(self): std = self.conf.post.measure sec = constructor.orgSections(std.describe())['Main'] obj = constructor.Section(self.conf, std, sec) iutils_testing.show(obj, __name__)
def test(self): self.root.sete('test', option.ao({}, 'test', 'Boolean', False, attr=['ReadOnly'])['test']) # Test with short reply widget = self.wgGen() iutils_testing.show(widget, __name__)
def test(self): doc = filedata.MisuraDocument(nativem4) doc.reloadData() self.s.set_doc(doc) iutils_testing.show(self.s, __name__)