mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
gdiplus: GdipGetStringFormatTabStopCount implementation with tests.
This commit is contained in:
parent
e6bce797d3
commit
4a08c13ba9
@ -392,7 +392,7 @@
|
||||
@ stdcall GdipGetStringFormatHotkeyPrefix(ptr ptr)
|
||||
@ stdcall GdipGetStringFormatLineAlign(ptr ptr)
|
||||
@ stdcall GdipGetStringFormatMeasurableCharacterRangeCount(ptr ptr)
|
||||
@ stub GdipGetStringFormatTabStopCount
|
||||
@ stdcall GdipGetStringFormatTabStopCount(ptr ptr)
|
||||
@ stub GdipGetStringFormatTabStops
|
||||
@ stdcall GdipGetStringFormatTrimming(ptr ptr)
|
||||
@ stub GdipGetTextContrast
|
||||
|
@ -194,6 +194,9 @@ struct GpStringFormat{
|
||||
HotkeyPrefix hkprefix;
|
||||
StringAlignment vertalign;
|
||||
StringDigitSubstitute digitsub;
|
||||
INT tabcount;
|
||||
REAL firsttab;
|
||||
REAL *tabs;
|
||||
};
|
||||
|
||||
struct GpFontCollection{
|
||||
|
@ -46,6 +46,10 @@ GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
|
||||
(*format)->digitlang = LANG_NEUTRAL;
|
||||
(*format)->trimming = StringTrimmingCharacter;
|
||||
(*format)->digitsub = StringDigitSubstituteUser;
|
||||
/* tabstops */
|
||||
(*format)->tabcount = 0;
|
||||
(*format)->firsttab = 0.0;
|
||||
(*format)->tabs = NULL;
|
||||
|
||||
return Ok;
|
||||
}
|
||||
@ -55,6 +59,7 @@ GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
|
||||
if(!format)
|
||||
return InvalidParameter;
|
||||
|
||||
GdipFree(format->tabs);
|
||||
GdipFree(format);
|
||||
|
||||
return Ok;
|
||||
@ -137,6 +142,17 @@ GpStatus WINGDIPAPI GdipGetStringFormatMeasurableCharacterRangeCount(
|
||||
return NotImplemented;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipGetStringFormatTabStopCount(GDIPCONST GpStringFormat *format,
|
||||
INT *count)
|
||||
{
|
||||
if(!format || !count)
|
||||
return InvalidParameter;
|
||||
|
||||
*count = format->tabcount;
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipGetStringFormatTrimming(GpStringFormat *format,
|
||||
StringTrimming *trimming)
|
||||
{
|
||||
@ -233,12 +249,22 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt
|
||||
|
||||
**newFormat = *format;
|
||||
|
||||
if(format->tabcount > 0){
|
||||
(*newFormat)->tabs = GdipAlloc(sizeof(REAL) * format->tabcount);
|
||||
if(!(*newFormat)->tabs){
|
||||
GdipFree(*newFormat);
|
||||
return OutOfMemory;
|
||||
}
|
||||
memcpy((*newFormat)->tabs, format->tabs, sizeof(REAL) * format->tabcount);
|
||||
}
|
||||
else
|
||||
(*newFormat)->tabs = NULL;
|
||||
|
||||
TRACE("%p %p\n",format,newFormat);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
/*FIXME: add zero tab stops number */
|
||||
GpStatus WINGDIPAPI GdipStringFormatGetGenericTypographic(GpStringFormat **format)
|
||||
{
|
||||
GpStatus stat;
|
||||
|
@ -140,6 +140,7 @@ static void test_getgenerictypographic(void)
|
||||
StringTrimming trimming;
|
||||
StringDigitSubstitute digitsub;
|
||||
LANGID digitlang;
|
||||
INT tabcount;
|
||||
|
||||
/* NULL arg */
|
||||
stat = GdipStringFormatGetGenericTypographic(NULL);
|
||||
@ -154,6 +155,7 @@ static void test_getgenerictypographic(void)
|
||||
GdipGetStringFormatHotkeyPrefix(format, &n);
|
||||
GdipGetStringFormatTrimming(format, &trimming);
|
||||
GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
|
||||
GdipGetStringFormatTabStopCount(format, &tabcount);
|
||||
|
||||
expect((StringFormatFlagsNoFitBlackBox |StringFormatFlagsLineLimit | StringFormatFlagsNoClip),
|
||||
flags);
|
||||
@ -163,6 +165,33 @@ static void test_getgenerictypographic(void)
|
||||
expect(StringTrimmingNone, trimming);
|
||||
expect(StringDigitSubstituteUser, digitsub);
|
||||
expect(LANG_NEUTRAL, digitlang);
|
||||
expect(0, tabcount);
|
||||
|
||||
stat = GdipDeleteStringFormat(format);
|
||||
expect(Ok, stat);
|
||||
}
|
||||
|
||||
static void test_tabstops(void)
|
||||
{
|
||||
GpStringFormat *format;
|
||||
GpStatus stat;
|
||||
INT count;
|
||||
|
||||
stat = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
|
||||
expect(Ok, stat);
|
||||
|
||||
/* NULL */
|
||||
stat = GdipGetStringFormatTabStopCount(NULL, NULL);
|
||||
expect(InvalidParameter, stat);
|
||||
stat = GdipGetStringFormatTabStopCount(NULL, &count);
|
||||
expect(InvalidParameter, stat);
|
||||
stat = GdipGetStringFormatTabStopCount(format, NULL);
|
||||
expect(InvalidParameter, stat);
|
||||
|
||||
/* not NULL */
|
||||
stat = GdipGetStringFormatTabStopCount(format, &count);
|
||||
expect(Ok, stat);
|
||||
expect(0, count);
|
||||
|
||||
stat = GdipDeleteStringFormat(format);
|
||||
expect(Ok, stat);
|
||||
@ -184,6 +213,7 @@ START_TEST(stringformat)
|
||||
test_characterrange();
|
||||
test_digitsubstitution();
|
||||
test_getgenerictypographic();
|
||||
test_tabstops();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
@ -444,6 +444,7 @@ GpStatus WINGDIPAPI GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat*,IN
|
||||
GpStatus WINGDIPAPI GdipGetStringFormatLineAlign(GpStringFormat*,StringAlignment*);
|
||||
GpStatus WINGDIPAPI GdipGetStringFormatMeasurableCharacterRangeCount(
|
||||
GDIPCONST GpStringFormat*, INT*);
|
||||
GpStatus WINGDIPAPI GdipGetStringFormatTabStopCount(GDIPCONST GpStringFormat*,INT*);
|
||||
GpStatus WINGDIPAPI GdipGetStringFormatTrimming(GpStringFormat*,StringTrimming*);
|
||||
GpStatus WINGDIPAPI GdipSetStringFormatAlign(GpStringFormat*,StringAlignment);
|
||||
GpStatus WINGDIPAPI GdipSetStringFormatDigitSubstitution(GpStringFormat*,LANGID,StringDigitSubstitute);
|
||||
|
Loading…
Reference in New Issue
Block a user