From: Giovanni Mascellani wine@mascellani.eu
Signed-off-by: Giovanni Mascellani wine@mascellani.eu Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- Minor style fixes.
dlls/d2d1/d2d1.spec | 2 +- dlls/d2d1/factory.c | 7 +++++++ dlls/d2d1/tests/d2d1.c | 23 ++++++++++++++++++++++- include/d2d1_1.idl | 1 + 4 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/dlls/d2d1/d2d1.spec b/dlls/d2d1/d2d1.spec index 410abfa5de6..7b624c7096e 100644 --- a/dlls/d2d1/d2d1.spec +++ b/dlls/d2d1/d2d1.spec @@ -7,5 +7,5 @@ @ stdcall D2D1CreateDevice(ptr ptr ptr) @ stub D2D1CreateDeviceContext @ stdcall D2D1SinCos(float ptr ptr) -@ stub D2D1Tan +@ stdcall D2D1Tan(float) @ stub D2D1Vec3Length diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c index 943347d7884..9c5337590cd 100644 --- a/dlls/d2d1/factory.c +++ b/dlls/d2d1/factory.c @@ -721,6 +721,13 @@ void WINAPI D2D1SinCos(float angle, float *s, float *c) *c = cosf(angle); }
+float WINAPI D2D1Tan(float angle) +{ + TRACE("angle %.8e.\n", angle); + + return tanf(angle); +} + static BOOL get_config_key_dword(HKEY default_key, HKEY application_key, const char *name, DWORD *value) { DWORD type, data, size; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index df1df01c051..b269770365f 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9428,7 +9428,7 @@ static void test_wic_bitmap_format(void) static void test_math(void) { unsigned int i; - float s, c; + float s, c, t;
static const struct { @@ -9445,6 +9445,20 @@ static void test_math(void) {M_PI, -8.74227766e-008f, -1.0f}, };
+ static const struct + { + float x; + float t; + } + t_data[] = + { + {0.0f, 0.0f}, + {1.0f, 1.55740774f}, + {2.0f, -2.18503976f}, + {M_PI / 2.0f, -2.28773320e+007f}, + {M_PI, 8.74227766e-008f}, + }; + for (i = 0; i < ARRAY_SIZE(sc_data); ++i) { D2D1SinCos(sc_data[i].x, &s, &c); @@ -9453,6 +9467,13 @@ static void test_math(void) ok(compare_float(c, sc_data[i].c, 0), "Test %u: Got unexpected cos %.8e, expected %.8e.\n", i, c, sc_data[i].c); } + + for (i = 0; i < ARRAY_SIZE(t_data); ++i) + { + t = D2D1Tan(t_data[i].x); + ok(compare_float(t, t_data[i].t, 1), + "Test %u: Got unexpected tan %.8e, expected %.8e.\n", i, t, t_data[i].t); + } }
START_TEST(d2d1) diff --git a/include/d2d1_1.idl b/include/d2d1_1.idl index 6fa893edbda..bd111bd6628 100644 --- a/include/d2d1_1.idl +++ b/include/d2d1_1.idl @@ -795,3 +795,4 @@ interface ID2D1Factory1 : ID2D1Factory [local] HRESULT __stdcall D2D1CreateDevice(IDXGIDevice *dxgi_device, const D2D1_CREATION_PROPERTIES *creation_properties, ID2D1Device **device); [local] void __stdcall D2D1SinCos(float angle, float *s, float *c); +[local] float __stdcall D2D1Tan(float angle);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=80997
Your paranoid android.
=== w2008s64 (32 bit report) ===
d2d1: d2d1: Timeout
=== w2008s64 (64 bit report) ===
d2d1: d2d1: Timeout
Just asking. Do we need tests for these functions? These seems to be just wrapper of libc provided math functions.
Hi,
Il 26/10/20 17:58, Biswapriyo Nath ha scritto:
Just asking. Do we need tests for these functions? These seems to be just wrapper of libc provided math functions.
From my point of view, testing in Wine is more to check that these
functions behave identically as in Windows, than to check that Wine itself is correct. Or, said differently, "being correct" for Wine is defined as "being identical to Windows", which does not necessarily equates to "doing the thing you should obviously do".
Giovanni.