Add .gitignore, GitLab CI pipeline with test/lint/build/release stages, project documentation (README, LICENSE, CHANGELOG, CONTRIBUTING, SECURITY), PyInstaller packaging configuration with icon and version info, Python project configuration with dependencies, and complete application source including battery provider, device discovery, settings management, UI components, startup control, and comprehensive test suite
20 lines
778 B
Python
20 lines
778 B
Python
from logitech_battery_widget.battery.provider import ChargeStatus
|
|
from logitech_battery_widget.battery.windows_hid import WindowsHidBatteryProvider
|
|
|
|
|
|
def test_hidpp_charge_status_mapping():
|
|
provider = WindowsHidBatteryProvider()
|
|
|
|
assert provider._status(0) == ChargeStatus.DISCHARGING
|
|
assert provider._status(1) == ChargeStatus.CHARGING
|
|
assert provider._status(4) == ChargeStatus.CHARGING
|
|
assert provider._status(99) == ChargeStatus.UNKNOWN
|
|
|
|
|
|
def test_device_name_is_clear_and_vendor_prefixed():
|
|
provider = WindowsHidBatteryProvider()
|
|
|
|
assert provider._name({"product_string": "MX Keys"}) == "Logitech MX Keys"
|
|
assert provider._name({"product_string": "Logitech G Pro"}) == "Logitech G Pro"
|
|
assert provider._name({}) == "Logitech HID Device"
|