Commit f4b04e2e authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/tests: Use compare_double() to test IBasicVideo::get_AvgTimePerFrame().

parent 09e32f57
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment