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

gdiplus: GdipGetStringFormatDigitSubstitution implemented.

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