@@ -95,26 +95,27 @@ Item {
95 Powerd.setStatus(data.status, Powerd.Unknown);
95 Powerd.setStatus(data.status, Powerd.Unknown);
96 physicalKeysMapper.powerKeyLongPressTime = 500;
96 physicalKeysMapper.powerKeyLongPressTime = 500;
98+ // The event's timestamp can start at 0, so make sure we handle this correctly.
98− physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: false }, 100);
99+ physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: false }, 0);
100 // After the first key press the screen is always on
101 // After the first key press the screen is always on
101 // and the rest of keypresses are auto repeat
102 // and the rest of keypresses are auto repeat
102 Powerd.setStatus(Powerd.On, Powerd.Unknown);
103 Powerd.setStatus(Powerd.On, Powerd.Unknown);
105+ physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 200);
104 physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 300);
106 physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 300);
105 physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 400);
107 physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 400);
106− physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 500);
108+ physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 499);
107− physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 599);
109 // powerKeyLongPressed should not have been emitted yet.
110 // powerKeyLongPressed should not have been emitted yet.
110 compare(powerSpy.count, 0);
111 compare(powerSpy.count, 0);
112− physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 600);
113+ physicalKeysMapper.onKeyPressed({ key: Qt.Key_PowerDown, isAutoRepeat: true}, 500);
114 compare(powerSpy.count, 1);
115 compare(powerSpy.count, 1);
116 // Confirm we only emit once
117 // 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);
118 compare(powerSpy.count, 1);
119 compare(powerSpy.count, 1);