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-18 17:02:24 +0200 |
commit | 51a2cdb4fbe376c519544b8e484e03eebe943f76 (patch) | |
tree | d5c661eae20b302c0435d94fa3010dcbff05bb7a /vcl | |
parent | 559f2e233108ed5e9da305ffbf945d6ed568f7eb (diff) |
uitest: support more special keycodes
Change-Id: Ief5fde7c9840de0f7b0a34fec24837e3a8e5ae70
Diffstat (limited to 'vcl')
-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 b7b39ea1a1d7..512d05389f43 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; |