def test_dateentry_drop_down(self): """Check whether drop down opens on click.""" widget = DateEntry(self.window) widget.pack() self.window.update() w = widget.winfo_width() h = widget.winfo_height() widget._on_b1_press(TestEvent(widget=widget, x=w - 10, y=h // 2)) self.window.update() self.assertTrue(widget._top_cal.winfo_ismapped())
def test_dateentry_drop_down(self): """Check whether drop down opens on click.""" widget = DateEntry(self.window) widget.pack() self.window.update() w = widget.winfo_width() h = widget.winfo_height() widget.event_generate('<1>', x=w - 10, y=h // 2) self.window.update() self.assertTrue(widget._top_cal.winfo_ismapped()) mouse = Controller() x = widget._top_cal.winfo_rootx() + widget._top_cal.winfo_width() + 10 y = widget._top_cal.winfo_rooty() + widget._top_cal.winfo_height() + 10 mouse.position = x, y widget._calendar.event_generate('<FocusOut>') widget._on_focus_out_cal(TestEvent(widget=widget._calendar, x='', y='')) self.window.update() self.assertFalse(widget._top_cal.winfo_ismapped())