Zebediah Figura : quartz/tests: Add more strict tests for accurate duration retrieval.
Alexandre Julliard
julliard at winehq.org
Thu Jul 22 16:28:18 CDT 2021
Module: wine
Branch: master
Commit: 5d4083aba2901e304f92be86488c267d606225da
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5d4083aba2901e304f92be86488c267d606225da
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Thu Jul 22 00:19:04 2021 -0500
quartz/tests: Add more strict tests for accurate duration retrieval.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/quartz/tests/avisplit.c | 2 +-
dlls/quartz/tests/mpegsplit.c | 51 +++++++++++++++++++++++++++++++++++++++++-
dlls/quartz/tests/waveparser.c | 2 +-
3 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c
index 7ded1773637..10088c033b7 100644
--- a/dlls/quartz/tests/avisplit.c
+++ b/dlls/quartz/tests/avisplit.c
@@ -1537,7 +1537,7 @@ static void test_seeking(void)
duration = 0;
hr = IMediaSeeking_GetDuration(seeking, &duration);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(duration > 0, "Got duration %s.\n", wine_dbgstr_longlong(duration));
+ ok(duration == 50000000, "Got duration %I64d.\n", duration);
stop = current = 0xdeadbeef;
hr = IMediaSeeking_GetStopPosition(seeking, &stop);
diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c
index be971897f99..9c0c34d6c9c 100644
--- a/dlls/quartz/tests/mpegsplit.c
+++ b/dlls/quartz/tests/mpegsplit.c
@@ -1705,7 +1705,7 @@ static void test_seeking(void)
duration = 0;
hr = IMediaSeeking_GetDuration(seeking, &duration);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(duration > 0, "Got duration %s.\n", wine_dbgstr_longlong(duration));
+ ok(duration == 5392500, "Got duration %I64d.\n", duration);
stop = current = 0xdeadbeef;
hr = IMediaSeeking_GetStopPosition(seeking, &stop);
@@ -1894,6 +1894,54 @@ static void test_streaming(void)
ok(ret, "Failed to delete file, error %u.\n", GetLastError());
}
+static void test_large_file(void)
+{
+ static const BYTE frame[96] = {0xff, 0xfb, 0x14, 0xc4};
+ IBaseFilter *filter = create_mpeg_splitter();
+ static WCHAR path[MAX_PATH];
+ REFERENCE_TIME duration;
+ IMediaSeeking *seeking;
+ IFilterGraph2 *graph;
+ unsigned int i;
+ IPin *source;
+ BYTE *buffer;
+ HRESULT hr;
+ ULONG ref;
+ DWORD ret;
+ FILE *f;
+
+ GetTempPathW(ARRAY_SIZE(path), path);
+ wcscat(path, L"big_test.mp3");
+
+ /* allocate a larger buffer so I/O is faster on the testbot */
+ buffer = malloc(1000 * sizeof(frame));
+ for (i = 0; i < 1000; ++i)
+ memcpy(buffer + i * 96, frame, sizeof(frame));
+ f = _wfopen(path, L"w");
+ for (i = 0; i < 100; ++i)
+ fwrite(buffer, 1000 * sizeof(frame), 1, f);
+ fclose(f);
+ free(buffer);
+
+ graph = connect_input(filter, path);
+ IBaseFilter_FindPin(filter, L"Audio", &source);
+ IPin_QueryInterface(source, &IID_IMediaSeeking, (void **)&seeking);
+
+ duration = 0xdeadbeef;
+ hr = IMediaSeeking_GetDuration(seeking, &duration);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(duration == 2400 * 10000000ull, "Got duration %I64d.\n", duration);
+
+ IMediaSeeking_Release(seeking);
+ IPin_Release(source);
+ ref = IFilterGraph2_Release(graph);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ ref = IBaseFilter_Release(filter);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ ret = DeleteFileW(path);
+ ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+}
+
START_TEST(mpegsplit)
{
IBaseFilter *filter;
@@ -1919,6 +1967,7 @@ START_TEST(mpegsplit)
test_connect_pin();
test_seeking();
test_streaming();
+ test_large_file();
CoUninitialize();
}
diff --git a/dlls/quartz/tests/waveparser.c b/dlls/quartz/tests/waveparser.c
index f78e15e5c19..fee93b33f5f 100644
--- a/dlls/quartz/tests/waveparser.c
+++ b/dlls/quartz/tests/waveparser.c
@@ -929,7 +929,7 @@ static void test_seeking(void)
duration = 0xdeadbeef;
hr = IMediaSeeking_GetDuration(seeking, &duration);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(duration > 0, "Got duration %s.\n", wine_dbgstr_longlong(duration));
+ ok(duration == 1000000, "Got duration %I64d.\n", duration);
stop = current = 0xdeadbeef;
hr = IMediaSeeking_GetStopPosition(seeking, &stop);
More information about the wine-cvs
mailing list