(self)
| 296 | d.set_color_sample.called = 0 |
| 297 | |
| 298 | def test_load_theme_cfg(self): |
| 299 | tracers.detach() |
| 300 | d = self.page |
| 301 | eq = self.assertEqual |
| 302 | |
| 303 | # Use builtin theme with no user themes created. |
| 304 | idleConf.CurrentTheme = mock.Mock(return_value='IDLE Classic') |
| 305 | d.load_theme_cfg() |
| 306 | self.assertTrue(d.theme_source.get()) |
| 307 | # builtinlist sets variable builtin_name to the CurrentTheme default. |
| 308 | eq(d.builtin_name.get(), 'IDLE Classic') |
| 309 | eq(d.custom_name.get(), '- no custom themes -') |
| 310 | eq(d.custom_theme_on.state(), ('disabled',)) |
| 311 | eq(d.set_theme_type.called, 1) |
| 312 | eq(d.paint_theme_sample.called, 1) |
| 313 | eq(d.set_highlight_target.called, 1) |
| 314 | |
| 315 | # Builtin theme with non-empty user theme list. |
| 316 | idleConf.SetOption('highlight', 'test1', 'option', 'value') |
| 317 | idleConf.SetOption('highlight', 'test2', 'option2', 'value2') |
| 318 | d.load_theme_cfg() |
| 319 | eq(d.builtin_name.get(), 'IDLE Classic') |
| 320 | eq(d.custom_name.get(), 'test1') |
| 321 | eq(d.set_theme_type.called, 2) |
| 322 | eq(d.paint_theme_sample.called, 2) |
| 323 | eq(d.set_highlight_target.called, 2) |
| 324 | |
| 325 | # Use custom theme. |
| 326 | idleConf.CurrentTheme = mock.Mock(return_value='test2') |
| 327 | idleConf.SetOption('main', 'Theme', 'default', '0') |
| 328 | d.load_theme_cfg() |
| 329 | self.assertFalse(d.theme_source.get()) |
| 330 | eq(d.builtin_name.get(), 'IDLE Classic') |
| 331 | eq(d.custom_name.get(), 'test2') |
| 332 | eq(d.set_theme_type.called, 3) |
| 333 | eq(d.paint_theme_sample.called, 3) |
| 334 | eq(d.set_highlight_target.called, 3) |
| 335 | |
| 336 | del idleConf.CurrentTheme |
| 337 | tracers.attach() |
| 338 | |
| 339 | def test_theme_source(self): |
| 340 | eq = self.assertEqual |
nothing calls this directly
no test coverage detected