311
311
EXPECT_EQ(Session::Stopped, session->state());
312
312
EXPECT_FALSE(session->m_suspendTimer->isRunning());
316
Regression test for https://bugs.launchpad.net/ubuntu/+source/qtmir/+bug/1578665
318
A child prompt session was arriving before the application surface got a chance to draw
319
its first frame. And on top of that, the application was blocked from drawing anything
320
until that prompt session gone away.
322
TEST_F(SessionTests, ChildSessionArrivesBeforeSurfaceDrawnFirstFrame)
324
using namespace testing;
326
const QString appId("test-app");
327
const pid_t procId = 5551;
329
auto mirSession = std::make_shared<MockSession>(appId.toStdString(), procId);
331
auto session = std::make_shared<qtmir::Session>(mirSession, promptSessionManager);
333
FakeMirSurface *blankSurface = new FakeMirSurface;
334
session->registerSurface(blankSurface);
336
// Surface doesn't appear in this list as it has not drawn its first frame yet
337
EXPECT_EQ(0, session->surfaceList()->count());
339
Session* childSession = new Session(mirSession, promptSessionManager);
340
session->addChildSession(childSession);
342
FakeMirSurface *promptSurface = new FakeMirSurface;
343
childSession->registerSurface(promptSurface);
344
promptSurface->drawFirstFrame();
346
// Even though blankSurface still hasn't drawn its first frame (ie, it's still blank),
347
// it should now appear in this list as it now has a child prompt surface, which the
348
// user must interact with.
349
auto sessionSurfaceList = static_cast<MirSurfaceListModel*>(session->surfaceList());
350
EXPECT_EQ(1, sessionSurfaceList->count());
351
EXPECT_TRUE(sessionSurfaceList->contains(blankSurface));
353
auto promptSurfaceList = static_cast<MirSurfaceListModel*>(blankSurface->promptSurfaceList());
354
EXPECT_EQ(1, promptSurfaceList->count());
355
EXPECT_TRUE(promptSurfaceList->contains(promptSurface));