Tests show test propsys:propsys is failing for many Windows 7 machines. https://test.winehq.org/data/patterns-tb-win.html#propsys:propsys
It looks like windows 7 processes VT_R4 like VT_R8. (`0.125f / 0x3e000000 (float/4 byte)` becomes `5.1392085562440189e-315 / 0x3e000000 (double/8 byte)`.
Is this worth the effort to remove the failures from the test patterns page?
-- v3: propsys/tests: Add broken for unexpected value in windows 7.
From: Bernhard Übelacker bernhardu@mailbox.org
--- dlls/propsys/tests/propsys.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/propsys/tests/propsys.c b/dlls/propsys/tests/propsys.c index 76d6c866546..018b3de003f 100644 --- a/dlls/propsys/tests/propsys.c +++ b/dlls/propsys/tests/propsys.c @@ -1747,6 +1747,38 @@ do \ } \ } while (0)
+/* This is to handle a Win7 case, + where VT_R4 returns the string expected from VT_R8. */ +#define check_PropVariantToBSTR2(type, member, value, expect_str) \ +do \ +{ \ + PROPVARIANT check_propvar_ = {.vt = (type), .member = (value)}; \ + HRESULT check_hr_, check_hr2_; \ + BSTR check_bstr_, check_bstr2_; \ + \ + ok_(__FILE__, __LINE__)((type) == VT_R4, \ + "check_PropVariantToBSTR2 handles just VT_R4.\n"); \ + \ + check_hr_ = PropVariantToBSTR(&check_propvar_, &check_bstr_); \ + ok_(__FILE__, __LINE__)(check_hr_ == S_OK, \ + "PropVariantToBSTR returned %#lx.\n", check_hr_); \ + \ + check_propvar_.vt = VT_R8; \ + check_hr2_ = PropVariantToBSTR(&check_propvar_, &check_bstr2_); \ + ok_(__FILE__, __LINE__)(check_hr2_ == S_OK, \ + "PropVariantToBSTR returned %#lx.\n", check_hr2_); \ + \ + if (check_hr_ == S_OK && check_bstr2_ == S_OK) \ + { \ + ok_(__FILE__, __LINE__)( \ + !wcscmp(check_bstr_, (expect_str)) || \ + broken(!wcscmp(check_bstr_, check_bstr2_)), \ + "Unexpected bstr %s.\n", debugstr_w(check_bstr_)); \ + SysFreeString(check_bstr_); \ + SysFreeString(check_bstr2_); \ + } \ +} while (0) + static void test_PropVariantToBSTR(void) { unsigned char test_bytes[] = {1, 20, 30, 4}; @@ -1765,7 +1797,7 @@ static void test_PropVariantToBSTR(void) todo_wine { check_PropVariantToBSTR(VT_BOOL, boolVal, TRUE, L"1"); - check_PropVariantToBSTR(VT_R4, fltVal, 0.125f, L"0.125"); + check_PropVariantToBSTR2(VT_R4, fltVal, 0.125f, L"0.125"); check_PropVariantToBSTR(VT_R8, dblVal, 0.456, L"0.456"); } check_PropVariantToBSTR(VT_I1, cVal, -123, L"-123");
v3: - Avoid adding unexpected strings, instead detect the broken by comparing return values for R4 and R8 from the same memory content.
On Mon Mar 3 12:51:08 2025 +0000, Nikolay Sivov wrote:
Yes, could do that. I was also thinking we could do string comparison for R4 vs R8 with the same float field value. When strings are the same presumably you get this broken case, without specifying nonsensical string constant.
Understood, better to avoid specifying unexpected values, tried to achieve this in v3.