21using namespace std::literals;
30 void testToggled_data();
34 std::unique_ptr<libinput_device> m_nativeDevice;
35 std::unique_ptr<Device> m_device;
38void TestLibinputSwitchEvent::init()
40 m_nativeDevice = std::make_unique<libinput_device>();
41 m_nativeDevice->switchDevice =
true;
42 m_device = std::make_unique<Device>(m_nativeDevice.get());
45void TestLibinputSwitchEvent::cleanup()
48 m_nativeDevice.reset();
51void TestLibinputSwitchEvent::testToggled_data()
53 QTest::addColumn<KWin::LibInput::SwitchEvent::State>(
"state");
59void TestLibinputSwitchEvent::testToggled()
62 nativeEvent->
type = LIBINPUT_EVENT_SWITCH_TOGGLE;
63 nativeEvent->
device = m_nativeDevice.get();
66 case SwitchEvent::State::Off:
69 case SwitchEvent::State::On:
75 nativeEvent->
time = 23456789us;
80 QCOMPARE(se->device(), m_device.get());
81 QCOMPARE(se->nativeDevice(), m_nativeDevice.get());
82 QCOMPARE(se->type(), LIBINPUT_EVENT_SWITCH_TOGGLE);
83 QCOMPARE(se->state(), state);
84 QCOMPARE(se->time(), 23456789us);
88#include "switch_event_test.moc"