autotests/drm: add test that verifies extending output lifetimes works
This commit is contained in:
parent
239207c5ee
commit
00c0f29f8e
1 changed files with 28 additions and 0 deletions
|
@ -38,6 +38,7 @@ private Q_SLOTS:
|
|||
void testZeroModesHandling();
|
||||
void testModeGeneration_data();
|
||||
void testModeGeneration();
|
||||
void testConnectorLifetime();
|
||||
};
|
||||
|
||||
static void verifyCleanup(MockGpu *mockGpu)
|
||||
|
@ -279,5 +280,32 @@ void DrmTest::testModeGeneration()
|
|||
verifyCleanup(mockGpu.get());
|
||||
}
|
||||
|
||||
void DrmTest::testConnectorLifetime()
|
||||
{
|
||||
// don't crash if output lifetime is extended beyond the connector
|
||||
const auto mockGpu = std::make_unique<MockGpu>(1, 5);
|
||||
|
||||
const auto conn = std::make_shared<MockConnector>(mockGpu.get());
|
||||
mockGpu->connectors.push_back(conn);
|
||||
|
||||
const auto session = Session::create(Session::Type::Noop);
|
||||
const auto backend = std::make_unique<DrmBackend>(session.get());
|
||||
const auto renderBackend = backend->createQPainterBackend();
|
||||
auto gpu = std::make_unique<DrmGpu>(backend.get(), "test", 1, 0);
|
||||
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QCOMPARE(gpu->drmOutputs().size(), 1);
|
||||
|
||||
DrmOutput *const output = gpu->drmOutputs().front();
|
||||
|
||||
output->ref();
|
||||
mockGpu->connectors.clear();
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
output->unref();
|
||||
|
||||
gpu.reset();
|
||||
verifyCleanup(mockGpu.get());
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(DrmTest)
|
||||
#include "drmTest.moc"
|
||||
|
|
Loading…
Reference in a new issue