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
b61a1ba3
Commit
b61a1ba3
authored
Jul 02, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Add some tests for GdipGetPropertySize and GdipGetAllPropertyItems.
parent
3c9805d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
169 additions
and
0 deletions
+169
-0
image.c
dlls/gdiplus/tests/image.c
+169
-0
No files found.
dlls/gdiplus/tests/image.c
View file @
b61a1ba3
...
...
@@ -3127,6 +3127,174 @@ static void test_tiff_properties(void)
GdipDisposeImage
(
image
);
}
static
void
test_GdipGetAllPropertyItems
(
void
)
{
static
const
struct
test_data
{
ULONG
type
,
id
,
length
;
BYTE
value
[
32
];
}
td
[
16
]
=
{
{
PropertyTagTypeLong
,
0xfe
,
4
,
{
0
}
},
{
PropertyTagTypeShort
,
0x100
,
2
,
{
1
}
},
{
PropertyTagTypeShort
,
0x101
,
2
,
{
1
}
},
{
PropertyTagTypeShort
,
0x102
,
6
,
{
8
,
0
,
8
,
0
,
8
,
0
}
},
{
PropertyTagTypeShort
,
0x103
,
2
,
{
1
}
},
{
PropertyTagTypeShort
,
0x106
,
2
,
{
2
,
0
}
},
{
PropertyTagTypeASCII
,
0x10d
,
27
,
"/home/meh/Desktop/test.tif"
},
{
PropertyTagTypeLong
,
0x111
,
4
,
{
8
,
0
,
0
,
0
}
},
{
PropertyTagTypeShort
,
0x112
,
2
,
{
1
}
},
{
PropertyTagTypeShort
,
0x115
,
2
,
{
3
,
0
}
},
{
PropertyTagTypeShort
,
0x116
,
2
,
{
0x40
,
0
}
},
{
PropertyTagTypeLong
,
0x117
,
4
,
{
3
,
0
,
0
,
0
}
},
{
PropertyTagTypeRational
,
0x11a
,
8
,
{
0
,
0
,
0
,
72
,
0
,
0
,
0
,
1
}
},
{
PropertyTagTypeRational
,
0x11b
,
8
,
{
0
,
0
,
0
,
72
,
0
,
0
,
0
,
1
}
},
{
PropertyTagTypeShort
,
0x11c
,
2
,
{
1
}
},
{
PropertyTagTypeShort
,
0x128
,
2
,
{
2
}
}
};
GpStatus
status
;
GpImage
*
image
;
GUID
guid
;
UINT
dim_count
,
frame_count
,
prop_count
,
prop_size
,
i
;
UINT
total_size
,
total_count
;
PROPID
*
prop_id
;
PropertyItem
*
prop_item
;
const
char
*
item_data
;
image
=
load_image
(
tiffimage
,
sizeof
(
tiffimage
));
ok
(
image
!=
0
,
"Failed to load TIFF image data
\n
"
);
if
(
!
image
)
return
;
dim_count
=
0xdeadbeef
;
status
=
GdipImageGetFrameDimensionsCount
(
image
,
&
dim_count
);
expect
(
Ok
,
status
);
expect
(
1
,
dim_count
);
status
=
GdipImageGetFrameDimensionsList
(
image
,
&
guid
,
1
);
expect
(
Ok
,
status
);
expect_guid
(
&
FrameDimensionPage
,
&
guid
,
__LINE__
,
FALSE
);
frame_count
=
0xdeadbeef
;
status
=
GdipImageGetFrameCount
(
image
,
&
guid
,
&
frame_count
);
expect
(
Ok
,
status
);
expect
(
1
,
frame_count
);
prop_count
=
0xdeadbeef
;
status
=
GdipGetPropertyCount
(
image
,
&
prop_count
);
expect
(
Ok
,
status
);
ok
(
prop_count
==
sizeof
(
td
)
/
sizeof
(
td
[
0
]),
"expected property count %u, got %u
\n
"
,
(
UINT
)(
sizeof
(
td
)
/
sizeof
(
td
[
0
])),
prop_count
);
prop_id
=
HeapAlloc
(
GetProcessHeap
(),
0
,
prop_count
*
sizeof
(
*
prop_id
));
status
=
GdipGetPropertyIdList
(
image
,
prop_count
,
prop_id
);
expect
(
Ok
,
status
);
prop_size
=
0
;
for
(
i
=
0
;
i
<
prop_count
;
i
++
)
{
UINT
size
;
status
=
GdipGetPropertyItemSize
(
image
,
prop_id
[
i
],
&
size
);
expect
(
Ok
,
status
);
if
(
status
!=
Ok
)
break
;
ok
(
size
>
sizeof
(
*
prop_item
),
"%u: too small item length %u
\n
"
,
i
,
size
);
prop_size
+=
size
;
prop_item
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
status
=
GdipGetPropertyItem
(
image
,
prop_id
[
i
],
size
,
prop_item
);
expect
(
Ok
,
status
);
ok
(
prop_item
->
value
==
prop_item
+
1
,
"expected item->value %p, got %p
\n
"
,
prop_item
+
1
,
prop_item
->
value
);
ok
(
td
[
i
].
type
==
prop_item
->
type
,
"%u: expected type %u, got %u
\n
"
,
i
,
td
[
i
].
type
,
prop_item
->
type
);
ok
(
td
[
i
].
id
==
prop_item
->
id
,
"%u: expected id %#x, got %#x
\n
"
,
i
,
td
[
i
].
id
,
prop_item
->
id
);
size
-=
sizeof
(
*
prop_item
);
ok
(
prop_item
->
length
==
size
,
"%u: expected length %u, got %u
\n
"
,
i
,
size
,
prop_item
->
length
);
ok
(
td
[
i
].
length
==
prop_item
->
length
,
"%u: expected length %u, got %u
\n
"
,
i
,
td
[
i
].
length
,
prop_item
->
length
);
if
(
td
[
i
].
length
==
prop_item
->
length
)
{
int
match
=
memcmp
(
td
[
i
].
value
,
prop_item
->
value
,
td
[
i
].
length
)
==
0
;
ok
(
match
,
"%u: data mismatch
\n
"
,
i
);
if
(
!
match
)
{
UINT
j
;
BYTE
*
data
=
prop_item
->
value
;
printf
(
"id %#x:"
,
prop_item
->
id
);
for
(
j
=
0
;
j
<
prop_item
->
length
;
j
++
)
printf
(
" %02x"
,
data
[
j
]);
printf
(
"
\n
"
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
prop_item
);
}
HeapFree
(
GetProcessHeap
(),
0
,
prop_id
);
status
=
GdipGetPropertySize
(
NULL
,
&
total_size
,
&
total_count
);
expect
(
InvalidParameter
,
status
);
status
=
GdipGetPropertySize
(
image
,
&
total_size
,
NULL
);
expect
(
InvalidParameter
,
status
);
status
=
GdipGetPropertySize
(
image
,
NULL
,
&
total_count
);
expect
(
InvalidParameter
,
status
);
status
=
GdipGetPropertySize
(
image
,
NULL
,
NULL
);
expect
(
InvalidParameter
,
status
);
total_size
=
0xdeadbeef
;
total_count
=
0xdeadbeef
;
status
=
GdipGetPropertySize
(
image
,
&
total_size
,
&
total_count
);
expect
(
Ok
,
status
);
ok
(
prop_count
==
total_count
,
"expected total property count %u, got %u
\n
"
,
prop_count
,
total_count
);
ok
(
prop_size
==
total_size
,
"expected total property size %u, got %u
\n
"
,
prop_size
,
total_size
);
prop_item
=
HeapAlloc
(
GetProcessHeap
(),
0
,
prop_size
);
status
=
GdipGetAllPropertyItems
(
image
,
0
,
prop_count
,
prop_item
);
expect
(
InvalidParameter
,
status
);
status
=
GdipGetAllPropertyItems
(
image
,
prop_size
,
1
,
prop_item
);
expect
(
InvalidParameter
,
status
);
status
=
GdipGetAllPropertyItems
(
image
,
prop_size
,
prop_count
,
NULL
);
expect
(
InvalidParameter
,
status
);
status
=
GdipGetAllPropertyItems
(
image
,
prop_size
,
prop_count
,
NULL
);
expect
(
InvalidParameter
,
status
);
status
=
GdipGetAllPropertyItems
(
image
,
0
,
0
,
NULL
);
expect
(
InvalidParameter
,
status
);
status
=
GdipGetAllPropertyItems
(
image
,
prop_size
+
1
,
prop_count
,
prop_item
);
expect
(
InvalidParameter
,
status
);
status
=
GdipGetAllPropertyItems
(
image
,
prop_size
,
prop_count
,
prop_item
);
expect
(
Ok
,
status
);
item_data
=
(
const
char
*
)(
prop_item
+
prop_count
);
for
(
i
=
0
;
i
<
prop_count
;
i
++
)
{
ok
(
prop_item
[
i
].
value
==
item_data
,
"%u: expected value %p, got %p
\n
"
,
i
,
item_data
,
prop_item
[
i
].
value
);
ok
(
td
[
i
].
type
==
prop_item
[
i
].
type
,
"%u: expected type %u, got %u
\n
"
,
i
,
td
[
i
].
type
,
prop_item
[
i
].
type
);
ok
(
td
[
i
].
id
==
prop_item
[
i
].
id
,
"%u: expected id %#x, got %#x
\n
"
,
i
,
td
[
i
].
id
,
prop_item
[
i
].
id
);
ok
(
td
[
i
].
length
==
prop_item
[
i
].
length
,
"%u: expected length %u, got %u
\n
"
,
i
,
td
[
i
].
length
,
prop_item
[
i
].
length
);
if
(
td
[
i
].
length
==
prop_item
[
i
].
length
)
{
int
match
=
memcmp
(
td
[
i
].
value
,
prop_item
[
i
].
value
,
td
[
i
].
length
)
==
0
;
ok
(
match
,
"%u: data mismatch
\n
"
,
i
);
if
(
!
match
)
{
UINT
j
;
BYTE
*
data
=
prop_item
[
i
].
value
;
printf
(
"id %#x:"
,
prop_item
[
i
].
id
);
for
(
j
=
0
;
j
<
prop_item
[
i
].
length
;
j
++
)
printf
(
" %02x"
,
data
[
j
]);
printf
(
"
\n
"
);
}
}
item_data
+=
prop_item
[
i
].
length
;
}
HeapFree
(
GetProcessHeap
(),
0
,
prop_item
);
GdipDisposeImage
(
image
);
}
START_TEST
(
image
)
{
struct
GdiplusStartupInput
gdiplusStartupInput
;
...
...
@@ -3139,6 +3307,7 @@ START_TEST(image)
GdiplusStartup
(
&
gdiplusToken
,
&
gdiplusStartupInput
,
NULL
);
test_GdipGetAllPropertyItems
();
test_tiff_properties
();
test_image_properties
();
test_Scan0
();
...
...
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