def test_gui_signal_window(self): import cairo try: from .gui import SignalWindow except SystemError: from gui import SignalWindow def destroy(obj, window): return surface = cairo.ImageSurface(cairo.FORMAT_RGB24, 600, 400) ctx = cairo.Context(surface) signal_window = SignalWindow("11:22:33:44:55:66", destroy) signal_window.on_draw_event(None, ctx) signal_window.history[-1] = {} bssid_src = {"numpackets": 1 } signal_window.add_value(None, None, -30, 0) signal_window.add_value(None, bssid_src, -30, 1) time.sleep(1) signal_window.add_value(None, None, -31, 0) signal_window.add_value(None, bssid_src, -30, 1) time.sleep(1) signal_window.add_value(None, None, -32, 0) signal_window.add_value(None, bssid_src, -30, 1) signal_window.draw_graph(600, 400, ctx) now = int(time.time()) for signal in (-50, -60, -70, -80, -50): now -= 1 signal_window.history[now] = {} signal_window.history[now]["test"] = (signal, signal * -1) signal_window.draw_graph(600, 400, ctx) signal_window.on_draw_event(None, ctx) test_widget = TestWidget() signal_window.on_graph_type(test_widget, "signal") signal_window.on_draw_event(None, ctx) signal_window.on_graph_type(test_widget, "packets") signal_window.on_draw_event(None, ctx) test_widget.active = False signal_window.on_graph_type(test_widget, "signal") signal_window.on_graph_type(test_widget, "packets")
def test_gui_signal_window(self): import cairo try: from .gui import SignalWindow except SystemError: from gui import SignalWindow def destroy(obj, window): return signal_window = SignalWindow("11:22:33:44:55:66", destroy) signal_window.add_value(None, None, -30) signal_window.add_value(None, None, -31) surface = cairo.ImageSurface(cairo.FORMAT_RGB24, 600, 400) ctx = cairo.Context(surface) signal_window.draw_graph(600, 400, ctx) now = int(time.time()) for signal in (-50, -60, -70, -80, -50): now -= 1 signal_window.history[now] = {} signal_window.history[now]["test"] = (signal, signal * -1) signal_window.draw_graph(600, 400, ctx) signal_window.on_draw_event(None, ctx) signal_window.on_draw_event(None, ctx)