~kdub/mir/devel-to-0.1.7

« back to all changes in this revision

Viewing changes to tests/acceptance-tests/test_client_input.cpp

Updates the InputWindowInfo found at InputWindowHandles everytime the InputDispatcher tries to querry the object for hit testing. 
  
 So far that information was only updated during creation (because we triggered that in the mir implemantation) and when focus changes occur - that might be the reason why unity8 never experienced these issues. This fix kind of makes updateInfo and the interface of InputWindowInfo even more questionable. Why have those members public? Why update these only under certain circumstances. Fixes: https://bugs.launchpad.net/bugs/1268819.

Approved by PS Jenkins bot, Alan Griffiths, Daniel van Vugt, Robert Carr, Kevin DuBois.

Show diffs side-by-side

added added

removed removed

Lines of Context:
608
608
    launch_client_process(*client_config_1);
609
609
    launch_client_process(*client_config_2);
610
610
}
 
611
 
 
612
TEST_F(TestClientInput, clients_receive_motion_within_co_ordinate_system_of_window)
 
613
{
 
614
    using namespace ::testing;
 
615
 
 
616
    static int const screen_width = 1000;
 
617
    static int const screen_height = 800;
 
618
    static int const client_height = screen_height/2;
 
619
    static int const client_width = screen_width/2;
 
620
    static std::string const test_client = "tc";
 
621
    mtf::CrossProcessSync fence;
 
622
 
 
623
    static GeometryMap positions;
 
624
    positions[test_client] = geom::Rectangle{geom::Point{screen_width/2, screen_height/2},
 
625
                                             geom::Size{client_width, client_height}};
 
626
 
 
627
    auto server_config = make_event_producing_server(fence, 1,
 
628
         [&](mtf::InputTestingServerConfiguration& server)
 
629
         {
 
630
            server.the_session_container()->for_each([&](std::shared_ptr<msh::Session> const& session) -> void
 
631
            {
 
632
                session->default_surface()->move_to(geom::Point{screen_width/2-40, screen_height/2-80});
 
633
            });
 
634
            server.fake_event_hub->synthesize_event(mis::a_motion_event().with_movement(screen_width/2+40, screen_height/2+90));
 
635
        }, positions, DepthMap());
 
636
    launch_server_process(*server_config);
 
637
 
 
638
    auto client = make_event_expecting_client(test_client, fence,
 
639
         [&](MockHandler& handler, mt::WaitCondition& events_received)
 
640
         {
 
641
             InSequence seq;
 
642
             EXPECT_CALL(handler, handle_input(mt::HoverEnterEvent())).Times(1);
 
643
             EXPECT_CALL(handler, handle_input(mt::MotionEventWithPosition(80, 170))).Times(AnyNumber())
 
644
                 .WillOnce(mt::WakeUp(&events_received));
 
645
        });
 
646
 
 
647
    launch_client_process(*client);
 
648
}