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
8ab78e18
Commit
8ab78e18
authored
Sep 18, 2006
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Sep 20, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: header: Test the header order-management code and fix some bugs.
parent
38f9f0c4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
3 deletions
+85
-3
header.c
dlls/comctl32/header.c
+4
-3
header.c
dlls/comctl32/tests/header.c
+81
-0
No files found.
dlls/comctl32/header.c
View file @
8ab78e18
...
@@ -1105,13 +1105,14 @@ HEADER_DeleteItem (HWND hwnd, WPARAM wParam)
...
@@ -1105,13 +1105,14 @@ HEADER_DeleteItem (HWND hwnd, WPARAM wParam)
{
{
memmove
(
&
infoPtr
->
order
[
iOrder
],
&
infoPtr
->
order
[
iOrder
+
1
],
memmove
(
&
infoPtr
->
order
[
iOrder
],
&
infoPtr
->
order
[
iOrder
+
1
],
(
infoPtr
->
uNumItem
-
iOrder
)
*
sizeof
(
INT
));
(
infoPtr
->
uNumItem
-
iOrder
)
*
sizeof
(
INT
));
}
for
(
i
=
0
;
i
<
infoPtr
->
uNumItem
;
i
++
)
for
(
i
=
0
;
i
<
infoPtr
->
uNumItem
;
i
++
)
{
{
if
(
infoPtr
->
order
[
i
]
>
iItem
)
if
(
infoPtr
->
order
[
i
]
>
iItem
)
infoPtr
->
order
[
i
]
--
;
infoPtr
->
order
[
i
]
--
;
if
(
i
>=
iOrder
)
if
(
i
>=
iOrder
)
infoPtr
->
items
[
infoPtr
->
order
[
i
]].
iOrder
=
infoPtr
->
order
[
i
];
infoPtr
->
items
[
infoPtr
->
order
[
i
]].
iOrder
=
i
;
}
}
}
for
(
i
=
0
;
i
<
infoPtr
->
uNumItem
;
i
++
)
for
(
i
=
0
;
i
<
infoPtr
->
uNumItem
;
i
++
)
...
@@ -1343,7 +1344,7 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
...
@@ -1343,7 +1344,7 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
{
{
if
(
i
!=
iOrder
&&
infoPtr
->
order
[
i
]
>=
nItem
)
if
(
i
!=
iOrder
&&
infoPtr
->
order
[
i
]
>=
nItem
)
infoPtr
->
order
[
i
]
++
;
infoPtr
->
order
[
i
]
++
;
infoPtr
->
items
[
infoPtr
->
order
[
i
]].
iOrder
=
i
nfoPtr
->
order
[
i
]
;
infoPtr
->
items
[
infoPtr
->
order
[
i
]].
iOrder
=
i
;
}
}
lpItem
=
&
infoPtr
->
items
[
nItem
];
lpItem
=
&
infoPtr
->
items
[
nItem
];
...
...
dlls/comctl32/tests/header.c
View file @
8ab78e18
...
@@ -479,6 +479,86 @@ static void test_header_control (void)
...
@@ -479,6 +479,86 @@ static void test_header_control (void)
}
}
static
void
check_order
(
const
int
expected_id
[],
const
int
expected_order
[],
int
count
,
const
char
*
type
)
{
int
i
;
HDITEMA
hdi
;
ok
(
getItemCount
(
hWndHeader
)
==
count
,
"Invalid item count in order tests
\n
"
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
hdi
.
mask
=
HDI_LPARAM
|
HDI_ORDER
;
SendMessage
(
hWndHeader
,
HDM_GETITEMA
,
i
,
(
LPARAM
)
&
hdi
);
ok
(
hdi
.
lParam
==
expected_id
[
i
],
"Invalid item ids after '%s'- item %d has lParam %d
\n
"
,
type
,
i
,
(
int
)
hdi
.
lParam
);
ok
(
hdi
.
iOrder
==
expected_order
[
i
],
"Invalid item order after '%s'- item %d has iOrder %d
\n
"
,
type
,
i
,
hdi
.
iOrder
);
}
}
static
void
test_header_order
(
void
)
{
const
int
rand1
[]
=
{
0
,
1
,
1
,
0
,
4
};
const
int
rand2
[]
=
{
4
,
5
,
6
,
7
,
4
};
const
int
rand3
[]
=
{
5
,
5
,
1
,
6
,
1
};
const
int
rand4
[]
=
{
1
,
5
,
2
,
7
,
6
,
1
,
4
,
2
,
3
,
2
};
const
int
rand5
[]
=
{
7
,
8
,
5
,
6
,
7
,
2
,
1
,
9
,
10
,
10
};
const
int
rand6
[]
=
{
2
,
8
,
3
,
4
,
0
};
const
int
ids1
[]
=
{
3
,
0
,
2
,
1
,
4
};
const
int
ord1
[]
=
{
0
,
1
,
2
,
3
,
4
};
const
int
ids2
[]
=
{
3
,
9
,
7
,
0
,
2
,
1
,
4
,
8
,
6
,
5
};
const
int
ord2
[]
=
{
0
,
4
,
7
,
1
,
2
,
3
,
9
,
8
,
6
,
5
};
const
int
ord3
[]
=
{
0
,
3
,
9
,
2
,
1
,
8
,
7
,
6
,
5
,
4
};
const
int
ids4
[]
=
{
9
,
0
,
1
,
8
,
6
};
const
int
ord4
[]
=
{
1
,
0
,
4
,
3
,
2
};
char
buffer
[
20
];
HDITEMA
hdi
;
int
i
;
hWndHeader
=
create_header_control
();
ZeroMemory
(
&
hdi
,
sizeof
(
HDITEMA
));
hdi
.
mask
=
HDI_TEXT
|
HDI_LPARAM
;
hdi
.
pszText
=
buffer
;
strcpy
(
buffer
,
"test"
);
for
(
i
=
0
;
i
<
5
;
i
++
)
{
hdi
.
lParam
=
i
;
SendMessage
(
hWndHeader
,
HDM_INSERTITEMA
,
rand1
[
i
],
(
LPARAM
)
&
hdi
);
rand
();
}
check_order
(
ids1
,
ord1
,
5
,
"insert without iOrder"
);
hdi
.
mask
|=
HDI_ORDER
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
hdi
.
lParam
=
i
+
5
;
hdi
.
iOrder
=
rand2
[
i
];
SendMessage
(
hWndHeader
,
HDM_INSERTITEMA
,
rand3
[
i
],
(
LPARAM
)
&
hdi
);
rand
();
rand
();
}
check_order
(
ids2
,
ord2
,
10
,
"insert with order"
);
hdi
.
mask
=
HDI_ORDER
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
hdi
.
iOrder
=
rand5
[
i
];
SendMessage
(
hWndHeader
,
HDM_SETITEMA
,
rand4
[
i
],
(
LPARAM
)
&
hdi
);
rand
();
rand
();
}
check_order
(
ids2
,
ord3
,
10
,
"setitems changing order"
);
for
(
i
=
0
;
i
<
5
;
i
++
)
SendMessage
(
hWndHeader
,
HDM_DELETEITEM
,
rand6
[
i
],
0
);
check_order
(
ids4
,
ord4
,
5
,
"deleteitem"
);
DestroyWindow
(
hWndHeader
);
}
LRESULT
CALLBACK
HeaderTestWndProc
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
LRESULT
CALLBACK
HeaderTestWndProc
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
{
switch
(
msg
)
{
switch
(
msg
)
{
...
@@ -545,6 +625,7 @@ START_TEST(header)
...
@@ -545,6 +625,7 @@ START_TEST(header)
init
();
init
();
test_header_control
();
test_header_control
();
test_header_order
();
DestroyWindow
(
hHeaderParentWnd
);
DestroyWindow
(
hHeaderParentWnd
);
}
}
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