[libinput] A not valid LibInput::Context should return -1 as filedescriptor
0 is a valid filedescriptor after all. Autotest extended to cover this case.icc-effect-5.14.5
parent
2d9ff54e68
commit
c04f193532
|
@ -54,6 +54,8 @@ void TestContext::testCreateFailUdev()
|
||||||
// should not have a valid libinput
|
// should not have a valid libinput
|
||||||
libinput *libinput = context;
|
libinput *libinput = context;
|
||||||
QVERIFY(!libinput);
|
QVERIFY(!libinput);
|
||||||
|
QVERIFY(!context.assignSeat("testSeat"));
|
||||||
|
QCOMPARE(context.fileDescriptor(), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestContext::testAssignSeat_data()
|
void TestContext::testAssignSeat_data()
|
||||||
|
|
|
@ -81,7 +81,7 @@ bool Context::assignSeat(const char *seat)
|
||||||
int Context::fileDescriptor()
|
int Context::fileDescriptor()
|
||||||
{
|
{
|
||||||
if (!isValid()) {
|
if (!isValid()) {
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
return libinput_get_fd(m_libinput);
|
return libinput_get_fd(m_libinput);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue