Reputation: 131
I'm working on an application that has a custom look and feel. For GUI testing, I am using FEST-Swing. Currently, the GUI tests are running with the default java look and feel. Because of this, some tests are failing, but should I consider this to be a bug in the GUI, or test using my custom look and feel?
Later edit:
Thank you Andrew Tompson for the quick answer. But the issue I think still remains, because of the way the flow layout works. Here's a mockup of what happens:
The standard LAF uses a bigger font than the one I am using, and this causes one of the buttons to get out of the layout. And I can't use pack(), since there's a size requirement for that container. If you didn't call frame.pack() in that example, I think you would have the same issue.
Upvotes: 4
Views: 240
Reputation: 10859
You should test using your custom look and feel! It's not a bug in the GUI per se.
The standard LAF uses a bigger font than the one I am using, and this causes one of the buttons to get out of the layout. And I can't use pack(), since there's a size requirement for that container. If you didn't call frame.pack() in that example, I think you would have the same issue.
You have a size requirement for the container. This means that with standard LAF no LayoutManager could compute any arrangement of the components in the container, so that they all would fit in standard LAF because as you point out they're just too big. It means you cannot have standard LAF and the size requirement.
As long as you use only your custom LAF and test with this custom LAF on all supported OS systems and no test fails everything is alright. So just change your tests and switch to your custom LAF before executing the tests.
In case you ever want to run your application in standard LAF you'll have to relax the size requirement until everything is displayed properly using a capable LayoutManager. For example with MigLayout you can conveniently set all these size requirements and still use pack() on the JFrame in the end.
edit: I agree with Andrew that you should critically review the need for the size requirement. In many cases these requirements aren't really required and dropping them reduces the 'failures' in layouting greatly. For example you might just specify a minimum size for the container.
Upvotes: 1
Reputation: 168825
some buttons are too big and don't get rendered in the window .. should I consider this to be a bug in the GUI ..
Yes. It seems as though the current GUI is very fragile. See the Nested Layout Example for a GUI that works in any PLAF.
Upvotes: 5