[3/4] gdiplus: GdipSetStringFormatDigitSubstitution implemented

Nikolay Sivov bunglehead at gmail.com
Mon Jul 28 16:12:59 CDT 2008


Changelog:
    - implemented GdipSetStringFormatDigitSubstitution
    - some tests added
---
 dlls/gdiplus/gdiplus.spec         |    2 +-
 dlls/gdiplus/stringformat.c       |   13 +++++++++++++
 dlls/gdiplus/tests/stringformat.c |   13 +++++++++++++
 include/gdiplusflat.h             |    1 +
 4 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index b121959..e3186a3 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -586,7 +586,7 @@
 @ stdcall GdipSetSmoothingMode(ptr long)
 @ stdcall GdipSetSolidFillColor(ptr ptr)
 @ stdcall GdipSetStringFormatAlign(ptr long)
-@ stub GdipSetStringFormatDigitSubstitution
+@ stdcall GdipSetStringFormatDigitSubstitution(ptr long long)
 @ stdcall GdipSetStringFormatFlags(ptr long)
 @ stdcall GdipSetStringFormatHotkeyPrefix(ptr long)
 @ stdcall GdipSetStringFormatLineAlign(ptr long)
diff --git a/dlls/gdiplus/stringformat.c b/dlls/gdiplus/stringformat.c
index 1ce6d0e..4bd5bb3 100644
--- a/dlls/gdiplus/stringformat.c
+++ b/dlls/gdiplus/stringformat.c
@@ -159,6 +159,19 @@ GpStatus WINGDIPAPI GdipSetStringFormatAlign(GpStringFormat *format,
     return Ok;
 }
 
+/*FIXME: digit substitution actually not implemented, get/set only */
+GpStatus WINGDIPAPI GdipSetStringFormatDigitSubstitution(GpStringFormat *format,
+    LANGID language, StringDigitSubstitute substitute)
+{
+    if(!format)
+        return InvalidParameter;
+
+    format->digitlang = language;
+    format->digitsub  = substitute;
+
+    return Ok;
+}
+
 GpStatus WINGDIPAPI GdipSetStringFormatHotkeyPrefix(GpStringFormat *format,
     INT hkpx)
 {
diff --git a/dlls/gdiplus/tests/stringformat.c b/dlls/gdiplus/tests/stringformat.c
index fdf4f34..68d9d35 100644
--- a/dlls/gdiplus/tests/stringformat.c
+++ b/dlls/gdiplus/tests/stringformat.c
@@ -96,6 +96,8 @@ static void test_digitsubstitution(void)
     expect(InvalidParameter, stat);
     stat = GdipGetStringFormatDigitSubstitution(NULL, &digitlang, &digitsub);
     expect(InvalidParameter, stat);
+    stat = GdipSetStringFormatDigitSubstitution(NULL, LANG_NEUTRAL, StringDigitSubstituteNone);
+    expect(InvalidParameter, stat);
 
     /* try to get both and one by one */
     stat = GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
@@ -113,6 +115,17 @@ static void test_digitsubstitution(void)
     expect(Ok, stat);
     expect(LANG_NEUTRAL, digitlang);
 
+    /* set/get */
+    stat = GdipSetStringFormatDigitSubstitution(format, MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL),
+                                                        StringDigitSubstituteUser);
+    expect(Ok, stat);
+    digitsub  = StringDigitSubstituteNone;
+    digitlang = LANG_RUSSIAN;
+    stat = GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
+    expect(Ok, stat);
+    expect(StringDigitSubstituteUser, digitsub);
+    expect(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), digitlang); 
+
     stat = GdipDeleteStringFormat(format);
     expect(Ok, stat);
 }
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 723ec1d..ea4f200 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -445,6 +445,7 @@ GpStatus WINGDIPAPI GdipGetStringFormatMeasurableCharacterRangeCount(
         GDIPCONST GpStringFormat*, INT*);
 GpStatus WINGDIPAPI GdipGetStringFormatTrimming(GpStringFormat*,StringTrimming*);
 GpStatus WINGDIPAPI GdipSetStringFormatAlign(GpStringFormat*,StringAlignment);
+GpStatus WINGDIPAPI GdipSetStringFormatDigitSubstitution(GpStringFormat*,LANGID,StringDigitSubstitute);
 GpStatus WINGDIPAPI GdipSetStringFormatHotkeyPrefix(GpStringFormat*,INT);
 GpStatus WINGDIPAPI GdipSetStringFormatLineAlign(GpStringFormat*,StringAlignment);
 GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges(
-- 
1.4.4.4






More information about the wine-patches mailing list