diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-05-20 04:58:56 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-17 21:10:17 +0200 |
commit | 52eb1897047af2b115c670b68c470e99f4f22031 (patch) | |
tree | 1fd5be40def7a45e18e3b3bca6b6cf0cc3945d61 | |
parent | ea31be88db444843b6783e6c260567ec6c24f9f9 (diff) |
uitest: support more special keycodes
Change-Id: Ief5fde7c9840de0f7b0a34fec24837e3a8e5ae70
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 30f56614ba00..8f2196a38739 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -132,6 +132,22 @@ std::vector<KeyEvent> generate_key_events_from_keycode(const OUString& rStr) { std::vector<KeyEvent> aEvents; + std::map<OUString, sal_uInt16> aKeyMap = { + {"ESC", KEY_ESCAPE}, + {"DOWN", KEY_DOWN}, + {"UP", KEY_UP}, + {"LEFT", KEY_LEFT}, + {"RIGHT", KEY_RIGHT}, + {"DELETE", KEY_DELETE}, + {"INSERT", KEY_INSERT}, + {"BACKSPACE", KEY_BACKSPACE}, + {"RETURN", KEY_RETURN}, + {"HOME", KEY_HOME}, + {"END", KEY_END}, + {"PAGEUP", KEY_PAGEUP}, + {"PAGEDOWN", KEY_PAGEDOWN} + }; + // split string along '+' // then translate to keycodes bool bShift = false; @@ -159,12 +175,21 @@ std::vector<KeyEvent> generate_key_events_from_keycode(const OUString& rStr) aRemainingText = aToken; } - for (sal_Int32 i = 0; i < aRemainingText.getLength(); ++i) + if (aKeyMap.find(aRemainingText) != aKeyMap.end()) + { + sal_uInt16 nKey = aKeyMap[aRemainingText]; + vcl::KeyCode aCode(nKey, bShift, bMod1, bMod2, false); + aEvents.push_back(KeyEvent( 'a', aCode)); + } + else { - bool bShiftThroughKey = false; - sal_uInt16 nKey = get_key(aRemainingText[i], bShiftThroughKey); - vcl::KeyCode aCode(nKey, bShift || bShiftThroughKey, bMod1, bMod2, false); - aEvents.push_back(KeyEvent(aRemainingText[i], aCode)); + for (sal_Int32 i = 0; i < aRemainingText.getLength(); ++i) + { + bool bShiftThroughKey = false; + sal_uInt16 nKey = get_key(aRemainingText[i], bShiftThroughKey); + vcl::KeyCode aCode(nKey, bShift || bShiftThroughKey, bMod1, bMod2, false); + aEvents.push_back(KeyEvent(aRemainingText[i], aCode)); + } } return aEvents; |