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
1f95fd48
Commit
1f95fd48
authored
Nov 14, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus/tests: Add more tests for gradient brush rectangles.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0046c1f5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
166 additions
and
188 deletions
+166
-188
brush.c
dlls/gdiplus/tests/brush.c
+166
-188
No files found.
dlls/gdiplus/tests/brush.c
View file @
1f95fd48
...
@@ -621,141 +621,103 @@ static void test_texturewrap(void)
...
@@ -621,141 +621,103 @@ static void test_texturewrap(void)
static
void
test_gradientgetrect
(
void
)
static
void
test_gradientgetrect
(
void
)
{
{
static
const
struct
{
LinearGradientMode
mode
;
GpRectF
rect
;
REAL
transform
[
6
];
}
create_from_rect
[]
=
{
{
LinearGradientModeHorizontal
,
{
10
.
0
f
,
10
.
0
f
,
-
100
.
0
f
,
-
100
.
0
f
}
},
{
LinearGradientModeHorizontal
,
{
10
.
0
f
,
10
.
0
f
,
100
.
0
f
,
100
.
0
f
}
},
{
LinearGradientModeHorizontal
,
{
10
.
0
f
,
-
5
.
0
f
,
100
.
0
f
,
50
.
0
f
}
},
{
LinearGradientModeHorizontal
,
{
-
5
.
0
f
,
10
.
0
f
,
100
.
0
f
,
50
.
0
f
}
},
{
LinearGradientModeVertical
,
{
0
.
0
f
,
0
.
0
f
,
100
.
0
f
,
10
.
0
f
},
{
0
.
0
f
,
0
.
1
f
,
-
10
.
0
f
,
-
0
.
0
f
,
100
.
0
f
,
0
.
0
f
}
},
{
LinearGradientModeVertical
,
{
10
.
0
f
,
-
12
.
0
f
,
100
.
0
f
,
105
.
0
f
},
{
0
.
0
f
,
1
.
05
f
,
-
0
.
952
f
,
0
.
0
f
,
98
.
571
f
,
-
22
.
5
f
}
},
};
static
const
struct
{
GpPointF
pt1
,
pt2
;
GpRectF
rect
;
REAL
transform
[
6
];
}
create_from_pt
[]
=
{
{
{
1
.
0
f
,
1
.
0
f
},
{
100
.
0
f
,
100
.
0
f
},
{
1
.
0
f
,
1
.
0
f
,
99
.
0
f
,
99
.
0
f
},
{
1
.
0
f
,
1
.
0
f
,
-
1
.
0
f
,
1
.
0
f
,
50
.
50
f
,
-
50
.
50
f
}
},
{
{
0
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
10
.
0
f
},
{
-
5
.
0
f
,
0
.
0
f
,
10
.
0
f
,
10
.
0
f
},
{
0
.
0
f
,
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
,
5
.
0
f
,
5
.
0
f
}
},
{
{
0
.
0
f
,
0
.
0
f
},
{
10
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
-
5
.
0
f
,
10
.
0
f
,
10
.
0
f
},
{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
}
},
/* Slope = -1 */
{
{
0
.
0
f
,
0
.
0
f
},
{
20
.
0
f
,
-
20
.
0
f
},
{
0
.
0
f
,
-
20
.
0
f
,
20
.
0
f
,
20
.
0
f
},
{
1
.
0
f
,
-
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
10
.
0
f
,
10
.
0
f
}
},
/* Slope = 1/100 */
{
{
0
.
0
f
,
0
.
0
f
},
{
100
.
0
f
,
1
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
100
.
0
f
,
1
.
0
f
},
{
1
.
0
f
,
0
.
01
f
,
-
0
.
02
f
,
2
.
0
f
,
0
.
01
f
,
-
1
.
0
f
}
},
{
{
10
.
0
f
,
10
.
0
f
},
{
-
90
.
0
f
,
10
.
0
f
},
{
-
90
.
0
f
,
-
40
.
0
f
,
100
.
0
f
,
100
.
0
f
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
,
-
80
.
0
f
,
20
.
0
f
}
},
};
static
const
struct
{
GpRectF
rect
;
REAL
angle
;
BOOL
is_scalable
;
REAL
transform
[
6
];
}
create_with_angle
[]
=
{
{
{
10
.
0
f
,
10
.
0
f
,
-
100
.
0
f
,
-
100
.
0
f
},
0
.
0
f
,
TRUE
},
{
{
10
.
0
f
,
10
.
0
f
,
-
100
.
0
f
,
-
100
.
0
f
},
0
.
0
f
,
FALSE
},
{
{
10
.
0
f
,
10
.
0
f
,
100
.
0
f
,
100
.
0
f
},
0
.
0
f
,
FALSE
},
{
{
10
.
0
f
,
10
.
0
f
,
100
.
0
f
,
100
.
0
f
},
0
.
0
f
,
TRUE
},
{
{
10
.
0
f
,
-
5
.
0
f
,
100
.
0
f
,
50
.
0
f
},
0
.
0
f
,
FALSE
},
{
{
10
.
0
f
,
-
5
.
0
f
,
100
.
0
f
,
50
.
0
f
},
0
.
0
f
,
TRUE
},
{
{
-
5
.
0
f
,
10
.
0
f
,
100
.
0
f
,
50
.
0
f
},
0
.
0
f
,
FALSE
},
{
{
-
5
.
0
f
,
10
.
0
f
,
100
.
0
f
,
50
.
0
f
},
0
.
0
f
,
TRUE
},
{
{
0
.
0
f
,
0
.
0
f
,
100
.
0
f
,
10
.
0
f
},
-
90
.
0
f
,
TRUE
,
{
0
.
0
f
,
-
0
.
1
f
,
10
.
0
f
,
0
.
0
f
,
0
.
0
f
,
10
.
0
f
}
},
{
{
10
.
0
f
,
-
12
.
0
f
,
100
.
0
f
,
105
.
0
f
},
-
90
.
0
f
,
TRUE
,
{
0
.
0
f
,
-
1
.
05
f
,
0
.
952
f
,
0
.
0
f
,
21
.
429
f
,
103
.
5
f
}
},
{
{
0
.
0
f
,
0
.
0
f
,
100
.
0
f
,
10
.
0
f
},
-
90
.
0
f
,
FALSE
,
{
0
.
0
f
,
-
0
.
1
f
,
10
.
0
f
,
-
0
.
0
f
,
0
.
0
f
,
10
.
0
f
}
},
{
{
10
.
0
f
,
-
12
.
0
f
,
100
.
0
f
,
105
.
0
f
},
-
90
.
0
f
,
FALSE
,
{
0
.
0
f
,
-
1
.
05
f
,
0
.
952
f
,
0
.
0
f
,
21
.
429
f
,
103
.
5
f
}
},
};
GpLineGradient
*
brush
;
GpLineGradient
*
brush
;
GpMatrix
*
transform
;
GpMatrix
*
transform
;
REAL
elements
[
6
];
REAL
elements
[
6
];
GpRectF
rectf
;
GpStatus
status
;
GpStatus
status
;
GpPointF
pt1
,
pt2
;
unsigned
int
i
;
ARGB
colors
[
2
];
GpRectF
rectf
;
status
=
GdipCreateMatrix
(
&
transform
);
status
=
GdipCreateMatrix
(
&
transform
);
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
pt1
.
X
=
pt1
.
Y
=
1
.
0
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
create_from_pt
);
++
i
)
pt2
.
X
=
pt2
.
Y
=
100
.
0
;
{
status
=
GdipCreateLineBrush
(
&
pt1
,
&
pt2
,
0
,
0
,
WrapModeTile
,
&
brush
);
status
=
GdipCreateLineBrush
(
&
create_from_pt
[
i
].
pt1
,
&
create_from_pt
[
i
].
pt2
,
0x1
,
0x2
,
WrapModeTile
,
&
brush
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to create a brush, %d.
\n
"
,
status
);
memset
(
&
rectf
,
0
,
sizeof
(
GpRectF
));
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
expect
(
Ok
,
status
);
expectf
(
1
.
0
,
rectf
.
X
);
expectf
(
1
.
0
,
rectf
.
Y
);
expectf
(
99
.
0
,
rectf
.
Width
);
expectf
(
99
.
0
,
rectf
.
Height
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
expect
(
Ok
,
status
);
status
=
GdipGetMatrixElements
(
transform
,
elements
);
expect
(
Ok
,
status
);
expectf
(
1
.
0
,
elements
[
0
]);
expectf
(
1
.
0
,
elements
[
1
]);
expectf
(
-
1
.
0
,
elements
[
2
]);
expectf
(
1
.
0
,
elements
[
3
]);
expectf
(
50
.
50
,
elements
[
4
]);
expectf
(
-
50
.
50
,
elements
[
5
]);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
expect
(
Ok
,
status
);
/* vertical gradient */
pt1
.
X
=
pt1
.
Y
=
pt2
.
X
=
0
.
0
;
pt2
.
Y
=
10
.
0
;
status
=
GdipCreateLineBrush
(
&
pt1
,
&
pt2
,
0
,
0
,
WrapModeTile
,
&
brush
);
expect
(
Ok
,
status
);
memset
(
&
rectf
,
0
,
sizeof
(
GpRectF
));
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
expect
(
Ok
,
status
);
expectf
(
-
5
.
0
,
rectf
.
X
);
expectf
(
0
.
0
,
rectf
.
Y
);
expectf
(
10
.
0
,
rectf
.
Width
);
expectf
(
10
.
0
,
rectf
.
Height
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
expect
(
Ok
,
status
);
status
=
GdipGetMatrixElements
(
transform
,
elements
);
expect
(
Ok
,
status
);
expectf
(
0
.
0
,
elements
[
0
]);
expectf
(
1
.
0
,
elements
[
1
]);
expectf
(
-
1
.
0
,
elements
[
2
]);
expectf
(
0
.
0
,
elements
[
3
]);
expectf
(
5
.
0
,
elements
[
4
]);
expectf
(
5
.
0
,
elements
[
5
]);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
expect
(
Ok
,
status
);
/* horizontal gradient */
memset
(
&
rectf
,
0
,
sizeof
(
rectf
));
pt1
.
X
=
pt1
.
Y
=
pt2
.
Y
=
0
.
0
;
pt2
.
X
=
10
.
0
;
status
=
GdipCreateLineBrush
(
&
pt1
,
&
pt2
,
0
,
0
,
WrapModeTile
,
&
brush
);
expect
(
Ok
,
status
);
memset
(
&
rectf
,
0
,
sizeof
(
GpRectF
));
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to get brush rect, %d.
\n
"
,
status
);
expectf
(
0
.
0
,
rectf
.
X
);
ok
(
!
memcmp
(
&
rectf
,
&
create_from_pt
[
i
].
rect
,
sizeof
(
rectf
)),
"Unexpected brush rect.
\n
"
);
expectf
(
-
5
.
0
,
rectf
.
Y
);
expectf
(
10
.
0
,
rectf
.
Width
);
expectf
(
10
.
0
,
rectf
.
Height
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
expect
(
Ok
,
status
);
status
=
GdipGetMatrixElements
(
transform
,
elements
);
expect
(
Ok
,
status
);
expectf
(
1
.
0
,
elements
[
0
]);
expectf
(
0
.
0
,
elements
[
1
]);
expectf
(
0
.
0
,
elements
[
2
]);
expectf
(
1
.
0
,
elements
[
3
]);
expectf
(
0
.
0
,
elements
[
4
]);
expectf
(
0
.
0
,
elements
[
5
]);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
expect
(
Ok
,
status
);
/* slope = -1 */
pt1
.
X
=
pt1
.
Y
=
0
.
0
;
pt2
.
X
=
20
.
0
;
pt2
.
Y
=
-
20
.
0
;
status
=
GdipCreateLineBrush
(
&
pt1
,
&
pt2
,
0
,
0
,
WrapModeTile
,
&
brush
);
expect
(
Ok
,
status
);
memset
(
&
rectf
,
0
,
sizeof
(
GpRectF
));
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
expect
(
Ok
,
status
);
expectf
(
0
.
0
,
rectf
.
X
);
expectf
(
-
20
.
0
,
rectf
.
Y
);
expectf
(
20
.
0
,
rectf
.
Width
);
expectf
(
20
.
0
,
rectf
.
Height
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to get brush transform, %d.
\n
"
,
status
);
status
=
GdipGetMatrixElements
(
transform
,
elements
);
expect
(
Ok
,
status
);
expectf
(
1
.
0
,
elements
[
0
]);
expectf
(
-
1
.
0
,
elements
[
1
]);
expectf
(
1
.
0
,
elements
[
2
]);
expectf
(
1
.
0
,
elements
[
3
]);
expectf
(
10
.
0
,
elements
[
4
]);
expectf
(
10
.
0
,
elements
[
5
]);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
expect
(
Ok
,
status
);
/* slope = 1/100 */
pt1
.
X
=
pt1
.
Y
=
0
.
0
;
pt2
.
X
=
100
.
0
;
pt2
.
Y
=
1
.
0
;
status
=
GdipCreateLineBrush
(
&
pt1
,
&
pt2
,
0
,
0
,
WrapModeTile
,
&
brush
);
expect
(
Ok
,
status
);
memset
(
&
rectf
,
0
,
sizeof
(
GpRectF
));
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
expect
(
Ok
,
status
);
expectf
(
0
.
0
,
rectf
.
X
);
expectf
(
0
.
0
,
rectf
.
Y
);
expectf
(
100
.
0
,
rectf
.
Width
);
expectf
(
1
.
0
,
rectf
.
Height
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
expect
(
Ok
,
status
);
status
=
GdipGetMatrixElements
(
transform
,
elements
);
status
=
GdipGetMatrixElements
(
transform
,
elements
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to get matrix elements, %d.
\n
"
,
status
);
expectf
(
1
.
0
,
elements
[
0
]);
expectf
(
0
.
01
,
elements
[
1
]);
#define expectf2(expected, got) ok(fabs(expected - got) < 0.001, "%u: expected %.3f, got %.3f.\n", i, expected, got)
expectf
(
-
0
.
02
,
elements
[
2
]);
expectf2
(
create_from_pt
[
i
].
transform
[
0
],
elements
[
0
]);
/* expectf(2.0, elements[3]); */
expectf2
(
create_from_pt
[
i
].
transform
[
1
],
elements
[
1
]);
expectf
(
0
.
01
,
elements
[
4
]);
expectf2
(
create_from_pt
[
i
].
transform
[
2
],
elements
[
2
]);
/* expectf(-1.0, elements[5]); */
expectf2
(
create_from_pt
[
i
].
transform
[
3
],
elements
[
3
]);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
expectf2
(
create_from_pt
[
i
].
transform
[
4
],
elements
[
4
]);
expect
(
Ok
,
status
);
expectf2
(
create_from_pt
[
i
].
transform
[
5
],
elements
[
5
]);
#undef expect2f
status
=
GdipGetLineColors
(
brush
,
colors
);
ok
(
status
==
Ok
,
"Failed to get line colors, %d.
\n
"
,
status
);
ok
(
colors
[
0
]
==
0x1
&&
colors
[
1
]
==
0x2
,
"Unexpected brush colors.
\n
"
);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
ok
(
status
==
Ok
,
"Failed to delete a brush, %d.
\n
"
,
status
);
}
/* zero height rect */
/* zero height rect */
rectf
.
X
=
rectf
.
Y
=
10
.
0
;
rectf
.
X
=
rectf
.
Y
=
10
.
0
;
...
@@ -773,84 +735,100 @@ static void test_gradientgetrect(void)
...
@@ -773,84 +735,100 @@ static void test_gradientgetrect(void)
WrapModeTile
,
&
brush
);
WrapModeTile
,
&
brush
);
expect
(
OutOfMemory
,
status
);
expect
(
OutOfMemory
,
status
);
/* from rect with LinearGradientModeHorizontal */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
create_from_rect
);
++
i
)
rectf
.
X
=
rectf
.
Y
=
10
.
0
;
{
rectf
.
Width
=
rectf
.
Height
=
100
.
0
;
ARGB
colors
[
2
];
status
=
GdipCreateLineBrushFromRect
(
&
rectf
,
0
,
0
,
LinearGradientModeHorizontal
,
BOOL
ret
;
WrapModeTile
,
&
brush
);
expect
(
Ok
,
status
);
memset
(
&
rectf
,
0
,
sizeof
(
GpRectF
));
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
expect
(
Ok
,
status
);
expectf
(
10
.
0
,
rectf
.
X
);
expectf
(
10
.
0
,
rectf
.
Y
);
expectf
(
100
.
0
,
rectf
.
Width
);
expectf
(
100
.
0
,
rectf
.
Height
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
expect
(
Ok
,
status
);
status
=
GdipGetMatrixElements
(
transform
,
elements
);
expect
(
Ok
,
status
);
expectf
(
1
.
0
,
elements
[
0
]);
expectf
(
0
.
0
,
elements
[
1
]);
expectf
(
0
.
0
,
elements
[
2
]);
expectf
(
1
.
0
,
elements
[
3
]);
expectf
(
0
.
0
,
elements
[
4
]);
expectf
(
0
.
0
,
elements
[
5
]);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
expect
(
Ok
,
status
);
/* passing negative Width/Height to LinearGradientModeHorizontal */
status
=
GdipCreateLineBrushFromRect
(
&
create_from_rect
[
i
].
rect
,
0x1
,
0x2
,
create_from_rect
[
i
].
mode
,
rectf
.
X
=
rectf
.
Y
=
10
.
0
;
rectf
.
Width
=
rectf
.
Height
=
-
100
.
0
;
status
=
GdipCreateLineBrushFromRect
(
&
rectf
,
0
,
0
,
LinearGradientModeHorizontal
,
WrapModeTile
,
&
brush
);
WrapModeTile
,
&
brush
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to create a brush, %d.
\n
"
,
status
);
memset
(
&
rectf
,
0
,
sizeof
(
GpRectF
));
memset
(
&
rectf
,
0
,
sizeof
(
rectf
));
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to get brush rect, %d.
\n
"
,
status
);
expectf
(
10
.
0
,
rectf
.
X
);
ok
(
!
memcmp
(
&
rectf
,
&
create_from_rect
[
i
].
rect
,
sizeof
(
rectf
)),
"Unexpected brush rect.
\n
"
);
expectf
(
10
.
0
,
rectf
.
Y
);
expectf
(
-
100
.
0
,
rectf
.
Width
);
expectf
(
-
100
.
0
,
rectf
.
Height
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to get brush transform, %d.
\n
"
,
status
);
if
(
create_from_rect
[
i
].
mode
==
LinearGradientModeHorizontal
)
{
status
=
GdipIsMatrixIdentity
(
transform
,
&
ret
);
ok
(
status
==
Ok
,
"Unexpected ret value %d.
\n
"
,
status
);
}
else
{
status
=
GdipGetMatrixElements
(
transform
,
elements
);
status
=
GdipGetMatrixElements
(
transform
,
elements
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to get matrix elements, %d.
\n
"
,
status
);
expectf
(
1
.
0
,
elements
[
0
]);
expectf
(
0
.
0
,
elements
[
1
]);
#define expectf2(expected, got) ok(fabs(expected - got) < 0.001, "%u: expected %.3f, got %.3f.\n", i, expected, got)
expectf
(
0
.
0
,
elements
[
2
]);
expectf2
(
create_from_rect
[
i
].
transform
[
0
],
elements
[
0
]);
expectf
(
1
.
0
,
elements
[
3
]);
todo_wine_if
(
create_from_rect
[
i
].
mode
==
LinearGradientModeVertical
)
{
expectf
(
0
.
0
,
elements
[
4
]);
expectf2
(
create_from_rect
[
i
].
transform
[
1
],
elements
[
1
]);
expectf
(
0
.
0
,
elements
[
5
]);
expectf2
(
create_from_rect
[
i
].
transform
[
2
],
elements
[
2
]);
}
expectf2
(
create_from_rect
[
i
].
transform
[
3
],
elements
[
3
]);
todo_wine_if
(
create_from_rect
[
i
].
mode
==
LinearGradientModeVertical
)
{
expectf2
(
create_from_rect
[
i
].
transform
[
4
],
elements
[
4
]);
expectf2
(
create_from_rect
[
i
].
transform
[
5
],
elements
[
5
]);
}
#undef expectf2
}
status
=
GdipGetLineColors
(
brush
,
colors
);
ok
(
status
==
Ok
,
"Failed to get line colors, %d.
\n
"
,
status
);
ok
(
colors
[
0
]
==
0x1
&&
colors
[
1
]
==
0x2
,
"Unexpected brush colors.
\n
"
);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to delete a brush, %d.
\n
"
,
status
);
}
/* reverse gradient line as immediately previous */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
create_with_angle
);
++
i
)
pt1
.
X
=
10
.
0
;
{
pt1
.
Y
=
10
.
0
;
ARGB
colors
[
2
];
pt2
.
X
=
-
90
.
0
;
BOOL
ret
;
pt2
.
Y
=
10
.
0
;
status
=
GdipCreateLineBrush
(
&
pt1
,
&
pt2
,
0
,
0
,
WrapModeTile
,
&
brush
);
status
=
GdipCreateLineBrushFromRectWithAngle
(
&
create_with_angle
[
i
].
rect
,
0x1
,
0x2
,
create_with_angle
[
i
].
angle
,
expect
(
Ok
,
status
);
create_with_angle
[
i
].
is_scalable
,
WrapModeTile
,
&
brush
);
memset
(
&
rectf
,
0
,
sizeof
(
GpRectF
));
ok
(
status
==
Ok
,
"Failed to create a brush, %d.
\n
"
,
status
);
memset
(
&
rectf
,
0
,
sizeof
(
rectf
));
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
status
=
GdipGetLineRect
(
brush
,
&
rectf
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to get brush rect, %d.
\n
"
,
status
);
expectf
(
-
90
.
0
,
rectf
.
X
);
ok
(
!
memcmp
(
&
rectf
,
&
create_with_angle
[
i
].
rect
,
sizeof
(
rectf
)),
"%u: unexpected brush rect {%f,%f,%f,%f}.
\n
"
,
expectf
(
-
40
.
0
,
rectf
.
Y
);
i
,
rectf
.
X
,
rectf
.
Y
,
rectf
.
Width
,
rectf
.
Height
);
expectf
(
100
.
0
,
rectf
.
Width
);
expectf
(
100
.
0
,
rectf
.
Height
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
status
=
GdipGetLineTransform
(
brush
,
transform
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to get brush transform, %d.
\n
"
,
status
);
if
(
create_with_angle
[
i
].
angle
==
0
.
0
f
)
{
status
=
GdipIsMatrixIdentity
(
transform
,
&
ret
);
ok
(
status
==
Ok
,
"Unexpected ret value %d.
\n
"
,
status
);
}
else
{
status
=
GdipGetMatrixElements
(
transform
,
elements
);
status
=
GdipGetMatrixElements
(
transform
,
elements
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to get matrix elements, %d.
\n
"
,
status
);
expectf
(
-
1
.
0
,
elements
[
0
]);
expectf
(
0
.
0
,
elements
[
1
]);
#define expectf2(expected, got) ok(fabs(expected - got) < 0.001, "%u: expected %.3f, got %.3f.\n", i, expected, got)
expectf
(
0
.
0
,
elements
[
2
]);
expectf2
(
create_with_angle
[
i
].
transform
[
0
],
elements
[
0
]);
expectf
(
-
1
.
0
,
elements
[
3
]);
expectf2
(
create_with_angle
[
i
].
transform
[
1
],
elements
[
1
]);
expectf
(
-
80
.
0
,
elements
[
4
]);
expectf2
(
create_with_angle
[
i
].
transform
[
2
],
elements
[
2
]);
expectf
(
20
.
0
,
elements
[
5
]);
expectf2
(
create_with_angle
[
i
].
transform
[
3
],
elements
[
3
]);
expectf2
(
create_with_angle
[
i
].
transform
[
4
],
elements
[
4
]);
expectf2
(
create_with_angle
[
i
].
transform
[
5
],
elements
[
5
]);
#undef expectf2
}
status
=
GdipGetLineColors
(
brush
,
colors
);
ok
(
status
==
Ok
,
"Failed to get line colors, %d.
\n
"
,
status
);
ok
(
colors
[
0
]
==
0x1
&&
colors
[
1
]
==
0x2
,
"Unexpected brush colors.
\n
"
);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
status
=
GdipDeleteBrush
((
GpBrush
*
)
brush
);
expect
(
Ok
,
status
);
ok
(
status
==
Ok
,
"Failed to delete a brush, %d.
\n
"
,
status
);
}
GdipDeleteMatrix
(
transform
);
GdipDeleteMatrix
(
transform
);
}
}
...
...
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