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 AndroidKeyMetastate class in android/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.py to use AndroidKeyMetastate constants instead of raw integer values for the metastate argument in press_keycode and long_press_keycode tests. [1] [2] [3]
  • Updated import statements in nativekey_test.py to include AndroidKeyMetastate.
  • Added new tests to verify that AndroidKeyMetastate constants have the expected values and can be combined as intended.