Zebediah Figura : quartz/tests: Use compare_double() to test IBasicVideo::get_AvgTimePerFrame().
Alexandre Julliard
julliard at winehq.org
Fri Oct 23 14:27:18 CDT 2020
Module: wine
Branch: master
Commit: f4b04e2e84e55d2e35d183c7c8a22b0a2e3bb9e2
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f4b04e2e84e55d2e35d183c7c8a22b0a2e3bb9e2
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Thu Oct 22 15:16:42 2020 -0500
quartz/tests: Use compare_double() to test IBasicVideo::get_AvgTimePerFrame().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/quartz/tests/vmr7.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c
index f1b19aa6634..d7eafe53be8 100644
--- a/dlls/quartz/tests/vmr7.c
+++ b/dlls/quartz/tests/vmr7.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include <stdint.h>
#define COBJMACROS
#include "dshow.h"
#include "d3d9.h"
@@ -65,6 +66,23 @@ static inline BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TY
&& !memcmp(a->pbFormat, b->pbFormat, a->cbFormat);
}
+static BOOL compare_double(double f, double g, unsigned int ulps)
+{
+ uint64_t x = *(ULONGLONG *)&f;
+ uint64_t y = *(ULONGLONG *)&g;
+
+ if (f < 0)
+ x = ~x + 1;
+ else
+ x |= ((ULONGLONG)1)<<63;
+ if (g < 0)
+ y = ~y + 1;
+ else
+ y |= ((ULONGLONG)1)<<63;
+
+ return (x>y ? x-y : y-x) <= ulps;
+}
+
static IFilterGraph2 *create_graph(void)
{
IFilterGraph2 *ret;
@@ -2707,7 +2725,7 @@ static void test_basic_video(void)
reftime = 0.0;
hr = IBasicVideo_get_AvgTimePerFrame(video, &reftime);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(reftime == 0.02, "Got frame rate %.16e.\n", reftime);
+ ok(compare_double(reftime, 0.02, 1 << 28), "Got frame rate %.16e.\n", reftime);
l = 0xdeadbeef;
hr = IBasicVideo_get_BitRate(video, &l);
More information about the wine-cvs
mailing list