ReactOS 0.4.16-dev-2175-g9420ab7
power.c File Reference
#include "wine/test.h"
Include dependency graph for power.c:

Go to the source code of this file.

Functions

void test_GetSystemPowerStatus (void)
 
 START_TEST (power)
 

Function Documentation

◆ START_TEST()

START_TEST ( power  )

Definition at line 80 of file power.c.

81{
83}
void test_GetSystemPowerStatus(void)
Definition: power.c:23

◆ test_GetSystemPowerStatus()

void test_GetSystemPowerStatus ( void  )

Definition at line 23 of file power.c.

24{
26 BOOL ret;
27 BYTE capacity_flags, expected_capacity_flags;
28
29 if (0) /* crashes */
31
32 memset(&ps, 0x23, sizeof(ps));
34 ok(ret == TRUE, "expected TRUE\n");
35
37 {
38 skip("GetSystemPowerStatus not implemented or not working\n");
39 return;
40 }
42 {
43 trace("battery detected\n");
44 expected_capacity_flags = 0;
45 if (ps.BatteryLifePercent > 66)
46 expected_capacity_flags |= BATTERY_FLAG_HIGH;
47 if (ps.BatteryLifePercent < 33)
48 expected_capacity_flags |= BATTERY_FLAG_LOW;
49 if (ps.BatteryLifePercent < 5)
50 expected_capacity_flags |= BATTERY_FLAG_CRITICAL;
51 capacity_flags = (ps.BatteryFlag & ~BATTERY_FLAG_CHARGING);
52 ok(capacity_flags == expected_capacity_flags,
53 "expected %u%%-charged battery to have capacity flags 0x%02x, got 0x%02x\n",
54 ps.BatteryLifePercent, expected_capacity_flags, capacity_flags);
56 "expected BatteryLifeTime %lu to be less than or equal to BatteryFullLifeTime %lu\n",
59 {
61 "expected BatteryLifeTime to be -1 when charging, got %lu\n", ps.BatteryLifeTime);
63 "expected BatteryFullLifeTime to be -1 when charging, got %lu\n", ps.BatteryFullLifeTime);
64 }
65 }
66 else
67 {
68 trace("no battery detected\n");
70 "expected ACLineStatus to be 1, got %u\n", ps.ACLineStatus);
72 "expected BatteryLifePercent to be -1, got %u\n", ps.BatteryLifePercent);
74 "expected BatteryLifeTime to be -1, got %lu\n", ps.BatteryLifeTime);
76 "expected BatteryFullLifeTime to be -1, got %lu\n", ps.BatteryFullLifeTime);
77 }
78}
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
BOOL WINAPI GetSystemPowerStatus(IN LPSYSTEM_POWER_STATUS PowerStatus)
Definition: power.c:27
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
#define memset(x, y, z)
Definition: compat.h:39
DWORD BatteryFullLifeTime
Definition: winbase.h:915
#define BATTERY_FLAG_CHARGING
Definition: winbase.h:498
#define BATTERY_LIFE_UNKNOWN
Definition: winbase.h:502
#define BATTERY_FLAG_LOW
Definition: winbase.h:496
#define BATTERY_FLAG_NO_BATTERY
Definition: winbase.h:499
#define AC_LINE_ONLINE
Definition: winbase.h:492
#define BATTERY_FLAG_CRITICAL
Definition: winbase.h:497
#define BATTERY_FLAG_UNKNOWN
Definition: winbase.h:500
#define BATTERY_FLAG_HIGH
Definition: winbase.h:495
#define BATTERY_PERCENTAGE_UNKNOWN
Definition: winbase.h:501
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().