On Nov 30, 4:07 pm, Al Murauski <[email protected]> wrote: > Hi, > > I'm getting a problem with unit tests if there's a <stylesheet> tag in > the module definition xml. > > Here's the module that cauases problems: > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.1// > EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.1/distro- > source/core/src/gwt-module.dtd"> > <module rename-to='xxx'> > <inherits name='com.google.gwt.user.User'/> > > <inherits name='com.google.gwt.user.theme.standard.Standard'/> > > <stylesheet src="../GWT-default.css"/> > > <source path="core"/> > <source path="client"/> > > <entry-point class='com.xxx.xxx.xxx.Xxx'/> > </module> > > The error in my Eclipse console reads: > > Starting HTTP on port 0 > HTTP listening on port 62518 > Loading module 'GWT-default.css' > [ERROR] Invalid module name: 'GWT-default.css' > Loading module 'GWT-default.css' > [ERROR] Invalid module name: 'GWT-default.css' > The development shell servlet received a request to generate a host > page for module 'GWT-default.css' > Loading module 'GWT-default.css' > [ERROR] Invalid module name: 'GWT-default.css' > > If I remove the <stylesheet src="../GWT-default.css"/> from the above > xml, the test is passed ok. > > Any ideas?
Given the "../" path, I suspect the stylesheet is in you "war" folder. Then, either: - put a <link rel=stylesheet href=GWT-default.css> in your HTML host page (the CSS won't be loaded at all during tests) - move the stylesheet into a 'public' subfolder of your module (com/ xxx/xxx/public/GWT-default.css) and then use <stylesheet src="GWT- default.css" /> (the stylesheet will be loaded when running your tests) - create an intermediary module without the <stylesheet/> that you'll use for your tests, and have your "app module" <inherits/> this intermediary module and add the <stylesheet/>, for use when compiling your app. The reason is that JUnitShell is based on the GWTShell from GWT 1.5 and previous versions, with an embedded Tomcat, where the first URL path segment was used to identify the module to be loaded; so your test loads at http://localhost:8888/com.xxx.xxx.Xxx/junit.html, which then tries to load the stylesheet at http://localhost:8888/GWT-default.css, so JUnitShell interprets GWT-default.css as a module name and tries to load it. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
