@@ -95,26 +95,27 @@ Item {
9595 Powerd.setStatus(data.status, Powerd.Unknown);
9696 physicalKeysMapper.powerKeyLongPressTime = 500;
9797
98− physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: false }, 100);
98+ // The event's timestamp can start at 0, so make sure we handle this correctly.
99+ physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: false }, 0);
99100
100101 // After the first key press the screen is always on
101102 // and the rest of keypresses are auto repeat
102103 Powerd.setStatus(Powerd.On, Powerd.Unknown);
103104
105+ physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 200);
104106 physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 300);
105107 physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 400);
106− physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 500);
107− physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 599);
108+ physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 499);
108109
109110 // powerKeyLongPressed should not have been emitted yet.
110111 compare(powerSpy.count, 0);
111112
112− physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 600);
113+ physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 500);
113114
114115 compare(powerSpy.count, 1);
115116
116117 // Confirm we only emit once
117− physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 601);
118+ physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 501);
118119 compare(powerSpy.count, 1);
119120 }
120121