TEST_F(EventDispatcherTest, onSelectAndOnUnselectEventsAreGenerated) { testing::Sequence sequence; EXPECT_CALL(*tool1, OnSelect()).InSequence(sequence); EXPECT_CALL(*tool1, OnUnselect()).InSequence(sequence); EXPECT_CALL(*tool2, OnSelect()).InSequence(sequence); EXPECT_CALL(*tool2, OnUnselect()).InSequence(sequence); sut->Select(0); sut->Select(1); }
void GuiSelectable::OnKeyPress(const KeyEvent &event) { if ("tab" == event.mKey) { OnUnselect(); if (mOSWindow->GetKeyboard().IsKeyDown("shift")) mPrevious->OnSelect(); else mNext->OnSelect(); } }
TEST_F(EventDispatcherTest, eventsAreRedirectedToProperTool) { testing::Sequence sequence; EXPECT_CALL(*tool2, OnSelect()).InSequence(sequence); EXPECT_CALL(canvas, HandleLeftMouseButtonClick(testing::_)).InSequence(sequence); EXPECT_CALL(*tool2, OnCanvasLeftMouseButtonClick(testing::_)).InSequence(sequence); EXPECT_CALL(*tool2, OnUnselect()).InSequence(sequence); EXPECT_CALL(*tool1, OnSelect()).InSequence(sequence); EXPECT_CALL(canvas, HandleMouseMotion(testing::_)).InSequence(sequence); EXPECT_CALL(*tool1, OnCanvasMouseMotion(testing::_)).InSequence(sequence); EXPECT_CALL(canvas, HandleRightMouseButtonRelease(testing::_)).InSequence(sequence); EXPECT_CALL(*tool1, OnCanvasRightMouseButtonRelease(testing::_)).InSequence(sequence); EXPECT_CALL(*tool1, OnUnselect()).InSequence(sequence); sut->Select(1); sut->OnCanvasLeftMouseButtonClick(dummyEvent); sut->Select(0); sut->OnCanvasMouseMotion(dummyEvent); sut->OnCanvasRightMouseButtonRelease(dummyEvent); }