コード例 #1
0
def test_get_registry():
    global got_compositor
    got_compositor = None

    # start up the server
    s = ServerDisplay()
    s.add_socket()

    # run the client in a thread
    client = threading.Thread(target=_run_client)
    client.start()

    # Add a compositor so we can query for it
    Compositor.global_class(s)

    # Add a timer to kill the server after 0.5 sec (should be more than enough time, don't know a more deterministic way...)
    e = s.get_event_loop()
    source = e.add_timer(_kill_server, data=s)
    source.timer_update(500)

    s.run()
    s.destroy()

    # wait for the client (shouldn't block on roundtrip once the server is down)
    client.join()

    # make sure we got the compositor in the client
    assert got_compositor
コード例 #2
0
def test_get_registry():
    global bound, compositor
    bound = None
    compositor = None

    # start up the server
    s = ServerDisplay()
    s.add_socket()

    # run the client in a thread
    client = threading.Thread(target=_run_client)
    client.start()

    # Add a compositor so we can query for it
    global_ = Compositor.global_class(s)
    global_.bind_handler = _bind_handler

    # Add a timer to kill the server after 0.5 sec (should be more than enough time, don't know a more deterministic way...)
    e = s.get_event_loop()
    source = e.add_timer(_kill_server, data=s)
    source.timer_update(500)

    s.run()
    s.destroy()

    # wait for the client (shouldn't block on roundtrip once the server is down)
    client.join()

    # make sure we got the compositor in the client
    assert compositor
    # and that it has the compositor requests
    assert compositor.create_surface

    # Check that the server got the bind and ran the handler
    assert bound