Commit 34ab144f authored by Alexandre Julliard's avatar Alexandre Julliard

oleaut32/tests: Use nameless unions/structs.

parent 374d74e8
...@@ -114,7 +114,7 @@ static void test_ifont_size(LONGLONG size, LONG ratio_logical, LONG ratio_himetr ...@@ -114,7 +114,7 @@ static void test_ifont_size(LONGLONG size, LONG ratio_logical, LONG ratio_himetr
/* Check returned size - allow for errors due to rounding & font realization. */ /* Check returned size - allow for errors due to rounding & font realization. */
ok((psize.int64 - size) < 10000 && (psize.int64 - size) > -10000, ok((psize.int64 - size) < 10000 && (psize.int64 - size) > -10000,
"%s: IFont_get_Size: Lo=%ld, Hi=%ld; expected Lo=%ld, Hi=%ld.\n", "%s: IFont_get_Size: Lo=%ld, Hi=%ld; expected Lo=%ld, Hi=%ld.\n",
test_name, S(psize).Lo, S(psize).Hi, fd.cySize.Lo, fd.cySize.Hi); test_name, psize.Lo, psize.Hi, fd.cySize.Lo, fd.cySize.Hi);
/* Check hFont size. */ /* Check hFont size. */
hres = IFont_get_hFont (ifnt, &hfont); hres = IFont_get_hFont (ifnt, &hfont);
...@@ -439,8 +439,8 @@ static void test_font_events_disp(void) ...@@ -439,8 +439,8 @@ static void test_font_events_disp(void)
} }
case DISPID_FONT_SIZE: case DISPID_FONT_SIZE:
V_VT(&vararg) = VT_CY; V_VT(&vararg) = VT_CY;
S(V_CY(&vararg)).Lo = 25; V_CY(&vararg).Lo = 25;
S(V_CY(&vararg)).Hi = 0; V_CY(&vararg).Hi = 0;
break; break;
case DISPID_FONT_BOLD: case DISPID_FONT_BOLD:
V_VT(&vararg) = VT_BOOL; V_VT(&vararg) = VT_BOOL;
...@@ -664,8 +664,8 @@ static void test_IsEqual(void) ...@@ -664,8 +664,8 @@ static void test_IsEqual(void)
/* Basic font description */ /* Basic font description */
fd.cbSizeofstruct = sizeof(FONTDESC); fd.cbSizeofstruct = sizeof(FONTDESC);
fd.lpstrName = system_font; fd.lpstrName = system_font;
S(fd.cySize).Lo = 100; fd.cySize.Lo = 100;
S(fd.cySize).Hi = 100; fd.cySize.Hi = 100;
fd.sWeight = 0; fd.sWeight = 0;
fd.sCharset = 0; fd.sCharset = 0;
fd.fItalic = FALSE; fd.fItalic = FALSE;
...@@ -697,21 +697,21 @@ static void test_IsEqual(void) ...@@ -697,21 +697,21 @@ static void test_IsEqual(void)
IFont_Release(ifnt2); IFont_Release(ifnt2);
/* Test lo font size */ /* Test lo font size */
S(fd.cySize).Lo = 10000; fd.cySize.Lo = 10000;
pOleCreateFontIndirect(&fd, &IID_IFont, (void **)&ifnt2); pOleCreateFontIndirect(&fd, &IID_IFont, (void **)&ifnt2);
hres = IFont_IsEqual(ifnt,ifnt2); hres = IFont_IsEqual(ifnt,ifnt2);
ok(hres == S_FALSE, ok(hres == S_FALSE,
"IFont_IsEqual: (Lo font size) Expected S_FALSE but got 0x%08lx\n",hres); "IFont_IsEqual: (Lo font size) Expected S_FALSE but got 0x%08lx\n",hres);
S(fd.cySize).Lo = 100; fd.cySize.Lo = 100;
IFont_Release(ifnt2); IFont_Release(ifnt2);
/* Test hi font size */ /* Test hi font size */
S(fd.cySize).Hi = 10000; fd.cySize.Hi = 10000;
pOleCreateFontIndirect(&fd, &IID_IFont, (void **)&ifnt2); pOleCreateFontIndirect(&fd, &IID_IFont, (void **)&ifnt2);
hres = IFont_IsEqual(ifnt,ifnt2); hres = IFont_IsEqual(ifnt,ifnt2);
ok(hres == S_FALSE, ok(hres == S_FALSE,
"IFont_IsEqual: (Hi font size) Expected S_FALSE but got 0x%08lx\n",hres); "IFont_IsEqual: (Hi font size) Expected S_FALSE but got 0x%08lx\n",hres);
S(fd.cySize).Hi = 100; fd.cySize.Hi = 100;
IFont_Release(ifnt2); IFont_Release(ifnt2);
/* Test font weight */ /* Test font weight */
...@@ -777,8 +777,8 @@ static void test_ReleaseHfont(void) ...@@ -777,8 +777,8 @@ static void test_ReleaseHfont(void)
/* Basic font description */ /* Basic font description */
fd.cbSizeofstruct = sizeof(FONTDESC); fd.cbSizeofstruct = sizeof(FONTDESC);
fd.lpstrName = system_font; fd.lpstrName = system_font;
S(fd.cySize).Lo = 100; fd.cySize.Lo = 100;
S(fd.cySize).Hi = 100; fd.cySize.Hi = 100;
fd.sWeight = 0; fd.sWeight = 0;
fd.sCharset = 0; fd.sCharset = 0;
fd.fItalic = FALSE; fd.fItalic = FALSE;
...@@ -847,8 +847,8 @@ static void test_AddRefHfont(void) ...@@ -847,8 +847,8 @@ static void test_AddRefHfont(void)
/* Basic font description */ /* Basic font description */
fd.cbSizeofstruct = sizeof(FONTDESC); fd.cbSizeofstruct = sizeof(FONTDESC);
fd.lpstrName = system_font; fd.lpstrName = system_font;
S(fd.cySize).Lo = 100; fd.cySize.Lo = 100;
S(fd.cySize).Hi = 100; fd.cySize.Hi = 100;
fd.sWeight = 0; fd.sWeight = 0;
fd.sCharset = 0; fd.sCharset = 0;
fd.fItalic = FALSE; fd.fItalic = FALSE;
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#define COBJMACROS #define COBJMACROS
#define CONST_VTABLE #define CONST_VTABLE
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -461,19 +460,19 @@ static void init(void) ...@@ -461,19 +460,19 @@ static void init(void)
/* Functions to set a DECIMAL */ /* Functions to set a DECIMAL */
static void setdec(DECIMAL* dec, BYTE scl, BYTE sgn, ULONG hi32, ULONG64 lo64) static void setdec(DECIMAL* dec, BYTE scl, BYTE sgn, ULONG hi32, ULONG64 lo64)
{ {
S(U(*dec)).scale = scl; dec->scale = scl;
S(U(*dec)).sign = sgn; dec->sign = sgn;
dec->Hi32 = hi32; dec->Hi32 = hi32;
U1(*dec).Lo64 = lo64; dec->Lo64 = lo64;
} }
static void setdec64(DECIMAL* dec, BYTE scl, BYTE sgn, ULONG hi32, ULONG mid32, ULONG lo32) static void setdec64(DECIMAL* dec, BYTE scl, BYTE sgn, ULONG hi32, ULONG mid32, ULONG lo32)
{ {
S(U(*dec)).scale = scl; dec->scale = scl;
S(U(*dec)).sign = sgn; dec->sign = sgn;
dec->Hi32 = hi32; dec->Hi32 = hi32;
S1(U1(*dec)).Mid32 = mid32; dec->Mid32 = mid32;
S1(U1(*dec)).Lo32 = lo32; dec->Lo32 = lo32;
} }
/* return the string text of a given variant type */ /* return the string text of a given variant type */
...@@ -574,7 +573,7 @@ static const char *variantstr( const VARIANT *var ) ...@@ -574,7 +573,7 @@ static const char *variantstr( const VARIANT *var )
case VT_UINT: case VT_UINT:
sprintf( vtstr_buffer[vtstr_current], "VT_UINT(%d)", V_UINT(var) ); break; sprintf( vtstr_buffer[vtstr_current], "VT_UINT(%d)", V_UINT(var) ); break;
case VT_CY: case VT_CY:
sprintf( vtstr_buffer[vtstr_current], "VT_CY(%lx%08lx)", S(V_CY(var)).Hi, S(V_CY(var)).Lo ); break; sprintf( vtstr_buffer[vtstr_current], "VT_CY(%lx%08lx)", V_CY(var).Hi, V_CY(var).Lo ); break;
case VT_DATE: case VT_DATE:
sprintf( vtstr_buffer[vtstr_current], "VT_DATE(%g)", V_DATE(var) ); break; sprintf( vtstr_buffer[vtstr_current], "VT_DATE(%g)", V_DATE(var) ); break;
default: default:
...@@ -2543,10 +2542,10 @@ static const char *szFailOk = "Call failed, hres = %08x\n"; ...@@ -2543,10 +2542,10 @@ static const char *szFailOk = "Call failed, hres = %08x\n";
ok(V_CY(&vOut).int64 == (LONG64)(val * CY_MULTIPLIER), "Expected r8 = %#I64x, got %#I64x\n", \ ok(V_CY(&vOut).int64 == (LONG64)(val * CY_MULTIPLIER), "Expected r8 = %#I64x, got %#I64x\n", \
(LONG64)val, V_CY(&vOut).int64); } (LONG64)val, V_CY(&vOut).int64); }
#define EXPECT_DECIMAL(valHi, valMid, valLo) EXPECT_OK { EXPECT_TYPE(VT_DECIMAL); \ #define EXPECT_DECIMAL(valHi, valMid, valLo) EXPECT_OK { EXPECT_TYPE(VT_DECIMAL); \
ok((V_DECIMAL(&vOut).Hi32 == valHi) && (S1(U1(V_DECIMAL(&vOut))).Mid32 == valMid) && \ ok(V_DECIMAL(&vOut).Hi32 == valHi && V_DECIMAL(&vOut).Mid32 == valMid && \
(S1(U1(V_DECIMAL(&vOut))).Lo32 == valLo), \ V_DECIMAL(&vOut).Lo32 == valLo, \
"Expected decimal = %x/0x%x%08x, got %lx/0x%lx%08lx\n", valHi, valMid, valLo, \ "Expected decimal = %x/0x%x%08x, got %lx/0x%lx%08lx\n", valHi, valMid, valLo, \
V_DECIMAL(&vOut).Hi32, S1(U1(V_DECIMAL(&vOut))).Mid32, S1(U1(V_DECIMAL(&vOut))).Lo32); } V_DECIMAL(&vOut).Hi32, V_DECIMAL(&vOut).Mid32, V_DECIMAL(&vOut).Lo32); }
static void test_VarNumFromParseNum(void) static void test_VarNumFromParseNum(void)
{ {
...@@ -3265,11 +3264,11 @@ static void test_VarNot(void) ...@@ -3265,11 +3264,11 @@ static void test_VarNot(void)
VARNOT(BSTR, (BSTR)szTrue, BOOL, VARIANT_FALSE); VARNOT(BSTR, (BSTR)szTrue, BOOL, VARIANT_FALSE);
VARNOT(BSTR, (BSTR)szFalse, BOOL, VARIANT_TRUE); VARNOT(BSTR, (BSTR)szFalse, BOOL, VARIANT_TRUE);
S(U(*pdec)).sign = DECIMAL_NEG; pdec->sign = DECIMAL_NEG;
S(U(*pdec)).scale = 0; pdec->scale = 0;
pdec->Hi32 = 0; pdec->Hi32 = 0;
S1(U1(*pdec)).Mid32 = 0; pdec->Mid32 = 0;
S1(U1(*pdec)).Lo32 = 1; pdec->Lo32 = 1;
VARNOT(DECIMAL,*pdec,I4,0); VARNOT(DECIMAL,*pdec,I4,0);
pcy->int64 = 10000; pcy->int64 = 10000;
...@@ -3856,8 +3855,9 @@ static void test_VarMod(void) ...@@ -3856,8 +3855,9 @@ static void test_VarMod(void)
else if (l == VT_DECIMAL) else if (l == VT_DECIMAL)
{ {
V_DECIMAL(&v1).Hi32 = 0; V_DECIMAL(&v1).Hi32 = 0;
U1(V_DECIMAL(&v1)).Lo64 = 100; V_DECIMAL(&v1).Lo64 = 100;
U(V_DECIMAL(&v1)).signscale = 0; V_DECIMAL(&v1).sign = 0;
V_DECIMAL(&v1).scale = 0;
} }
else else
V_I4(&v1) = 10000; V_I4(&v1) = 10000;
...@@ -3877,8 +3877,9 @@ static void test_VarMod(void) ...@@ -3877,8 +3877,9 @@ static void test_VarMod(void)
else if (r == VT_DECIMAL) else if (r == VT_DECIMAL)
{ {
V_DECIMAL(&v2).Hi32 = 0; V_DECIMAL(&v2).Hi32 = 0;
U1(V_DECIMAL(&v2)).Lo64 = 100; V_DECIMAL(&v2).Lo64 = 100;
U(V_DECIMAL(&v2)).signscale = 0; V_DECIMAL(&v2).sign = 0;
V_DECIMAL(&v2).scale = 0;
} }
else else
V_I4(&v2) = 10000; V_I4(&v2) = 10000;
...@@ -4108,11 +4109,11 @@ static void test_VarFix(void) ...@@ -4108,11 +4109,11 @@ static void test_VarFix(void)
"VarFix: expected 0x0,%d got 0x%lX,%d\n", VT_NULL, hres, V_VT(&vDst)); "VarFix: expected 0x0,%d got 0x%lX,%d\n", VT_NULL, hres, V_VT(&vDst));
V_VT(&v) = VT_DECIMAL; V_VT(&v) = VT_DECIMAL;
S(U(*pdec)).sign = DECIMAL_NEG; pdec->sign = DECIMAL_NEG;
S(U(*pdec)).scale = 0; pdec->scale = 0;
pdec->Hi32 = 0; pdec->Hi32 = 0;
S1(U1(*pdec)).Mid32 = 0; pdec->Mid32 = 0;
S1(U1(*pdec)).Lo32 = 1; pdec->Lo32 = 1;
hres = pVarFix(&v,&vDst); hres = pVarFix(&v,&vDst);
ok(hres == S_OK && V_VT(&vDst) == VT_DECIMAL && !memcmp(&V_DECIMAL(&v), &V_DECIMAL(&vDst), sizeof(DECIMAL)), ok(hres == S_OK && V_VT(&vDst) == VT_DECIMAL && !memcmp(&V_DECIMAL(&v), &V_DECIMAL(&vDst), sizeof(DECIMAL)),
"VarFix: expected 0x0,%d,identical, got 0x%lX,%d\n", VT_DECIMAL, "VarFix: expected 0x0,%d,identical, got 0x%lX,%d\n", VT_DECIMAL,
...@@ -4223,11 +4224,11 @@ static void test_VarInt(void) ...@@ -4223,11 +4224,11 @@ static void test_VarInt(void)
"VarInt: expected 0x0,%d got 0x%lX,%d\n", VT_NULL, hres, V_VT(&vDst)); "VarInt: expected 0x0,%d got 0x%lX,%d\n", VT_NULL, hres, V_VT(&vDst));
V_VT(&v) = VT_DECIMAL; V_VT(&v) = VT_DECIMAL;
S(U(*pdec)).sign = DECIMAL_NEG; pdec->sign = DECIMAL_NEG;
S(U(*pdec)).scale = 0; pdec->scale = 0;
pdec->Hi32 = 0; pdec->Hi32 = 0;
S1(U1(*pdec)).Mid32 = 0; pdec->Mid32 = 0;
S1(U1(*pdec)).Lo32 = 1; pdec->Lo32 = 1;
hres = pVarInt(&v,&vDst); hres = pVarInt(&v,&vDst);
ok(hres == S_OK && V_VT(&vDst) == VT_DECIMAL && !memcmp(&V_DECIMAL(&v), &V_DECIMAL(&vDst), sizeof(DECIMAL)), ok(hres == S_OK && V_VT(&vDst) == VT_DECIMAL && !memcmp(&V_DECIMAL(&v), &V_DECIMAL(&vDst), sizeof(DECIMAL)),
"VarInt: expected 0x0,%d,identical, got 0x%lX,%d\n", VT_DECIMAL, "VarInt: expected 0x0,%d,identical, got 0x%lX,%d\n", VT_DECIMAL,
...@@ -4348,23 +4349,23 @@ static void test_VarNeg(void) ...@@ -4348,23 +4349,23 @@ static void test_VarNeg(void)
"VarNeg: expected 0x0,%d got 0x%lX,%d\n", VT_NULL, hres, V_VT(&vDst)); "VarNeg: expected 0x0,%d got 0x%lX,%d\n", VT_NULL, hres, V_VT(&vDst));
V_VT(&v) = VT_DECIMAL; V_VT(&v) = VT_DECIMAL;
S(U(*pdec)).sign = DECIMAL_NEG; pdec->sign = DECIMAL_NEG;
S(U(*pdec)).scale = 0; pdec->scale = 0;
pdec->Hi32 = 0; pdec->Hi32 = 0;
S1(U1(*pdec)).Mid32 = 0; pdec->Mid32 = 0;
S1(U1(*pdec)).Lo32 = 1; pdec->Lo32 = 1;
hres = pVarNeg(&v,&vDst); hres = pVarNeg(&v,&vDst);
ok(hres == S_OK && V_VT(&vDst) == VT_DECIMAL && ok(hres == S_OK && V_VT(&vDst) == VT_DECIMAL &&
S(U(V_DECIMAL(&vDst))).sign == 0, V_DECIMAL(&vDst).sign == 0,
"VarNeg: expected 0x0,%d,0x00, got 0x%lX,%d,%02x\n", VT_DECIMAL, "VarNeg: expected 0x0,%d,0x00, got 0x%lX,%d,%02x\n", VT_DECIMAL,
hres, V_VT(&vDst), S(U(V_DECIMAL(&vDst))).sign); hres, V_VT(&vDst), V_DECIMAL(&vDst).sign);
S(U(*pdec)).sign = 0; pdec->sign = 0;
hres = pVarNeg(&v,&vDst); hres = pVarNeg(&v,&vDst);
ok(hres == S_OK && V_VT(&vDst) == VT_DECIMAL && ok(hres == S_OK && V_VT(&vDst) == VT_DECIMAL &&
S(U(V_DECIMAL(&vDst))).sign == DECIMAL_NEG, V_DECIMAL(&vDst).sign == DECIMAL_NEG,
"VarNeg: expected 0x0,%d,0x7f, got 0x%lX,%d,%02x\n", VT_DECIMAL, "VarNeg: expected 0x0,%d,0x7f, got 0x%lX,%d,%02x\n", VT_DECIMAL,
hres, V_VT(&vDst), S(U(V_DECIMAL(&vDst))).sign); hres, V_VT(&vDst), V_DECIMAL(&vDst).sign);
V_VT(&v) = VT_CY; V_VT(&v) = VT_CY;
pcy->int64 = -10000; pcy->int64 = -10000;
...@@ -4512,25 +4513,25 @@ static void test_VarRound(void) ...@@ -4512,25 +4513,25 @@ static void test_VarRound(void)
pdec = &V_DECIMAL(&v); pdec = &V_DECIMAL(&v);
V_VT(&v) = VT_DECIMAL; V_VT(&v) = VT_DECIMAL;
S(U(*pdec)).sign = ptr->source.sign; pdec->sign = ptr->source.sign;
S(U(*pdec)).scale = ptr->source.scale; pdec->scale = ptr->source.scale;
pdec->Hi32 = ptr->source.Hi32; pdec->Hi32 = ptr->source.Hi32;
S1(U1(*pdec)).Mid32 = ptr->source.Mid32; pdec->Mid32 = ptr->source.Mid32;
S1(U1(*pdec)).Lo32 = ptr->source.Lo32; pdec->Lo32 = ptr->source.Lo32;
VariantInit(&vDst); VariantInit(&vDst);
hres = pVarRound(&v, ptr->dec, &vDst); hres = pVarRound(&v, ptr->dec, &vDst);
ok(hres == S_OK, "%d: got 0x%08lx\n", i, hres); ok(hres == S_OK, "%d: got 0x%08lx\n", i, hres);
if (hres == S_OK) if (hres == S_OK)
{ {
ok(V_VT(&vDst) == VT_DECIMAL, "%d: got VT %d, expected VT_DECIMAL\n", i, V_VT(&vDst)); ok(V_VT(&vDst) == VT_DECIMAL, "%d: got VT %d, expected VT_DECIMAL\n", i, V_VT(&vDst));
ok(S(U(V_DECIMAL(&vDst))).sign == ptr->ret.sign, "%d: got sign 0x%02x, expected 0x%02x\n", ok(V_DECIMAL(&vDst).sign == ptr->ret.sign, "%d: got sign 0x%02x, expected 0x%02x\n",
i, S(U(V_DECIMAL(&vDst))).sign, ptr->ret.sign); i, V_DECIMAL(&vDst).sign, ptr->ret.sign);
ok(V_DECIMAL(&vDst).Hi32 == ptr->ret.Hi32, "%d: got Hi32 %ld, expected %ld\n", ok(V_DECIMAL(&vDst).Hi32 == ptr->ret.Hi32, "%d: got Hi32 %ld, expected %ld\n",
i, V_DECIMAL(&vDst).Hi32, ptr->ret.Hi32); i, V_DECIMAL(&vDst).Hi32, ptr->ret.Hi32);
ok(S1(U1(V_DECIMAL(&vDst))).Mid32 == ptr->ret.Mid32, "%d: got Mid32 %ld, expected %ld\n", ok(V_DECIMAL(&vDst).Mid32 == ptr->ret.Mid32, "%d: got Mid32 %ld, expected %ld\n",
i, S1(U1(V_DECIMAL(&vDst))).Mid32, ptr->ret.Mid32); i, V_DECIMAL(&vDst).Mid32, ptr->ret.Mid32);
ok(S1(U1(V_DECIMAL(&vDst))).Lo32 == ptr->ret.Lo32, "%d: got Lo32 %ld, expected %ld\n", ok(V_DECIMAL(&vDst).Lo32 == ptr->ret.Lo32, "%d: got Lo32 %ld, expected %ld\n",
i, S1(U1(V_DECIMAL(&vDst))).Lo32, ptr->ret.Lo32); i, V_DECIMAL(&vDst).Lo32, ptr->ret.Lo32);
} }
} }
......
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