* @param h the test harness to use
*/
private void testHorizontalScrollbarAsNeeded(TestHarness h)
{
JScrollPane sp = new JScrollPane();
ScrollPaneLayout l = (ScrollPaneLayout) sp.getLayout();
sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
JPanel view = new JPanel();
view.setMinimumSize(new Dimension(100, 100));
sp.getViewport().add(view);
Insets i = sp.getInsets();
Component[] c = sp.getComponents();
// Check ScrollPane size < view size.
sp.setSize(50, 50);
h.check(l.minimumLayoutSize(sp),
new Dimension(i.left + i.right + c[0].getMinimumSize().width,
i.top + i.bottom + c[0].getMinimumSize().height
+ c[2].getMinimumSize().height));
// Check ScrollPane size > view size.
sp.setSize(150, 150);
h.check(l.minimumLayoutSize(sp),
new Dimension(i.left + i.right + c[0].getMinimumSize().width,
i.top + i.bottom + c[0].getMinimumSize().height
+ c[2].getMinimumSize().height));
}