Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f44034a7
Commit
f44034a7
authored
Jul 30, 2008
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 30, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implemented Gdip[Get/Set]StringFormatTabStops with tests.
parent
4a08c13b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
129 additions
and
2 deletions
+129
-2
gdiplus.spec
dlls/gdiplus/gdiplus.spec
+2
-2
stringformat.c
dlls/gdiplus/stringformat.c
+45
-0
stringformat.c
dlls/gdiplus/tests/stringformat.c
+80
-0
gdiplusflat.h
include/gdiplusflat.h
+2
-0
No files found.
dlls/gdiplus/gdiplus.spec
View file @
f44034a7
...
...
@@ -393,7 +393,7 @@
@ stdcall GdipGetStringFormatLineAlign(ptr ptr)
@ stdcall GdipGetStringFormatMeasurableCharacterRangeCount(ptr ptr)
@ stdcall GdipGetStringFormatTabStopCount(ptr ptr)
@ st
ub GdipGetStringFormatTabStops
@ st
dcall GdipGetStringFormatTabStops(ptr long ptr ptr)
@ stdcall GdipGetStringFormatTrimming(ptr ptr)
@ stub GdipGetTextContrast
@ stdcall GdipGetTextRenderingHint(ptr ptr)
...
...
@@ -591,7 +591,7 @@
@ stdcall GdipSetStringFormatHotkeyPrefix(ptr long)
@ stdcall GdipSetStringFormatLineAlign(ptr long)
@ stdcall GdipSetStringFormatMeasurableCharacterRanges(ptr long ptr)
@ st
ub GdipSetStringFormatTabStops
@ st
dcall GdipSetStringFormatTabStops(ptr long long ptr)
@ stdcall GdipSetStringFormatTrimming(ptr long)
@ stub GdipSetTextContrast
@ stdcall GdipSetTextRenderingHint(ptr long)
...
...
dlls/gdiplus/stringformat.c
View file @
f44034a7
...
...
@@ -153,6 +153,21 @@ GpStatus WINGDIPAPI GdipGetStringFormatTabStopCount(GDIPCONST GpStringFormat *fo
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipGetStringFormatTabStops
(
GDIPCONST
GpStringFormat
*
format
,
INT
count
,
REAL
*
firsttab
,
REAL
*
tabs
)
{
if
(
!
format
||
!
firsttab
||
!
tabs
)
return
InvalidParameter
;
/* native simply crashes on count < 0 */
if
(
count
!=
0
)
memcpy
(
tabs
,
format
->
tabs
,
sizeof
(
REAL
)
*
count
);
*
firsttab
=
format
->
firsttab
;
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipGetStringFormatTrimming
(
GpStringFormat
*
format
,
StringTrimming
*
trimming
)
{
...
...
@@ -221,6 +236,36 @@ GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges(GpStringFormat*
return
NotImplemented
;
}
GpStatus
WINGDIPAPI
GdipSetStringFormatTabStops
(
GpStringFormat
*
format
,
REAL
firsttab
,
INT
count
,
GDIPCONST
REAL
*
tabs
)
{
if
(
!
format
||
!
tabs
)
return
InvalidParameter
;
if
(
count
>
0
){
if
(
firsttab
<
0
.
0
)
return
NotImplemented
;
/* first time allocation */
if
(
format
->
tabcount
==
0
){
format
->
tabs
=
GdipAlloc
(
sizeof
(
REAL
)
*
count
);
if
(
!
format
->
tabs
)
return
OutOfMemory
;
}
/* reallocation */
if
((
format
->
tabcount
<
count
)
&&
(
format
->
tabcount
>
0
)){
REAL
*
ptr
;
ptr
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
format
->
tabs
,
sizeof
(
REAL
)
*
count
);
if
(
!
ptr
)
return
OutOfMemory
;
format
->
tabs
=
ptr
;
}
format
->
firsttab
=
firsttab
;
format
->
tabcount
=
count
;
memcpy
(
format
->
tabs
,
tabs
,
sizeof
(
REAL
)
*
count
);
}
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipSetStringFormatTrimming
(
GpStringFormat
*
format
,
StringTrimming
trimming
)
{
...
...
dlls/gdiplus/tests/stringformat.c
View file @
f44034a7
...
...
@@ -23,6 +23,7 @@
#include "wine/test.h"
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
#define expectf(expected, got) ok(got == expected, "Expected %.2f, got %.2f\n", expected, got)
static
void
test_constructor
(
void
)
{
...
...
@@ -171,11 +172,14 @@ static void test_getgenerictypographic(void)
expect
(
Ok
,
stat
);
}
static
REAL
tabstops
[]
=
{
0
.
0
,
10
.
0
,
2
.
0
};
static
void
test_tabstops
(
void
)
{
GpStringFormat
*
format
;
GpStatus
stat
;
INT
count
;
REAL
tabs
[
3
];
REAL
firsttab
;
stat
=
GdipCreateStringFormat
(
0
,
LANG_NEUTRAL
,
&
format
);
expect
(
Ok
,
stat
);
...
...
@@ -188,10 +192,86 @@ static void test_tabstops(void)
stat
=
GdipGetStringFormatTabStopCount
(
format
,
NULL
);
expect
(
InvalidParameter
,
stat
);
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
);
/* not NULL */
stat
=
GdipGetStringFormatTabStopCount
(
format
,
&
count
);
expect
(
Ok
,
stat
);
expect
(
0
,
count
);
/* 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
);
stat
=
GdipDeleteStringFormat
(
format
);
expect
(
Ok
,
stat
);
...
...
include/gdiplusflat.h
View file @
f44034a7
...
...
@@ -445,6 +445,7 @@ GpStatus WINGDIPAPI GdipGetStringFormatLineAlign(GpStringFormat*,StringAlignment
GpStatus
WINGDIPAPI
GdipGetStringFormatMeasurableCharacterRangeCount
(
GDIPCONST
GpStringFormat
*
,
INT
*
);
GpStatus
WINGDIPAPI
GdipGetStringFormatTabStopCount
(
GDIPCONST
GpStringFormat
*
,
INT
*
);
GpStatus
WINGDIPAPI
GdipGetStringFormatTabStops
(
GDIPCONST
GpStringFormat
*
,
INT
,
REAL
*
,
REAL
*
);
GpStatus
WINGDIPAPI
GdipGetStringFormatTrimming
(
GpStringFormat
*
,
StringTrimming
*
);
GpStatus
WINGDIPAPI
GdipSetStringFormatAlign
(
GpStringFormat
*
,
StringAlignment
);
GpStatus
WINGDIPAPI
GdipSetStringFormatDigitSubstitution
(
GpStringFormat
*
,
LANGID
,
StringDigitSubstitute
);
...
...
@@ -452,6 +453,7 @@ GpStatus WINGDIPAPI GdipSetStringFormatHotkeyPrefix(GpStringFormat*,INT);
GpStatus
WINGDIPAPI
GdipSetStringFormatLineAlign
(
GpStringFormat
*
,
StringAlignment
);
GpStatus
WINGDIPAPI
GdipSetStringFormatMeasurableCharacterRanges
(
GpStringFormat
*
,
INT
,
GDIPCONST
CharacterRange
*
);
GpStatus
WINGDIPAPI
GdipSetStringFormatTabStops
(
GpStringFormat
*
,
REAL
,
INT
,
GDIPCONST
REAL
*
);
GpStatus
WINGDIPAPI
GdipSetStringFormatTrimming
(
GpStringFormat
*
,
StringTrimming
);
GpStatus
WINGDIPAPI
GdipCloneStringFormat
(
GDIPCONST
GpStringFormat
*
,
GpStringFormat
**
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment