Commit 9ed8a2b6 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus: GdipGetStringFormatDigitSubstitution implemented.

parent 923918da
......@@ -387,7 +387,7 @@
@ stdcall GdipGetSmoothingMode(ptr ptr)
@ stdcall GdipGetSolidFillColor(ptr ptr)
@ stdcall GdipGetStringFormatAlign(ptr ptr)
@ stub GdipGetStringFormatDigitSubstitution
@ stdcall GdipGetStringFormatDigitSubstitution(ptr ptr ptr)
@ stdcall GdipGetStringFormatFlags(ptr ptr)
@ stdcall GdipGetStringFormatHotkeyPrefix(ptr ptr)
@ stdcall GdipGetStringFormatLineAlign(ptr ptr)
......
......@@ -188,10 +188,12 @@ struct GpFont{
struct GpStringFormat{
INT attr;
LANGID lang;
LANGID digitlang;
StringAlignment align;
StringTrimming trimming;
HotkeyPrefix hkprefix;
StringAlignment vertalign;
StringDigitSubstitute digitsub;
};
struct GpFontCollection{
......
......@@ -43,7 +43,9 @@ GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
(*format)->attr = attr;
(*format)->lang = lang;
(*format)->digitlang = LANG_NEUTRAL;
(*format)->trimming = StringTrimmingCharacter;
(*format)->digitsub = StringDigitSubstituteUser;
return Ok;
}
......@@ -79,6 +81,18 @@ GpStatus WINGDIPAPI GdipGetStringFormatAlign(GpStringFormat *format,
return Ok;
}
GpStatus WINGDIPAPI GdipGetStringFormatDigitSubstitution(GDIPCONST GpStringFormat *format,
LANGID *language, StringDigitSubstitute *substitute)
{
if(!format)
return InvalidParameter;
if(language) *language = format->digitlang;
if(substitute) *substitute = format->digitsub;
return Ok;
}
GpStatus WINGDIPAPI GdipGetStringFormatFlags(GDIPCONST GpStringFormat* format,
INT* flags)
{
......
......@@ -31,6 +31,8 @@ static void test_constructor(void)
INT n;
StringAlignment align, valign;
StringTrimming trimming;
StringDigitSubstitute digitsub;
LANGID digitlang;
stat = GdipCreateStringFormat(0, 0, &format);
expect(Ok, stat);
......@@ -39,11 +41,14 @@ static void test_constructor(void)
GdipGetStringFormatLineAlign(format, &valign);
GdipGetStringFormatHotkeyPrefix(format, &n);
GdipGetStringFormatTrimming(format, &trimming);
GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
expect(HotkeyPrefixNone, n);
expect(StringAlignmentNear, align);
expect(StringAlignmentNear, align);
expect(StringTrimmingCharacter, trimming);
expect(StringDigitSubstituteUser, digitsub);
expect(LANG_NEUTRAL, digitlang);
stat = GdipDeleteStringFormat(format);
expect(Ok, stat);
......@@ -70,6 +75,47 @@ todo_wine
expect(Ok, stat);
}
static void test_digitsubstitution(void)
{
GpStringFormat *format;
GpStatus stat;
StringDigitSubstitute digitsub;
LANGID digitlang;
stat = GdipCreateStringFormat(0, LANG_RUSSIAN, &format);
expect(Ok, stat);
/* NULL arguments */
stat = GdipGetStringFormatDigitSubstitution(NULL, NULL, NULL);
expect(InvalidParameter, stat);
stat = GdipGetStringFormatDigitSubstitution(format, NULL, NULL);
expect(Ok, stat);
stat = GdipGetStringFormatDigitSubstitution(NULL, &digitlang, NULL);
expect(InvalidParameter, stat);
stat = GdipGetStringFormatDigitSubstitution(NULL, NULL, &digitsub);
expect(InvalidParameter, stat);
stat = GdipGetStringFormatDigitSubstitution(NULL, &digitlang, &digitsub);
expect(InvalidParameter, stat);
/* try to get both and one by one */
stat = GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
expect(Ok, stat);
expect(StringDigitSubstituteUser, digitsub);
expect(LANG_NEUTRAL, digitlang);
digitsub = StringDigitSubstituteNone;
stat = GdipGetStringFormatDigitSubstitution(format, NULL, &digitsub);
expect(Ok, stat);
expect(StringDigitSubstituteUser, digitsub);
digitlang = LANG_RUSSIAN;
stat = GdipGetStringFormatDigitSubstitution(format, &digitlang, NULL);
expect(Ok, stat);
expect(LANG_NEUTRAL, digitlang);
stat = GdipDeleteStringFormat(format);
expect(Ok, stat);
}
START_TEST(stringformat)
{
......@@ -85,6 +131,7 @@ START_TEST(stringformat)
test_constructor();
test_characterrange();
test_digitsubstitution();
GdiplusShutdown(gdiplusToken);
}
......@@ -227,6 +227,14 @@ enum StringAlignment
StringAlignmentFar = 2
};
enum StringDigitSubstitute
{
StringDigitSubstituteUser = 0,
StringDigitSubstituteNone = 1,
StringDigitSubstituteNational = 2,
StringDigitSubstituteTraditional = 3
};
enum StringFormatFlags
{
StringFormatFlagsDirectionRightToLeft = 0x00000001,
......@@ -346,6 +354,7 @@ typedef enum EmfType EmfType;
typedef enum CompositingMode CompositingMode;
typedef enum TextRenderingHint TextRenderingHint;
typedef enum StringAlignment StringAlignment;
typedef enum StringDigitSubstitute StringDigitSubstitute;
typedef enum StringTrimming StringTrimming;
typedef enum FontStyle FontStyle;
typedef enum StringFormatFlags StringFormatFlags;
......
......@@ -436,6 +436,8 @@ GpStatus WINGDIPAPI GdipCreateStringFormat(INT,LANGID,GpStringFormat**);
GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat*);
GpStatus WINGDIPAPI GdipStringFormatGetGenericDefault(GpStringFormat **);
GpStatus WINGDIPAPI GdipGetStringFormatAlign(GpStringFormat*,StringAlignment*);
GpStatus WINGDIPAPI GdipGetStringFormatDigitSubstitution(GDIPCONST GpStringFormat*,LANGID*,
StringDigitSubstitute*);
GpStatus WINGDIPAPI GdipGetStringFormatFlags(GDIPCONST GpStringFormat*, INT*);
GpStatus WINGDIPAPI GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat*,INT*);
GpStatus WINGDIPAPI GdipGetStringFormatLineAlign(GpStringFormat*,StringAlignment*);
......
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