Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
34e15e5a
Commit
34e15e5a
authored
Sep 25, 2019
by
Alex Henrie
Committed by
Alexandre Julliard
Sep 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add tests for NtPowerInformation(SystemBatteryState).
Signed-off-by:
Alex Henrie
<
alexhenrie24@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
eac5395f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
info.c
dlls/ntdll/tests/info.c
+46
-0
No files found.
dlls/ntdll/tests/info.c
View file @
34e15e5a
...
...
@@ -888,6 +888,48 @@ static void test_query_firmware(void)
HeapFree
(
GetProcessHeap
(),
0
,
sfti
);
}
static
void
test_query_battery
(
void
)
{
SYSTEM_BATTERY_STATE
bs
;
NTSTATUS
status
;
DWORD
time_left
;
memset
(
&
bs
,
0x23
,
sizeof
(
bs
));
status
=
NtPowerInformation
(
SystemBatteryState
,
NULL
,
0
,
&
bs
,
sizeof
(
bs
));
if
(
status
==
STATUS_NOT_IMPLEMENTED
)
{
skip
(
"SystemBatteryState not implemented
\n
"
);
return
;
}
ok
(
status
==
STATUS_SUCCESS
,
"expected success
\n
"
);
trace
(
"Battery state:
\n
"
);
trace
(
"AcOnLine : %u
\n
"
,
bs
.
AcOnLine
);
trace
(
"BatteryPresent : %u
\n
"
,
bs
.
BatteryPresent
);
trace
(
"Charging : %u
\n
"
,
bs
.
Charging
);
trace
(
"Discharging : %u
\n
"
,
bs
.
Discharging
);
trace
(
"Tag : %u
\n
"
,
bs
.
Tag
);
trace
(
"MaxCapacity : %u
\n
"
,
bs
.
MaxCapacity
);
trace
(
"RemainingCapacity : %u
\n
"
,
bs
.
RemainingCapacity
);
trace
(
"Rate : %d
\n
"
,
(
LONG
)
bs
.
Rate
);
trace
(
"EstimatedTime : %u
\n
"
,
bs
.
EstimatedTime
);
trace
(
"DefaultAlert1 : %u
\n
"
,
bs
.
DefaultAlert1
);
trace
(
"DefaultAlert2 : %u
\n
"
,
bs
.
DefaultAlert2
);
ok
(
bs
.
MaxCapacity
>=
bs
.
RemainingCapacity
,
"expected MaxCapacity %u to be greater than or equal to RemainingCapacity %u
\n
"
,
bs
.
MaxCapacity
,
bs
.
RemainingCapacity
);
if
(
!
bs
.
BatteryPresent
)
time_left
=
0
;
else
if
(
!
bs
.
Charging
&&
(
LONG
)
bs
.
Rate
<
0
)
time_left
=
3600
*
bs
.
RemainingCapacity
/
-
(
LONG
)
bs
.
Rate
;
else
time_left
=
~
0u
;
ok
(
bs
.
EstimatedTime
==
time_left
,
"expected %u minutes remaining got %u minutes
\n
"
,
time_left
,
bs
.
EstimatedTime
);
}
static
void
test_query_processor_power_info
(
void
)
{
NTSTATUS
status
;
...
...
@@ -2374,6 +2416,10 @@ START_TEST(info)
/* NtPowerInformation */
/* 0x5 SystemBatteryState */
trace
(
"Starting test_query_battery()
\n
"
);
test_query_battery
();
/* 0xb ProcessorInformation */
trace
(
"Starting test_query_processor_power_info()
\n
"
);
test_query_processor_power_info
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment