Closed
Bug 885996
Opened 12 years ago
Closed 12 years ago
Interaction between nsIColorPicker and content
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: mounir, Assigned: mounir)
References
Details
Attachments
(3 files, 2 obsolete files)
15.16 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
4.39 KB,
patch
|
Details | Diff | Splinter Review | |
7.53 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
This is using the patch in bug 875747 to interact between <input type='file'> and the nsIColorPicker widget. It is taking care of the input and change events.
I am going to attach tests later.
Attachment #766270 -
Flags: review?(bugs)
Comment 1•12 years ago
|
||
(In reply to Mounir Lamouri (:mounir) from comment #0)
> between <input type='file'>
I guess you meant <input type='color'> ;)
Assignee | ||
Comment 2•12 years ago
|
||
Attachment #766338 -
Flags: review?(bugs)
Comment 3•12 years ago
|
||
Comment on attachment 766270 [details] [diff] [review]
Patch
returnOK/Cancel are odd names for consts, but not really about this bug.
Could you make |win| nsCOMPtr. It is used so far a way from declaration that
making a security bug by accident is easy. And this is not perf-critical code.
aTrustedUpdate is odd name. Perhaps call it aFinalUpdate or some such.
Attachment #766270 -
Flags: review?(bugs) → review+
Comment 4•12 years ago
|
||
Comment on attachment 766338 [details] [diff] [review]
Tests
>+ if (element.dataset.type == 'update') {
>+ MockColorPicker.returnColor = '#f00ba4';
>+ update();
>+
>+ is(inputEvent, true, 'input event should have been received');
>+ is(changeEvent, false, 'change event should not have been received');
>+
>+ inputEvent = changeEvent = false;
>+
>+ is(element.value, MockColorPicker.returnColor);
>+
>+ MockColorPicker.returnColor = '#f00ba7';
>+ isnot(element.value, MockColorPicker.returnColor);
>+ } else if (element.dataset.type == 'cancel') {
>+ MockColorPicker.returnColor = '#bababa';
>+ isnot(element.value, MockColorPicker.returnColor);
>+ } else if (element.dataset.type == 'done') {
>+ MockColorPicker.returnColor = '#098766';
>+ isnot(element.value, MockColorPicker.returnColor);
>+ } else if (element.dataset.type == 'noop-done') {
>+ MockColorPicker.returnColor = element.value;
>+ is(element.value, MockColorPicker.returnColor);
>+ }
>+
I don't understand what these .returnColor = foo; is[not] tests are trying to test.
Do they test how MockColorPicker works or what?
>+ <meta charset="utf-8">
>+ <title>Test for Bug 1234567</title>
>+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
>+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
>+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
>+ <script type="application/javascript;version=1.8">
>+
>+ /** Test that update() modifies the element value such as done() when it is
>+ * not called as a concellation.
This whole sentence is hard to parse.
You mean cancellation and 'the same way as done() ...' or something like that?
Updated•12 years ago
|
Attachment #766338 -
Flags: review?(bugs) → feedback?(mounir)
Assignee | ||
Updated•12 years ago
|
Attachment #766338 -
Flags: feedback?(mounir) → review?(bugs)
Assignee | ||
Comment 5•12 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #4)
> Comment on attachment 766338 [details] [diff] [review]
> Tests
>
>
> >+ if (element.dataset.type == 'update') {
> >+ MockColorPicker.returnColor = '#f00ba4';
> >+ update();
> >+
> >+ is(inputEvent, true, 'input event should have been received');
> >+ is(changeEvent, false, 'change event should not have been received');
> >+
> >+ inputEvent = changeEvent = false;
> >+
> >+ is(element.value, MockColorPicker.returnColor);
> >+
> >+ MockColorPicker.returnColor = '#f00ba7';
> >+ isnot(element.value, MockColorPicker.returnColor);
> >+ } else if (element.dataset.type == 'cancel') {
> >+ MockColorPicker.returnColor = '#bababa';
> >+ isnot(element.value, MockColorPicker.returnColor);
> >+ } else if (element.dataset.type == 'done') {
> >+ MockColorPicker.returnColor = '#098766';
> >+ isnot(element.value, MockColorPicker.returnColor);
> >+ } else if (element.dataset.type == 'noop-done') {
> >+ MockColorPicker.returnColor = element.value;
> >+ is(element.value, MockColorPicker.returnColor);
> >+ }
> >+
> I don't understand what these .returnColor = foo; is[not] tests are trying
> to test.
> Do they test how MockColorPicker works or what?
Those tests are indeed naive but the idea is to check that the value did (or did not) change when the color picker current color changed. There is no way to really express that with MockColorPicker so I expressed that with .returnColor which makes those checks a bit stupid. Though, they do not hurt and if we end up having a better way to change the current selected color in MockColorPicker we will have tests for free.
Comment 6•12 years ago
|
||
Comment on attachment 766338 [details] [diff] [review]
Tests
this is rs'ish r+
Attachment #766338 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 7•12 years ago
|
||
Olli, I applied your change requests and some changes requested by roc in the interface review. Could you review this new patch?
(I am going to attach an inter-diff.)
Attachment #766270 -
Attachment is obsolete: true
Attachment #770884 -
Flags: review?(bugs)
Assignee | ||
Comment 8•12 years ago
|
||
Comment 9•12 years ago
|
||
The new patch looks good to me.
I've updated the Gtk Widget in bug 875753 accordingly, so you can use it if you want to test this patch "for real".
Assignee | ||
Comment 10•12 years ago
|
||
Some cleaning up.
Attachment #770884 -
Attachment is obsolete: true
Attachment #770884 -
Flags: review?(bugs)
Attachment #771361 -
Flags: review?(bugs)
Updated•12 years ago
|
Attachment #771361 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 11•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/997713d63032
https://hg.mozilla.org/integration/mozilla-inbound/rev/3e3c4e5cba74
Flags: in-testsuite+
Target Milestone: --- → mozilla25
Comment 12•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/997713d63032
https://hg.mozilla.org/mozilla-central/rev/3e3c4e5cba74
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•