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
f2b681db
Commit
f2b681db
authored
Nov 07, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun/tests: Add ITextStream::ReadLine tests.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
14de4451
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
filesystem.c
dlls/scrrun/tests/filesystem.c
+71
-0
No files found.
dlls/scrrun/tests/filesystem.c
View file @
f2b681db
...
...
@@ -1734,6 +1734,7 @@ static void test_ReadAll(void)
hr
=
ITextStream_ReadLine
(
stream
,
&
str
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
str
!=
NULL
,
"got %p
\n
"
,
str
);
ok
(
!
wcscmp
(
str
,
nameW
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
lstrcpyW
(
buffW
,
secondlineW
);
...
...
@@ -2036,6 +2037,75 @@ static void test_Read(void)
SysFreeString
(
nameW
);
}
static
void
test_ReadLine
(
void
)
{
WCHAR
path
[
MAX_PATH
],
dir
[
MAX_PATH
];
ITextStream
*
stream
;
unsigned
int
i
;
HANDLE
file
;
DWORD
size
;
HRESULT
hr
;
BSTR
str
;
BOOL
ret
;
const
char
data
[]
=
"first line
\r\n
second
\n\n\r
t
\r\r
e
\r
st
\n
"
;
get_temp_filepath
(
L"test.txt"
,
path
,
dir
);
ret
=
CreateDirectoryW
(
dir
,
NULL
);
ok
(
ret
,
"got %d, %d
\n
"
,
ret
,
GetLastError
());
file
=
CreateFileW
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed
\n
"
);
for
(
i
=
0
;
i
<
1000
;
i
++
)
WriteFile
(
file
,
data
,
strlen
(
data
),
&
size
,
NULL
);
CloseHandle
(
file
);
str
=
SysAllocString
(
path
);
hr
=
IFileSystem3_OpenTextFile
(
fs3
,
str
,
ForReading
,
VARIANT_FALSE
,
TristateFalse
,
&
stream
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
SysFreeString
(
str
);
for
(
i
=
0
;
i
<
1000
;
i
++
)
{
hr
=
ITextStream_ReadLine
(
stream
,
&
str
);
ok
(
hr
==
S_OK
,
"ReadLine failed: %08x
\n
"
,
hr
);
ok
(
!
wcscmp
(
str
,
L"first line"
),
"ReadLine returned %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
hr
=
ITextStream_ReadLine
(
stream
,
&
str
);
ok
(
hr
==
S_OK
,
"ReadLine failed: %08x
\n
"
,
hr
);
ok
(
!
wcscmp
(
str
,
L"second"
),
"ReadLine returned %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
hr
=
ITextStream_ReadLine
(
stream
,
&
str
);
ok
(
hr
==
S_OK
,
"ReadLine failed: %08x
\n
"
,
hr
);
ok
(
!*
str
,
"ReadLine returned %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
hr
=
ITextStream_ReadLine
(
stream
,
&
str
);
ok
(
hr
==
S_OK
,
"ReadLine failed: %08x
\n
"
,
hr
);
ok
(
!
wcscmp
(
str
,
L"
\r
t
\r\r
e
\r
st"
),
"ReadLine returned %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
}
str
=
NULL
;
hr
=
ITextStream_ReadLine
(
stream
,
&
str
);
ok
(
hr
==
CTL_E_ENDOFFILE
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
str
,
"ReadLine returned %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
ITextStream_Release
(
stream
);
ret
=
DeleteFileW
(
path
);
ok
(
ret
,
"DeleteFile failed: %u
\n
"
,
GetLastError
());
ret
=
RemoveDirectoryW
(
dir
);
ok
(
ret
,
"RemoveDirectory failed: %u
\n
"
,
GetLastError
());
}
struct
driveexists_test
{
const
WCHAR
drivespec
[
10
];
const
INT
drivetype
;
...
...
@@ -2403,6 +2473,7 @@ START_TEST(filesystem)
test_WriteLine
();
test_ReadAll
();
test_Read
();
test_ReadLine
();
test_DriveExists
();
test_GetDriveName
();
test_GetDrive
();
...
...
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