msi: Set all folders' source paths to the root directory if the source type is compre...
[wine] / dlls / gdiplus / tests / stringformat.c
1 /*
2  * Unit test suite for string format
3  *
4  * Copyright (C) 2007 Google (Evan Stade)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "windows.h"
22 #include "gdiplus.h"
23 #include "wine/test.h"
24
25 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
26
27 static void test_constructor(void)
28 {
29     GpStringFormat *format;
30     GpStatus stat;
31     INT n;
32     StringAlignment align, valign;
33     StringTrimming trimming;
34
35     stat = GdipCreateStringFormat(0, 0, &format);
36     expect(Ok, stat);
37
38     GdipGetStringFormatAlign(format, &align);
39     GdipGetStringFormatLineAlign(format, &valign);
40     GdipGetStringFormatHotkeyPrefix(format, &n);
41     GdipGetStringFormatTrimming(format, &trimming);
42
43     expect(HotkeyPrefixNone, n);
44     expect(StringAlignmentNear, align);
45     expect(StringAlignmentNear, align);
46     expect(StringTrimmingCharacter, trimming);
47
48     stat = GdipDeleteStringFormat(format);
49     expect(Ok, stat);
50 }
51
52 static void test_characterrange(void)
53 {
54     CharacterRange ranges[3];
55     INT count;
56     GpStringFormat* format;
57     GpStatus stat;
58
59     stat = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
60     expect(Ok, stat);
61 todo_wine
62 {
63     stat = GdipSetStringFormatMeasurableCharacterRanges(format, 3, ranges);
64     expect(Ok, stat);
65     stat = GdipGetStringFormatMeasurableCharacterRangeCount(format, &count);
66     expect(Ok, stat);
67     if (stat == Ok) expect(3, count);
68 }
69     stat= GdipDeleteStringFormat(format);
70     expect(Ok, stat);
71 }
72
73
74 START_TEST(stringformat)
75 {
76     struct GdiplusStartupInput gdiplusStartupInput;
77     ULONG_PTR gdiplusToken;
78
79     gdiplusStartupInput.GdiplusVersion              = 1;
80     gdiplusStartupInput.DebugEventCallback          = NULL;
81     gdiplusStartupInput.SuppressBackgroundThread    = 0;
82     gdiplusStartupInput.SuppressExternalCodecs      = 0;
83
84     GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
85
86     test_constructor();
87     test_characterrange();
88
89     GdiplusShutdown(gdiplusToken);
90 }