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
1aa15750
Commit
1aa15750
authored
Nov 14, 2012
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Nov 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winmm/tests: Add EOF and buffer pointer tests for mmio.
parent
a98fe810
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
0 deletions
+106
-0
mmio.c
dlls/winmm/tests/mmio.c
+106
-0
No files found.
dlls/winmm/tests/mmio.c
View file @
1aa15750
...
...
@@ -787,6 +787,110 @@ static void test_mmioSeek(void)
DeleteFileA
(
test_file
);
}
static
void
test_mmio_end_of_file
(
void
)
{
char
test_file
[
MAX_PATH
],
buffer
[
128
],
data
[
16
];
MMIOINFO
mmio
;
HMMIO
hmmio
;
LONG
ret
;
MMRESULT
res
;
if
(
!
create_test_file
(
test_file
))
return
;
memset
(
&
mmio
,
0
,
sizeof
(
mmio
));
mmio
.
fccIOProc
=
FOURCC_DOS
;
mmio
.
pchBuffer
=
buffer
;
mmio
.
cchBuffer
=
sizeof
(
buffer
);
hmmio
=
mmioOpen
(
test_file
,
&
mmio
,
MMIO_READ
);
ok
(
hmmio
!=
NULL
,
"mmioOpen error %u
\n
"
,
mmio
.
wErrorRet
);
if
(
hmmio
==
NULL
)
{
DeleteFileA
(
test_file
);
return
;
}
ret
=
mmioSeek
(
hmmio
,
0
,
SEEK_END
);
ok
(
sizeof
(
RIFF_buf
)
==
ret
,
"got %d
\n
"
,
ret
);
ret
=
mmioRead
(
hmmio
,
data
,
sizeof
(
data
));
todo_wine
ok
(
ret
==
0
,
"expected %d, got %d
\n
"
,
0
,
ret
);
res
=
mmioGetInfo
(
hmmio
,
&
mmio
,
0
);
ok
(
res
==
MMSYSERR_NOERROR
,
"expected 0, got %d
\n
"
,
res
);
res
=
mmioAdvance
(
hmmio
,
&
mmio
,
MMIO_READ
);
ok
(
res
==
MMSYSERR_NOERROR
,
"expected 0, got %d
\n
"
,
res
);
todo_wine
ok
(
mmio
.
pchNext
==
mmio
.
pchEndRead
,
"expected %p, got %p
\n
"
,
mmio
.
pchEndRead
,
mmio
.
pchNext
);
mmioClose
(
hmmio
,
0
);
DeleteFileA
(
test_file
);
}
static
void
test_mmio_buffer_pointer
(
void
)
{
char
test_file
[
MAX_PATH
];
char
buffer
[
5
],
data
[
16
];
MMIOINFO
mmio
;
HMMIO
hmmio
;
LONG
size
,
pos
;
MMRESULT
res
;
if
(
!
create_test_file
(
test_file
))
return
;
memset
(
&
mmio
,
0
,
sizeof
(
mmio
));
mmio
.
fccIOProc
=
FOURCC_DOS
;
mmio
.
pchBuffer
=
buffer
;
mmio
.
cchBuffer
=
sizeof
(
buffer
);
hmmio
=
mmioOpen
(
test_file
,
&
mmio
,
MMIO_READ
);
ok
(
hmmio
!=
NULL
,
"mmioOpen error %u
\n
"
,
mmio
.
wErrorRet
);
if
(
hmmio
==
NULL
)
{
DeleteFileA
(
test_file
);
return
;
}
/* the buffer is empty */
size
=
mmioRead
(
hmmio
,
data
,
0
);
ok
(
size
==
0
,
"expected 0, got %d
\n
"
,
size
);
res
=
mmioGetInfo
(
hmmio
,
&
mmio
,
0
);
ok
(
res
==
MMSYSERR_NOERROR
,
"expected 0, got %d
\n
"
,
res
);
ok
(
mmio
.
pchEndRead
==
mmio
.
pchBuffer
,
"expected %p, got %p
\n
"
,
mmio
.
pchBuffer
,
mmio
.
pchEndRead
);
/* fill the buffer */
size
=
mmioAdvance
(
hmmio
,
&
mmio
,
MMIO_READ
);
ok
(
mmio
.
pchEndRead
-
mmio
.
pchBuffer
==
sizeof
(
buffer
),
"got %d
\n
"
,
(
int
)(
mmio
.
pchEndRead
-
mmio
.
pchBuffer
));
/* seeking to the same buffer chunk, the buffer is kept */
size
=
sizeof
(
buffer
)
/
2
;
pos
=
mmioSeek
(
hmmio
,
size
,
SEEK_SET
);
ok
(
pos
==
size
,
"failed to seek, expected %d, got %d
\n
"
,
size
,
pos
);
res
=
mmioGetInfo
(
hmmio
,
&
mmio
,
0
);
ok
(
res
==
MMSYSERR_NOERROR
,
"expected 0, got %d
\n
"
,
res
);
ok
(
mmio
.
lBufOffset
==
0
,
"expected 0, got %d
\n
"
,
mmio
.
lBufOffset
);
ok
(
mmio
.
pchNext
-
mmio
.
pchBuffer
==
size
,
"expected %d, got %d
\n
"
,
size
,
(
int
)(
mmio
.
pchNext
-
mmio
.
pchBuffer
));
ok
(
mmio
.
pchEndRead
-
mmio
.
pchBuffer
==
sizeof
(
buffer
),
"got %d
\n
"
,
(
int
)(
mmio
.
pchEndRead
-
mmio
.
pchBuffer
));
/* seeking to another buffer chunk, the buffer is empty */
size
=
sizeof
(
buffer
)
*
3
+
sizeof
(
buffer
)
/
2
;
pos
=
mmioSeek
(
hmmio
,
size
,
SEEK_SET
);
ok
(
pos
==
size
,
"failed to seek, got %d
\n
"
,
pos
);
res
=
mmioGetInfo
(
hmmio
,
&
mmio
,
0
);
ok
(
res
==
MMSYSERR_NOERROR
,
"expected 0, got %d
\n
"
,
res
);
todo_wine
ok
(
mmio
.
lBufOffset
==
size
,
"expected %d, got %d
\n
"
,
size
,
mmio
.
lBufOffset
);
todo_wine
ok
(
mmio
.
pchNext
==
mmio
.
pchBuffer
,
"expected %p, got %p
\n
"
,
mmio
.
pchBuffer
,
mmio
.
pchNext
);
todo_wine
ok
(
mmio
.
pchEndRead
==
mmio
.
pchBuffer
,
"expected %p, got %p
\n
"
,
mmio
.
pchBuffer
,
mmio
.
pchEndRead
);
/* reading a lot (as sizeof(data) > mmio.cchBuffer), the buffer is empty */
size
=
mmioRead
(
hmmio
,
data
,
sizeof
(
data
));
ok
(
size
==
sizeof
(
data
),
"failed to read, got %d
\n
"
,
size
);
res
=
mmioGetInfo
(
hmmio
,
&
mmio
,
0
);
ok
(
res
==
MMSYSERR_NOERROR
,
"expected 0, got %d
\n
"
,
res
);
todo_wine
ok
(
mmio
.
lBufOffset
==
pos
+
size
,
"expected %d, got %d
\n
"
,
pos
+
size
,
mmio
.
lBufOffset
);
todo_wine
ok
(
mmio
.
pchNext
==
mmio
.
pchBuffer
,
"expected %p, got %p
\n
"
,
mmio
.
pchBuffer
,
mmio
.
pchNext
);
todo_wine
ok
(
mmio
.
pchEndRead
==
mmio
.
pchBuffer
,
"expected %p, got %p
\n
"
,
mmio
.
pchBuffer
,
mmio
.
pchEndRead
);
mmioClose
(
hmmio
,
0
);
DeleteFileA
(
test_file
);
}
START_TEST
(
mmio
)
{
/* Make it possible to run the tests against a specific AVI file in
...
...
@@ -803,4 +907,6 @@ START_TEST(mmio)
test_mmioSetBuffer
(
fname
);
test_mmioOpen_fourcc
();
test_mmioSeek
();
test_mmio_end_of_file
();
test_mmio_buffer_pointer
();
}
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