def tearDownModule(): global root, dialog idleConf.userCfg = usercfg tracers.detach() del dialog root.update_idletasks() root.destroy() del root
def tearDownModule(): global root, dialog idleConf.userCfg = usercfg tracers.detach() tracers.clear() changes.clear() root.update_idletasks() root.destroy() root = dialog = None
def test_load_font_cfg(self): # Leave widget load test to human visual check. # TODO Improve checks when add IdleConf.get_font_values. tracers.detach() d = self.page d.font_name.set('Fake') d.font_size.set('1') d.font_bold.set(True) d.set_samples.called = 0 d.load_font_cfg() self.assertNotEqual(d.font_name.get(), 'Fake') self.assertNotEqual(d.font_size.get(), '1') self.assertFalse(d.font_bold.get()) self.assertEqual(d.set_samples.called, 1) tracers.attach()
def test_load_key_cfg(self): tracers.detach() d = self.page eq = self.assertEqual # Use builtin keyset with no user keysets created. idleConf.CurrentKeys = mock.Mock(return_value='IDLE Classic OSX') d.load_key_cfg() self.assertTrue(d.keyset_source.get()) # builtinlist sets variable builtin_name to the CurrentKeys default. eq(d.builtin_name.get(), 'IDLE Classic OSX') eq(d.custom_name.get(), '- no custom keys -') eq(d.custom_keyset_on.state(), ('disabled',)) eq(d.set_keys_type.called, 1) eq(d.load_keys_list.called, 1) eq(d.load_keys_list.args, ('IDLE Classic OSX', )) # Builtin keyset with non-empty user keyset list. idleConf.SetOption('keys', 'test1', 'option', 'value') idleConf.SetOption('keys', 'test2', 'option2', 'value2') d.load_key_cfg() eq(d.builtin_name.get(), 'IDLE Classic OSX') eq(d.custom_name.get(), 'test1') eq(d.set_keys_type.called, 2) eq(d.load_keys_list.called, 2) eq(d.load_keys_list.args, ('IDLE Classic OSX', )) # Use custom keyset. idleConf.CurrentKeys = mock.Mock(return_value='test2') idleConf.default_keys = mock.Mock(return_value='IDLE Modern Unix') idleConf.SetOption('main', 'Keys', 'default', '0') d.load_key_cfg() self.assertFalse(d.keyset_source.get()) eq(d.builtin_name.get(), 'IDLE Modern Unix') eq(d.custom_name.get(), 'test2') eq(d.set_keys_type.called, 3) eq(d.load_keys_list.called, 3) eq(d.load_keys_list.args, ('test2', )) del idleConf.CurrentKeys, idleConf.default_keys tracers.attach()
def test_load_theme_cfg(self): tracers.detach() d = self.page eq = self.assertEqual # Use builtin theme with no user themes created. idleConf.CurrentTheme = mock.Mock(return_value='IDLE Classic') d.load_theme_cfg() self.assertTrue(d.theme_source.get()) # builtinlist sets variable builtin_name to the CurrentTheme default. eq(d.builtin_name.get(), 'IDLE Classic') eq(d.custom_name.get(), '- no custom themes -') eq(d.custom_theme_on.state(), ('disabled',)) eq(d.set_theme_type.called, 1) eq(d.paint_theme_sample.called, 1) eq(d.set_highlight_target.called, 1) # Builtin theme with non-empty user theme list. idleConf.SetOption('highlight', 'test1', 'option', 'value') idleConf.SetOption('highlight', 'test2', 'option2', 'value2') d.load_theme_cfg() eq(d.builtin_name.get(), 'IDLE Classic') eq(d.custom_name.get(), 'test1') eq(d.set_theme_type.called, 2) eq(d.paint_theme_sample.called, 2) eq(d.set_highlight_target.called, 2) # Use custom theme. idleConf.CurrentTheme = mock.Mock(return_value='test2') idleConf.SetOption('main', 'Theme', 'default', '0') d.load_theme_cfg() self.assertFalse(d.theme_source.get()) eq(d.builtin_name.get(), 'IDLE Classic') eq(d.custom_name.get(), 'test2') eq(d.set_theme_type.called, 3) eq(d.paint_theme_sample.called, 3) eq(d.set_highlight_target.called, 3) del idleConf.CurrentTheme tracers.attach()