Closed Bug 473577 Opened 16 years ago Closed 16 years ago

make test plugin usable for reftests

Categories

(Core Graveyard :: Plug-ins, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ted, Assigned: ted)

References

Details

Attachments

(1 file, 2 obsolete files)

Josh wrote a test plugin in bug 386676 for use in plugin mochitests etc. This is great, since we severely lack coverage there. We also lack coverage of plugins in our reftests. We should extend the test plugin to be able to render simple color patterns so we could use it in reftest. As a start, something like "fill completely with green" would make it usable for a lot of reftests.
Attached patch very basic mac implementation (obsolete) — Splinter Review
Here's a not-very-useful Mac implementation. It adds a drawMode field to the plugin data, and adds DM_SOLID_COLOR as an option, with the color specified in another field of the plugin data. I don't really know enough about plugins to add any useful way to set this (via scripting or URL params or embed params) but I assume it would be straightforward to do so. Having the ability to do:
<embed type="application/x-test" bgcolor="FF00FF00"></embed>

or something like that would make this quite usable for reftests.
Ok, this lets you specify some parameters in the <embed> (or presumably <param>s under the <object>, if the docs are to be believed), so you can do like:
<embed type="application/x-test" width="400" height="400" drawmode="solid" color="FF00FF00"></embed>
to get a solid green plugin that's 400x400 px. The color format is AARRGGBB. You can leave off the AA and it will default to 0xFF.

I wrote some basic sanity checking reftests, and they pass, which is cool. dbaron: is there a way to include these in the main reftest.list only if plugins are enabled? Alternately, is there a way to make them all fails-if(plugins are disabled)?
Assignee: nobody → ted.mielczarek
Attachment #356969 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #357162 - Flags: review?(joshmoz)
Comment on attachment 357162 [details] [diff] [review]
let test plugin draw solid colors, add reftests

>+PRUint32
>+parseHexColor(char* color)

Please move this into nptest_utils

>+  for (int i=0; i<argc; i++) {

Style is "i = 0", "i < argc".

What is the point of testing so many basic colors in exactly the same way?

We can figure out how to make a nice system for parsing arguments into the plugin later.
Attachment #357162 - Flags: review?(joshmoz)
(In reply to comment #3)
> What is the point of testing so many basic colors in exactly the same way?

Mostly it's to test that my hex color parsing code works. :) Never hurts to have sanity checks.
(In reply to comment #2)
> dbaron: is there a way to include these in the main reftest.list only if
> plugins are enabled? Alternately, is there a way to make them all
> fails-if(plugins are disabled)?

fails-if(MOZ_PLUGINS!="1"), I'd think.  That does add another dependency on the build, though...
We could probably fake that in JS by looking for something that's only present when plugins are compiled, right? Actually, we could be even more specific, and see if we have the actual test plugin available, and expose that to the reftest manifest parser.
Depends on: 473935
Ok, fixed review comments, and combined the multi-color reftests into one single reftest testing 4 different colors. Ideally I'd have a few more tests in there to thoroughly test the hex color parsing code, but this is a good start.
Attachment #357162 - Attachment is obsolete: true
Attachment #357344 - Flags: review?(joshmoz)
Comment on attachment 357344 [details] [diff] [review]
fix nits, simplify reftests

>+      byte[0] = color[len-2];
>+      byte[1] = color[len-1];
...
>+      byte[1] = color[len-1];

Few more cases of not having a space around operators.

Looks good to me, thanks!
Attachment #357344 - Flags: review?(joshmoz) → review+
Pushed to m-c:
http://hg.mozilla.org/mozilla-central/rev/86c69da673eb
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Ted, will you check in bug 469831 too?
Sure. You really don't have commit access yet? For shame!
Yeah, everyone's saying I should get it. I'd like to become more experienced in hg first, though: http://quotes.burntelectrons.org/3853 :)
I just checked in a bustage fix for TB trunk: http://hg.mozilla.org/mozilla-central/rev/184eadf4e185 (add missing prtypes.h header).
(In reply to comment #13)

Thanks, sorry I missed that!
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: