use of org.eclipse.swt.widgets.CoolBar in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_CoolItem method test_getPreferredSize.
@Test
public void test_getPreferredSize() {
CoolBar coolBar = new CoolBar(shell, 0);
CoolItem coolItem = new CoolItem(coolBar, 0);
Button button = new Button(coolBar, SWT.PUSH);
button.setText("foobar");
coolItem.setControl(button);
Point pref = coolItem.getPreferredSize();
coolItem.setPreferredSize(pref);
assertEquals(pref, coolItem.getPreferredSize());
}
use of org.eclipse.swt.widgets.CoolBar in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_CoolItem method test_setPreferredSizeLorg_eclipse_swt_graphics_Point.
@Test
public void test_setPreferredSizeLorg_eclipse_swt_graphics_Point() {
CoolBar coolBar = new CoolBar(shell, 0);
CoolItem coolItem = new CoolItem(coolBar, 0);
Button button = new Button(coolBar, SWT.PUSH);
button.setText("foobar");
coolItem.setControl(button);
Point size = new Point(50, 30);
coolItem.setPreferredSize(size);
Point size2 = coolItem.getPreferredSize();
coolItem.setPreferredSize(50, 30);
assertEquals(size2, coolItem.getPreferredSize());
}
use of org.eclipse.swt.widgets.CoolBar in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_CoolItem method test_ConstructorLorg_eclipse_swt_widgets_CoolBarI.
@Test
public void test_ConstructorLorg_eclipse_swt_widgets_CoolBarI() {
CoolBar coolBar = new CoolBar(shell, 0);
new CoolItem(coolBar, 0);
try {
new CoolItem(null, 0);
fail("No exception thrown for parent == null");
} catch (IllegalArgumentException e) {
}
}
use of org.eclipse.swt.widgets.CoolBar in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_CoolItem method test_setSizeII.
@Test
public void test_setSizeII() {
CoolBar coolBar = new CoolBar(shell, 0);
CoolItem coolItem = new CoolItem(coolBar, 0);
Button button = new Button(coolBar, SWT.PUSH);
button.setText("foo");
coolItem.setControl(button);
coolItem.setSize(50, 50);
assertEquals(new Point(50, 50), coolItem.getSize());
coolItem.setSize(0, 0);
Point smallest = coolItem.getSize();
coolItem.setSize(1, 1);
assertEquals(smallest, coolItem.getSize());
Rectangle rect = coolItem.getBounds();
Point size = coolItem.getSize();
coolItem.setSize(rect.width, rect.height);
assertEquals(size, coolItem.getSize());
}
use of org.eclipse.swt.widgets.CoolBar in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_CoolItem method test_getSize.
@Test
public void test_getSize() {
CoolBar coolBar = new CoolBar(shell, 0);
CoolItem coolItem = new CoolItem(coolBar, 0);
Button button = new Button(coolBar, SWT.PUSH);
button.setText("foo");
coolItem.setControl(button);
Point size = coolItem.getSize();
Rectangle rect = coolItem.getBounds();
assertEquals(rect.width, size.x);
assertEquals(rect.height, size.y);
}
Aggregations