Closed
Bug 523118
Opened 15 years ago
Closed 15 years ago
we mistake 'cell' and text' xul tree seltypes for multiselects
Categories
(Core :: Disability Access APIs, defect)
Core
Disability Access APIs
Tracking
()
RESOLVED
FIXED
People
(Reporter: davidb, Assigned: davidb)
Details
(Keywords: access)
Attachments
(1 file, 5 obsolete files)
7.88 KB,
patch
|
surkov
:
review+
|
Details | Diff | Splinter Review |
Spun off from Neil's catch: bug 414302 comment 42. We should at least do this in nsXULTreeAccessible.
Assignee | ||
Comment 1•15 years ago
|
||
Alexander, what do you think?
Assignee | ||
Comment 2•15 years ago
|
||
Probably need a few more mochitests.
Comment 3•15 years ago
|
||
Comment on attachment 407044 [details] [diff] [review]
first pass
>+ nsCOMPtr<nsITreeSelection> selection;
>+ mTreeView->GetSelection(getter_AddRefs(selection));
>+ if (selection) {
>+ PRBool single;
>+ selection->GetSingle(&single);
it can fail
technically we don't need to check if it's single because SelectAll() makes this for us (http://mxr.mozilla.org/mozilla-central/source/layout/xul/base/src/tree/src/nsTreeSelection.cpp#537)
>+ if (!single) {
>+ *_retval = PR_TRUE;
nit: would be nice to rename it since you're here
>+ nsCOMPtr<nsITreeSelection> selection;
>+ mTreeView->GetSelection(getter_AddRefs(selection));
>+ if (selection)
it doesn't make sense to get selection second time and test it on null ;)
yeah, mochitests are good idea :)
otherwise is good :)
Assignee | ||
Comment 4•15 years ago
|
||
> >+ nsCOMPtr<nsITreeSelection> selection;
> >+ mTreeView->GetSelection(getter_AddRefs(selection));
> >+ if (selection)
>
> it doesn't make sense to get selection second time and test it on null ;)
>
>
Ha! yeah my cut and paste forgot the cut part ;)
Assignee | ||
Updated•15 years ago
|
Summary: use nsTreeSelection::GetSingle to determine if trees are single or multi select → we mistake 'cell' and text' xul tree seltypes for multiselects
Assignee | ||
Comment 5•15 years ago
|
||
Fixes comments and adds tests.
Assignee: nobody → bolterbugz
Attachment #407044 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #407091 -
Flags: review?(surkov.alexander)
Comment 6•15 years ago
|
||
Comment on attachment 407091 [details] [diff] [review]
patch
>+NS_IMETHODIMP
>+nsXULTreeAccessible::SelectAllSelection(PRBool *success)
don't forget to use prefix 'a'
it's preferable to have more descriptive name like aIsMultiSelectable
> {
>- *_retval = PR_FALSE;
>+ *success = PR_FALSE;
check by NS_ENSURE_ARG_POINTER
>+ nsCOMPtr<nsITreeSelection> selection;
>+ mTreeView->GetSelection(getter_AddRefs(selection));
>+ if (selection) {
>+ if (selection->SelectAll() == NS_OK) {
NS_SUCCEEDED in general
but nsresult of SelectAll doesn't point if tree is multiselectable, therefore you need to test this manually - I missed this in previous review.
>+ *success = PR_TRUE;
>
>- if (this.DOMNode.getAttribute("seltype") != "single")
>+ var seltype = this.DOMNode.getAttribute("seltype");
>+ if (seltype != "single" &&
>+ seltype != "cell" &&
>+ seltype != "text")
> testStates(tree, STATE_MULTISELECTABLE);
this is nice, we need to keep this, possibly you should use GetSingle as well though I don't have strong opinion. But your tests don't test your patch.
Attachment #407091 -
Flags: review?(surkov.alexander)
Assignee | ||
Comment 7•15 years ago
|
||
(In reply to comment #6)
> But your tests don't test your patch.
Doh! Thanks for the catches! I'll post a new patch later.
Assignee | ||
Comment 8•15 years ago
|
||
Tests select all implementation for xul tree accessibles. Addresses comments.
Attachment #407091 -
Attachment is obsolete: true
Comment 9•15 years ago
|
||
Comment on attachment 407294 [details] [diff] [review]
patch2
> this.check = function check()
> {
> var tree = getAccessible(this.DOMNode);
>
> // tree states
> testStates(tree, STATE_READONLY);
>
>- if (this.DOMNode.getAttribute("seltype") != "single")
>+ function ismultiselect(node) {
nit: isMultiSelectable ?
I'm not fun of function defining inside of other function
>+ // test SelectAllSelection correctly discerns multiselect vs single
>+ var accSelectable = getAccessible(this.DOMNode,
>+ [nsIAccessibleSelectable]);
>+ ok(accSelectable, "tree is not selectable!");
>+ if (accSelectable)
>+ is(accSelectable.selectAllSelection(), ismultiselect(this.DOMNode),
>+ "SelectAllSelection doesn't match ismultiselect");
I would prefer to have this test in separate file like test_selectable_tree.xul or something
You need to test tree selection additionally to see if all rows were selected
Assignee | ||
Comment 10•15 years ago
|
||
Just want to get your eyes on this before you go to bed :)
Attachment #407294 -
Attachment is obsolete: true
Attachment #407534 -
Flags: review?(surkov.alexander)
Assignee | ||
Comment 11•15 years ago
|
||
Oops please ignore straggling mods to test_states_tree - I'll remove locally.
Assignee | ||
Comment 12•15 years ago
|
||
If you are still awake :)
Attachment #407534 -
Attachment is obsolete: true
Attachment #407541 -
Flags: review?(surkov.alexander)
Attachment #407534 -
Flags: review?(surkov.alexander)
Assignee | ||
Comment 13•15 years ago
|
||
Attachment #407541 -
Attachment is obsolete: true
Attachment #407561 -
Flags: review?(surkov.alexander)
Attachment #407541 -
Flags: review?(surkov.alexander)
Comment 14•15 years ago
|
||
Comment on attachment 407561 [details] [diff] [review]
better test
sounds ok, thank you.
Attachment #407561 -
Flags: review?(surkov.alexander) → review+
Assignee | ||
Comment 15•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•