feat: Add AndroidKeyMetastate class for keyboard metastate constants by Dor-bl · Pull Request #1211 · appium/python-client
This pull request introduces a new AndroidKeyMetastate class to encapsulate Android keyboard metastate constants and updates the test suite to use these new constants instead of hardcoded values. This improves code readability and maintainability by providing named constants for key event metastates.
Addressing #1075
Key changes:
New functionality:
- Added the
AndroidKeyMetastateclass inandroid/nativekey.py, defining named constants for Android keyboard metastates (e.g.,META_SHIFT_ON,META_NUM_LOCK_ON). These constants can be combined with bitwise OR and passed to key event methods.
Test improvements:
- Updated unit tests in
keyboard_test.pyto useAndroidKeyMetastateconstants instead of raw integer values for themetastateargument inpress_keycodeandlong_press_keycodetests. [1] [2] [3] - Updated import statements in
nativekey_test.pyto includeAndroidKeyMetastate. - Added new tests to verify that
AndroidKeyMetastateconstants have the expected values and can be combined as intended.