Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
03f5f72c
Commit
03f5f72c
authored
Oct 17, 2022
by
Hugh McMaster
Committed by
Alexandre Julliard
Oct 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add tests for GetConsoleOriginalTitleA/W().
parent
4951ab64
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
console.c
dlls/kernel32/tests/console.c
+79
-0
No files found.
dlls/kernel32/tests/console.c
View file @
03f5f72c
...
...
@@ -4194,6 +4194,77 @@ static void test_SetConsoleScreenBufferInfoEx(HANDLE std_output)
CloseHandle
(
std_input
);
}
static
void
test_GetConsoleOriginalTitleA
(
void
)
{
char
buf
[
64
];
DWORD
ret
;
char
title
[]
=
"Original Console Title"
;
ret
=
GetConsoleOriginalTitleA
(
NULL
,
0
);
ok
(
!
ret
,
"Unexpected string length; error %lu
\n
"
,
GetLastError
());
ret
=
GetConsoleOriginalTitleA
(
buf
,
0
);
ok
(
!
ret
,
"Unexpected string length; error %lu
\n
"
,
GetLastError
());
ret
=
GetConsoleOriginalTitleA
(
buf
,
ARRAY_SIZE
(
buf
));
todo_wine
ok
(
ret
,
"GetConsoleOriginalTitleA failed: %lu
\n
"
,
GetLastError
());
todo_wine
ok
(
!
strcmp
(
buf
,
title
),
"got %s, expected %s
\n
"
,
wine_dbgstr_a
(
buf
),
wine_dbgstr_a
(
title
));
ret
=
SetConsoleTitleA
(
"test"
);
ok
(
ret
,
"SetConsoleTitleA failed: %lu
\n
"
,
GetLastError
());
ret
=
GetConsoleOriginalTitleA
(
buf
,
ARRAY_SIZE
(
buf
));
todo_wine
ok
(
ret
,
"GetConsoleOriginalTitleA failed: %lu
\n
"
,
GetLastError
());
todo_wine
ok
(
!
strcmp
(
buf
,
title
),
"got %s, expected %s
\n
"
,
wine_dbgstr_a
(
buf
),
wine_dbgstr_a
(
title
));
}
static
void
test_GetConsoleOriginalTitleW
(
void
)
{
WCHAR
buf
[
64
];
DWORD
ret
;
WCHAR
title
[]
=
L"Original Console Title"
;
ret
=
GetConsoleOriginalTitleW
(
NULL
,
0
);
ok
(
!
ret
,
"Unexpected string length; error %lu
\n
"
,
GetLastError
());
ret
=
GetConsoleOriginalTitleW
(
buf
,
0
);
ok
(
!
ret
,
"Unexpected string length; error %lu
\n
"
,
GetLastError
());
ret
=
GetConsoleOriginalTitleW
(
buf
,
ARRAY_SIZE
(
buf
));
todo_wine
ok
(
ret
,
"GetConsoleOriginalTitleW failed: %lu
\n
"
,
GetLastError
());
buf
[
ret
]
=
0
;
todo_wine
ok
(
!
wcscmp
(
buf
,
title
),
"got %s, expected %s
\n
"
,
wine_dbgstr_w
(
buf
),
wine_dbgstr_w
(
title
));
ret
=
SetConsoleTitleW
(
L"test"
);
ok
(
ret
,
"SetConsoleTitleW failed: %lu
\n
"
,
GetLastError
());
ret
=
GetConsoleOriginalTitleW
(
buf
,
ARRAY_SIZE
(
buf
));
todo_wine
ok
(
ret
,
"GetConsoleOriginalTitleW failed: %lu
\n
"
,
GetLastError
());
todo_wine
ok
(
!
wcscmp
(
buf
,
title
),
"got %s, expected %s
\n
"
,
wine_dbgstr_w
(
buf
),
wine_dbgstr_w
(
title
));
ret
=
GetConsoleOriginalTitleW
(
buf
,
5
);
todo_wine
ok
(
ret
,
"GetConsoleOriginalTitleW failed: %lu
\n
"
,
GetLastError
());
todo_wine
ok
(
!
wcscmp
(
buf
,
L"Orig"
),
"got %s, expected 'Orig'
\n
"
,
wine_dbgstr_w
(
buf
));
}
static
void
test_GetConsoleOriginalTitle
(
void
)
{
STARTUPINFOA
si
=
{
sizeof
(
si
)
};
PROCESS_INFORMATION
info
;
char
**
argv
,
buf
[
MAX_PATH
];
char
title
[]
=
"Original Console Title"
;
BOOL
ret
;
winetest_get_mainargs
(
&
argv
);
sprintf
(
buf
,
"
\"
%s
\"
console title_test"
,
argv
[
0
]);
si
.
lpTitle
=
title
;
ret
=
CreateProcessA
(
NULL
,
buf
,
NULL
,
NULL
,
TRUE
,
CREATE_NEW_CONSOLE
,
NULL
,
NULL
,
&
si
,
&
info
);
ok
(
ret
,
"CreateProcess failed: %lu
\n
"
,
GetLastError
());
CloseHandle
(
info
.
hThread
);
wait_child_process
(
info
.
hProcess
);
CloseHandle
(
info
.
hProcess
);
}
static
void
test_GetConsoleTitleA
(
void
)
{
char
buf
[
64
],
str
[]
=
"test"
;
...
...
@@ -4837,6 +4908,13 @@ START_TEST(console)
ExitProcess
(
exit_code
);
}
if
(
argc
==
3
&&
!
strcmp
(
argv
[
2
],
"title_test"
))
{
test_GetConsoleOriginalTitleA
();
test_GetConsoleOriginalTitleW
();
return
;
}
test_current
=
argc
>=
3
&&
!
strcmp
(
argv
[
2
],
"--current"
);
using_pseudo_console
=
argc
>=
3
&&
!
strcmp
(
argv
[
2
],
"--pseudo-console"
);
...
...
@@ -5020,6 +5098,7 @@ START_TEST(console)
test_GetConsoleScreenBufferInfoEx
(
hConOut
);
test_SetConsoleScreenBufferInfoEx
(
hConOut
);
test_file_info
(
hConIn
,
hConOut
);
test_GetConsoleOriginalTitle
();
test_GetConsoleTitleA
();
test_GetConsoleTitleW
();
if
(
!
test_current
)
...
...
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