~alan-griffiths/qtmir/window-management-plan-B

« back to all changes in this revision

Viewing changes to tests/mirserver/WindowManager/window_manager.cpp

  • Committer: CI Train Bot
  • Author(s): Lukáš Tinkl
  • Date: 2016-04-28 12:48:48 UTC
  • mfrom: (468.1.2 fixWindowTitle)
  • Revision ID: ci-train-bot@canonical.com-20160428124848-ufngne0nu1fxgc0m
Regression fix: restore window title handling Fixes: #1563522
Approved by: Nick Dedekind

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
struct MockSurface : StubSurface
51
51
{
52
52
    MOCK_METHOD2(configure, int (MirSurfaceAttrib attrib, int value));
 
53
    MOCK_METHOD1(rename, void (std::string const& title));
53
54
};
54
55
 
55
56
struct MockSession : StubSession
219
220
 
220
221
TEST_F(WindowManager, HandlesModifySurface)
221
222
{
 
223
    const auto surface = std::make_shared<MockSurface>();
 
224
    EXPECT_CALL(*arbitrary_session, surface(_)).Times(AnyNumber()).WillRepeatedly(Return(surface));
222
225
    add_surface();
 
226
    std::string title = "TestSurface";
223
227
 
224
228
    SurfaceObserver surfaceObserver;
225
 
    SurfaceObserver::registerObserverForSurface(&surfaceObserver, arbitrary_surface.get());
 
229
    SurfaceObserver::registerObserverForSurface(&surfaceObserver, surface.get());
226
230
 
227
231
    mir::shell::SurfaceSpecification modifications;
228
232
    modifications.min_width = mir::geometry::Width(100);
230
234
    modifications.max_width = mir::geometry::Width(102);
231
235
    modifications.max_height = mir::geometry::Height(103);
232
236
    modifications.shell_chrome = mir_shell_chrome_low;
 
237
    modifications.name = title;
233
238
 
234
239
    QSignalSpy spyMinimumWidthChanged(&surfaceObserver, SIGNAL(minimumWidthChanged(int)));
235
240
    QSignalSpy spyMinimumHeightChanged(&surfaceObserver, SIGNAL(minimumHeightChanged(int)));
236
241
    QSignalSpy spyMaximumWidthChanged(&surfaceObserver, SIGNAL(maximumWidthChanged(int)));
237
242
    QSignalSpy spyMaximumHeightChanged(&surfaceObserver, SIGNAL(maximumHeightChanged(int)));
238
243
    QSignalSpy spyShellChromeChanged(&surfaceObserver, SIGNAL(shellChromeChanged(MirShellChrome)));
 
244
    EXPECT_CALL(*surface, rename(title));
239
245
 
240
 
    window_manager->modify_surface(arbitrary_session, arbitrary_surface, modifications);
 
246
    window_manager->modify_surface(arbitrary_session, surface, modifications);
241
247
 
242
248
    EXPECT_EQ(100, spyMinimumWidthChanged.takeFirst().at(0).toInt());
243
249
    EXPECT_EQ(101, spyMinimumHeightChanged.takeFirst().at(0).toInt());
245
251
    EXPECT_EQ(103, spyMaximumHeightChanged.takeFirst().at(0).toInt());
246
252
    EXPECT_EQ(mir_shell_chrome_low, spyShellChromeChanged.takeFirst().at(0).toInt());
247
253
 
248
 
    window_manager->remove_surface(arbitrary_session, arbitrary_surface);
 
254
    window_manager->remove_surface(arbitrary_session, surface);
249
255
}
250
256
 
251
257
TEST_F(WindowManager, HandlesKeyboardEvent)