File: power_test.py

package info (click to toggle)
pysdl2 0.9.9%2Bdfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,276 kB
  • sloc: python: 18,592; makefile: 148; sh: 40
file content (29 lines) | stat: -rw-r--r-- 1,075 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import sys
import os
import pytest
from ctypes import c_int, byref
from sdl2 import power


class TestSDLPower(object):
    __tags__ = ["sdl"]

    # @interactive("Do the shown numbers match your power supply status?")
    # def test_get_power_info(self):
    #     secs, percent = c_int(), c_int()
    #     retval = power.SDL_GetPowerInfo(byref(secs), byref(percent))
    #     state = "Unknown"
    #     if retval == power.SDL_POWERSTATE_ON_BATTERY:
    #         state = "On battery"
    #     elif retval == power.SDL_POWERSTATE_NO_BATTERY:
    #         state = "No battery"
    #     elif retval == power.SDL_POWERSTATE_CHARGING:
    #         state = "Battery charging"
    #     elif retval == power.SDL_POWERSTATE_CHARGED:
    #         state = "Battery charged"
    #     output = "Power Status: %s" % state + os.linesep
    #     output += "Minutes left (-1 = undetermined): %d" % (secs.value / 60)
    #     output += os.linesep
    #     output += "Percent left (-1 = undetermined): %d" % percent.value
    #     output += os.linesep
    #     doprint(output)