Add test to DocumentResources

Make sure styles are only added once.
Fix a problem when adding stylesheets to the document

Adding stylesheets at draw time was not a good idea because they don't become effective during the draw cycle.
As a workaround the component now gives the stylesheets to the root component and whenever there are stylesheets to draw an additional draw cycle is triggered just to draw the stylesheets before the components draw.

This also fixes the problem of adding a stylesheet to the document more than once.