(self)
| 269 | self.checkParams(widget, 'onvalue', 1, 2.3, '', 'any string') |
| 270 | |
| 271 | def test_invoke(self): |
| 272 | success = [] |
| 273 | def cb_test(): |
| 274 | success.append(1) |
| 275 | return "cb test called" |
| 276 | |
| 277 | cbtn = ttk.Checkbutton(self.root, command=cb_test) |
| 278 | # the variable automatically created by ttk.Checkbutton is actually |
| 279 | # undefined till we invoke the Checkbutton |
| 280 | self.assertEqual(cbtn.state(), ('alternate', )) |
| 281 | self.assertRaises(tkinter.TclError, cbtn.tk.globalgetvar, |
| 282 | cbtn['variable']) |
| 283 | |
| 284 | res = cbtn.invoke() |
| 285 | self.assertEqual(res, "cb test called") |
| 286 | self.assertEqual(cbtn['onvalue'], |
| 287 | cbtn.tk.globalgetvar(cbtn['variable'])) |
| 288 | self.assertTrue(success) |
| 289 | |
| 290 | cbtn['command'] = '' |
| 291 | res = cbtn.invoke() |
| 292 | if tk_version >= (8, 7) and self.wantobjects: |
| 293 | self.assertEqual(res, ()) |
| 294 | else: |
| 295 | self.assertEqual(str(res), '') |
| 296 | self.assertLessEqual(len(success), 1) |
| 297 | self.assertEqual(cbtn['offvalue'], |
| 298 | cbtn.tk.globalgetvar(cbtn['variable'])) |
| 299 | |
| 300 | def test_unique_variables(self): |
| 301 | frames = [] |
nothing calls this directly
no test coverage detected