2007-08-16 01:22:29 +02:00
|
|
|
/*
|
|
|
|
* Unit test suite for string format
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Google (Evan Stade)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2013-10-16 05:49:40 +02:00
|
|
|
#include "objbase.h"
|
2007-08-16 01:22:29 +02:00
|
|
|
#include "gdiplus.h"
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
2008-07-30 13:06:50 +02:00
|
|
|
#define expectf(expected, got) ok(got == expected, "Expected %.2f, got %.2f\n", expected, got)
|
2007-08-16 01:22:29 +02:00
|
|
|
|
|
|
|
static void test_constructor(void)
|
|
|
|
{
|
|
|
|
GpStringFormat *format;
|
|
|
|
GpStatus stat;
|
2009-12-22 10:37:55 +01:00
|
|
|
INT n, count;
|
2017-04-28 00:20:30 +02:00
|
|
|
StringAlignment align, line_align;
|
2007-08-16 01:22:29 +02:00
|
|
|
StringTrimming trimming;
|
2008-07-28 23:12:49 +02:00
|
|
|
StringDigitSubstitute digitsub;
|
|
|
|
LANGID digitlang;
|
2007-08-16 01:22:29 +02:00
|
|
|
|
2008-07-30 13:06:58 +02:00
|
|
|
stat = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
|
2007-08-16 01:22:29 +02:00
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
GdipGetStringFormatAlign(format, &align);
|
2017-04-28 00:20:30 +02:00
|
|
|
GdipGetStringFormatLineAlign(format, &line_align);
|
2007-08-16 01:22:29 +02:00
|
|
|
GdipGetStringFormatHotkeyPrefix(format, &n);
|
|
|
|
GdipGetStringFormatTrimming(format, &trimming);
|
2008-07-28 23:12:49 +02:00
|
|
|
GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
|
2009-12-22 10:37:55 +01:00
|
|
|
GdipGetStringFormatMeasurableCharacterRangeCount(format, &count);
|
2007-08-16 01:22:29 +02:00
|
|
|
|
|
|
|
expect(HotkeyPrefixNone, n);
|
|
|
|
expect(StringAlignmentNear, align);
|
2017-04-28 00:20:30 +02:00
|
|
|
expect(StringAlignmentNear, line_align);
|
2007-08-16 01:22:35 +02:00
|
|
|
expect(StringTrimmingCharacter, trimming);
|
2008-07-28 23:12:49 +02:00
|
|
|
expect(StringDigitSubstituteUser, digitsub);
|
|
|
|
expect(LANG_NEUTRAL, digitlang);
|
2009-12-22 10:37:55 +01:00
|
|
|
expect(0, count);
|
2007-08-16 01:22:29 +02:00
|
|
|
|
|
|
|
stat = GdipDeleteStringFormat(format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
2008-07-09 09:33:52 +02:00
|
|
|
static void test_characterrange(void)
|
|
|
|
{
|
|
|
|
CharacterRange ranges[3];
|
|
|
|
INT count;
|
|
|
|
GpStringFormat* format;
|
|
|
|
GpStatus stat;
|
|
|
|
|
|
|
|
stat = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
|
|
|
|
expect(Ok, stat);
|
2009-12-22 10:37:55 +01:00
|
|
|
stat = GdipSetStringFormatMeasurableCharacterRanges(NULL, 3, ranges);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
stat = GdipSetStringFormatMeasurableCharacterRanges(format, 0, ranges);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipSetStringFormatMeasurableCharacterRanges(format, 3, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
2008-07-09 09:33:52 +02:00
|
|
|
stat = GdipSetStringFormatMeasurableCharacterRanges(format, 3, ranges);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetStringFormatMeasurableCharacterRangeCount(format, &count);
|
|
|
|
expect(Ok, stat);
|
2008-07-10 20:39:45 +02:00
|
|
|
if (stat == Ok) expect(3, count);
|
2009-12-22 10:37:55 +01:00
|
|
|
|
2008-07-09 09:33:52 +02:00
|
|
|
stat= GdipDeleteStringFormat(format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
2008-07-28 23:12:49 +02:00
|
|
|
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);
|
2008-07-28 23:12:59 +02:00
|
|
|
stat = GdipSetStringFormatDigitSubstitution(NULL, LANG_NEUTRAL, StringDigitSubstituteNone);
|
|
|
|
expect(InvalidParameter, stat);
|
2008-07-28 23:12:49 +02:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2008-07-28 23:12:59 +02:00
|
|
|
/* 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);
|
|
|
|
|
2008-07-28 23:12:49 +02:00
|
|
|
stat = GdipDeleteStringFormat(format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
2008-07-09 09:33:52 +02:00
|
|
|
|
2008-07-28 23:13:06 +02:00
|
|
|
static void test_getgenerictypographic(void)
|
|
|
|
{
|
2017-04-28 00:20:31 +02:00
|
|
|
GpStringFormat *format, *format2;
|
2008-07-28 23:13:06 +02:00
|
|
|
GpStatus stat;
|
|
|
|
INT flags;
|
|
|
|
INT n;
|
2017-04-28 00:20:30 +02:00
|
|
|
StringAlignment align, line_align;
|
2008-07-28 23:13:06 +02:00
|
|
|
StringTrimming trimming;
|
|
|
|
StringDigitSubstitute digitsub;
|
|
|
|
LANGID digitlang;
|
2008-07-30 13:06:39 +02:00
|
|
|
INT tabcount;
|
2008-07-28 23:13:06 +02:00
|
|
|
|
|
|
|
/* NULL arg */
|
|
|
|
stat = GdipStringFormatGetGenericTypographic(NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipStringFormatGetGenericTypographic(&format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
2017-04-28 00:20:31 +02:00
|
|
|
stat = GdipStringFormatGetGenericTypographic(&format2);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(format == format2, "expected same format object\n");
|
|
|
|
stat = GdipDeleteStringFormat(format2);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
2008-07-28 23:13:06 +02:00
|
|
|
GdipGetStringFormatFlags(format, &flags);
|
|
|
|
GdipGetStringFormatAlign(format, &align);
|
2017-04-28 00:20:30 +02:00
|
|
|
GdipGetStringFormatLineAlign(format, &line_align);
|
2008-07-28 23:13:06 +02:00
|
|
|
GdipGetStringFormatHotkeyPrefix(format, &n);
|
|
|
|
GdipGetStringFormatTrimming(format, &trimming);
|
|
|
|
GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
|
2008-07-30 13:06:39 +02:00
|
|
|
GdipGetStringFormatTabStopCount(format, &tabcount);
|
2008-07-28 23:13:06 +02:00
|
|
|
|
|
|
|
expect((StringFormatFlagsNoFitBlackBox |StringFormatFlagsLineLimit | StringFormatFlagsNoClip),
|
|
|
|
flags);
|
|
|
|
expect(HotkeyPrefixNone, n);
|
|
|
|
expect(StringAlignmentNear, align);
|
2017-04-28 00:20:30 +02:00
|
|
|
expect(StringAlignmentNear, line_align);
|
2008-07-28 23:13:06 +02:00
|
|
|
expect(StringTrimmingNone, trimming);
|
|
|
|
expect(StringDigitSubstituteUser, digitsub);
|
|
|
|
expect(LANG_NEUTRAL, digitlang);
|
2008-07-30 13:06:39 +02:00
|
|
|
expect(0, tabcount);
|
|
|
|
|
2017-04-28 00:20:31 +02:00
|
|
|
/* Change format parameters, release, get format object again. */
|
|
|
|
stat = GdipSetStringFormatFlags(format, StringFormatFlagsNoWrap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetStringFormatFlags(format, &flags);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(StringFormatFlagsNoWrap, flags);
|
|
|
|
|
|
|
|
stat = GdipDeleteStringFormat(format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipStringFormatGetGenericTypographic(&format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetStringFormatFlags(format, &flags);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(StringFormatFlagsNoWrap, flags);
|
|
|
|
|
2008-07-30 13:06:39 +02:00
|
|
|
stat = GdipDeleteStringFormat(format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
2008-07-30 13:06:50 +02:00
|
|
|
static REAL tabstops[] = {0.0, 10.0, 2.0};
|
2008-07-30 13:06:39 +02:00
|
|
|
static void test_tabstops(void)
|
|
|
|
{
|
|
|
|
GpStringFormat *format;
|
|
|
|
GpStatus stat;
|
|
|
|
INT count;
|
2008-07-30 13:06:50 +02:00
|
|
|
REAL tabs[3];
|
|
|
|
REAL firsttab;
|
2008-07-30 13:06:39 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2008-07-30 13:06:50 +02:00
|
|
|
stat = GdipSetStringFormatTabStops(NULL, 0.0, 0, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
stat = GdipSetStringFormatTabStops(format, 0.0, 0, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
stat = GdipSetStringFormatTabStops(NULL, 0.0, 0, tabstops);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipGetStringFormatTabStops(NULL, 0, NULL, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
stat = GdipGetStringFormatTabStops(format, 0, NULL, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
stat = GdipGetStringFormatTabStops(NULL, 0, &firsttab, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
stat = GdipGetStringFormatTabStops(NULL, 0, NULL, tabs);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
stat = GdipGetStringFormatTabStops(format, 0, &firsttab, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
stat = GdipGetStringFormatTabStops(format, 0, NULL, tabs);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
2008-07-30 13:06:39 +02:00
|
|
|
/* not NULL */
|
|
|
|
stat = GdipGetStringFormatTabStopCount(format, &count);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0, count);
|
2008-07-30 13:06:50 +02:00
|
|
|
/* negative tabcount */
|
|
|
|
stat = GdipSetStringFormatTabStops(format, 0.0, -1, tabstops);
|
|
|
|
expect(Ok, stat);
|
|
|
|
count = -1;
|
|
|
|
stat = GdipGetStringFormatTabStopCount(format, &count);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0, count);
|
|
|
|
|
|
|
|
stat = GdipSetStringFormatTabStops(format, -10.0, 0, tabstops);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipSetStringFormatTabStops(format, -10.0, 1, tabstops);
|
|
|
|
expect(NotImplemented, stat);
|
|
|
|
|
|
|
|
firsttab = -1.0;
|
|
|
|
tabs[0] = tabs[1] = tabs[2] = -1.0;
|
|
|
|
stat = GdipGetStringFormatTabStops(format, 0, &firsttab, tabs);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expectf(-1.0, tabs[0]);
|
|
|
|
expectf(-1.0, tabs[1]);
|
|
|
|
expectf(-1.0, tabs[2]);
|
|
|
|
expectf(0.0, firsttab);
|
|
|
|
|
|
|
|
stat = GdipSetStringFormatTabStops(format, +0.0, 3, tabstops);
|
|
|
|
expect(Ok, stat);
|
|
|
|
count = 0;
|
|
|
|
stat = GdipGetStringFormatTabStopCount(format, &count);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(3, count);
|
|
|
|
|
|
|
|
firsttab = -1.0;
|
|
|
|
tabs[0] = tabs[1] = tabs[2] = -1.0;
|
|
|
|
stat = GdipGetStringFormatTabStops(format, 3, &firsttab, tabs);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expectf(0.0, tabs[0]);
|
|
|
|
expectf(10.0, tabs[1]);
|
|
|
|
expectf(2.0, tabs[2]);
|
|
|
|
expectf(0.0, firsttab);
|
|
|
|
|
|
|
|
stat = GdipSetStringFormatTabStops(format, 10.0, 3, tabstops);
|
|
|
|
expect(Ok, stat);
|
|
|
|
firsttab = -1.0;
|
|
|
|
tabs[0] = tabs[1] = tabs[2] = -1.0;
|
|
|
|
stat = GdipGetStringFormatTabStops(format, 0, &firsttab, tabs);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expectf(-1.0, tabs[0]);
|
|
|
|
expectf(-1.0, tabs[1]);
|
|
|
|
expectf(-1.0, tabs[2]);
|
|
|
|
expectf(10.0, firsttab);
|
|
|
|
|
|
|
|
/* zero tabcount, after valid setting to 3 */
|
|
|
|
stat = GdipSetStringFormatTabStops(format, 0.0, 0, tabstops);
|
|
|
|
expect(Ok, stat);
|
|
|
|
count = 0;
|
|
|
|
stat = GdipGetStringFormatTabStopCount(format, &count);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(3, count);
|
2008-07-28 23:13:06 +02:00
|
|
|
|
|
|
|
stat = GdipDeleteStringFormat(format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
2008-07-30 13:07:04 +02:00
|
|
|
static void test_getgenericdefault(void)
|
|
|
|
{
|
2017-04-28 00:20:31 +02:00
|
|
|
GpStringFormat *format, *format2;
|
2008-07-30 13:07:04 +02:00
|
|
|
GpStatus stat;
|
|
|
|
|
|
|
|
INT flags;
|
|
|
|
INT n;
|
2017-04-28 00:20:30 +02:00
|
|
|
StringAlignment align, line_align;
|
2008-07-30 13:07:04 +02:00
|
|
|
StringTrimming trimming;
|
|
|
|
StringDigitSubstitute digitsub;
|
|
|
|
LANGID digitlang;
|
|
|
|
INT tabcount;
|
|
|
|
|
|
|
|
/* NULL arg */
|
|
|
|
stat = GdipStringFormatGetGenericDefault(NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipStringFormatGetGenericDefault(&format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
2017-04-28 00:20:31 +02:00
|
|
|
stat = GdipStringFormatGetGenericDefault(&format2);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(format == format2, "expected same format object\n");
|
|
|
|
stat = GdipDeleteStringFormat(format2);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
2008-07-30 13:07:04 +02:00
|
|
|
GdipGetStringFormatFlags(format, &flags);
|
|
|
|
GdipGetStringFormatAlign(format, &align);
|
2017-04-28 00:20:30 +02:00
|
|
|
GdipGetStringFormatLineAlign(format, &line_align);
|
2008-07-30 13:07:04 +02:00
|
|
|
GdipGetStringFormatHotkeyPrefix(format, &n);
|
|
|
|
GdipGetStringFormatTrimming(format, &trimming);
|
|
|
|
GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
|
|
|
|
GdipGetStringFormatTabStopCount(format, &tabcount);
|
|
|
|
|
|
|
|
expect(0, flags);
|
|
|
|
expect(HotkeyPrefixNone, n);
|
|
|
|
expect(StringAlignmentNear, align);
|
2017-04-28 00:20:30 +02:00
|
|
|
expect(StringAlignmentNear, line_align);
|
2008-07-30 13:07:04 +02:00
|
|
|
expect(StringTrimmingCharacter, trimming);
|
|
|
|
expect(StringDigitSubstituteUser, digitsub);
|
|
|
|
expect(LANG_NEUTRAL, digitlang);
|
|
|
|
expect(0, tabcount);
|
|
|
|
|
2017-04-28 00:20:31 +02:00
|
|
|
/* Change default format parameters, release, get format object again. */
|
|
|
|
stat = GdipSetStringFormatFlags(format, StringFormatFlagsNoWrap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetStringFormatFlags(format, &flags);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(StringFormatFlagsNoWrap, flags);
|
|
|
|
|
|
|
|
stat = GdipDeleteStringFormat(format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipStringFormatGetGenericDefault(&format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetStringFormatFlags(format, &flags);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(StringFormatFlagsNoWrap, flags);
|
|
|
|
|
2008-07-30 13:07:04 +02:00
|
|
|
stat = GdipDeleteStringFormat(format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
2009-02-01 16:15:57 +01:00
|
|
|
static void test_stringformatflags(void)
|
|
|
|
{
|
|
|
|
GpStringFormat *format;
|
|
|
|
GpStatus stat;
|
|
|
|
|
|
|
|
INT flags;
|
|
|
|
|
|
|
|
stat = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* NULL args */
|
|
|
|
stat = GdipSetStringFormatFlags(NULL, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetStringFormatFlags(format, 0);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetStringFormatFlags(format, &flags);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0, flags);
|
|
|
|
|
|
|
|
/* Check some valid flags */
|
|
|
|
stat = GdipSetStringFormatFlags(format, StringFormatFlagsDirectionRightToLeft);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetStringFormatFlags(format, &flags);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(StringFormatFlagsDirectionRightToLeft, flags);
|
|
|
|
|
|
|
|
stat = GdipSetStringFormatFlags(format, StringFormatFlagsNoFontFallback);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetStringFormatFlags(format, &flags);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(StringFormatFlagsNoFontFallback, flags);
|
|
|
|
|
|
|
|
/* Check some flag combinations */
|
|
|
|
stat = GdipSetStringFormatFlags(format, StringFormatFlagsDirectionVertical
|
|
|
|
| StringFormatFlagsNoFitBlackBox);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetStringFormatFlags(format, &flags);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect((StringFormatFlagsDirectionVertical
|
|
|
|
| StringFormatFlagsNoFitBlackBox), flags);
|
|
|
|
|
|
|
|
stat = GdipSetStringFormatFlags(format, StringFormatFlagsDisplayFormatControl
|
|
|
|
| StringFormatFlagsMeasureTrailingSpaces);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetStringFormatFlags(format, &flags);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect((StringFormatFlagsDisplayFormatControl
|
|
|
|
| StringFormatFlagsMeasureTrailingSpaces), flags);
|
|
|
|
|
|
|
|
/* Check invalid flags */
|
|
|
|
stat = GdipSetStringFormatFlags(format, 0xdeadbeef);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetStringFormatFlags(format, &flags);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xdeadbeef, flags);
|
|
|
|
|
|
|
|
stat = GdipDeleteStringFormat(format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
2007-08-16 01:22:29 +02:00
|
|
|
START_TEST(stringformat)
|
|
|
|
{
|
|
|
|
struct GdiplusStartupInput gdiplusStartupInput;
|
|
|
|
ULONG_PTR gdiplusToken;
|
|
|
|
|
|
|
|
gdiplusStartupInput.GdiplusVersion = 1;
|
|
|
|
gdiplusStartupInput.DebugEventCallback = NULL;
|
|
|
|
gdiplusStartupInput.SuppressBackgroundThread = 0;
|
|
|
|
gdiplusStartupInput.SuppressExternalCodecs = 0;
|
|
|
|
|
|
|
|
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
|
|
|
|
|
|
|
test_constructor();
|
2008-07-09 09:33:52 +02:00
|
|
|
test_characterrange();
|
2008-07-28 23:12:49 +02:00
|
|
|
test_digitsubstitution();
|
2008-07-28 23:13:06 +02:00
|
|
|
test_getgenerictypographic();
|
2008-07-30 13:06:39 +02:00
|
|
|
test_tabstops();
|
2008-07-30 13:07:04 +02:00
|
|
|
test_getgenericdefault();
|
2009-02-01 16:15:57 +01:00
|
|
|
test_stringformatflags();
|
2007-08-16 01:22:29 +02:00
|
|
|
|
|
|
|
GdiplusShutdown(gdiplusToken);
|
|
|
|
}
|