use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_DateTime method test_setForegroundAlphaCalendarDateTime.
@Test
public void test_setForegroundAlphaCalendarDateTime() {
DateTime calendar = new DateTime(shell, SWT.CALENDAR);
assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32", SwtTestUtil.isCocoa || SwtTestUtil.isGTK3());
Color color = new Color(calendar.getDisplay(), 255, 0, 0, 0);
calendar.setForeground(color);
assertEquals(color, calendar.getForeground());
Color bg = new Color(calendar.getDisplay(), 0, 255, 0, 0);
calendar.setBackground(bg);
assertEquals(color, calendar.getForeground());
color.dispose();
bg.dispose();
calendar.dispose();
}
use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_DateTime method test_setBackgroundCalendarDateTime.
@Test
public void test_setBackgroundCalendarDateTime() {
DateTime calendar = new DateTime(shell, SWT.CALENDAR);
Color color = new Color(calendar.getDisplay(), 255, 0, 0);
calendar.setBackground(color);
assertEquals("getBackground not equal after setBackground for SWT.CALENDAR DateTime", color, calendar.getBackground());
calendar.setBackground(null);
assertTrue("getBackground unchanged after setBackground(null) for SWT.CALENDAR DateTime", !calendar.getBackground().equals(color));
color.dispose();
color = new Color(calendar.getDisplay(), 255, 0, 0, 0);
calendar.setBackground(color);
assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.CALENDAR DateTime", color, calendar.getBackground());
calendar.setBackground(null);
assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.CALENDAR DateTime", !calendar.getBackground().equals(color));
if ("gtk".equals(SWT.getPlatform())) {
Color fg = new Color(calendar.getDisplay(), 0, 255, 0);
calendar.setBackground(color);
calendar.setForeground(fg);
assertEquals("Setting a foreground disrupted the background color for SWT.CALENDAR DateTime", color, calendar.getBackground());
assertEquals("Setting a foreground onto an SWT.CALENDAR DateTime with a background failed", fg, calendar.getForeground());
fg.dispose();
}
color.dispose();
calendar.dispose();
}
use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_DateTime method test_setForegroundAlphaDateDateTime.
@Test
public void test_setForegroundAlphaDateDateTime() {
DateTime date = new DateTime(shell, SWT.DATE);
assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32", SwtTestUtil.isCocoa || SwtTestUtil.isGTK3());
Color color = new Color(date.getDisplay(), 255, 0, 0, 0);
date.setForeground(color);
assertEquals(color, date.getForeground());
Color bg = new Color(date.getDisplay(), 0, 255, 0, 0);
date.setBackground(bg);
assertEquals(color, date.getForeground());
color.dispose();
bg.dispose();
date.dispose();
}
use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_DateTime method test_setForegroundDateDateTime.
@Test
public void test_setForegroundDateDateTime() {
DateTime date = new DateTime(shell, SWT.DATE);
Color color = new Color(date.getDisplay(), 255, 0, 0);
date.setForeground(color);
assertEquals(color, date.getForeground());
date.setForeground(null);
assertFalse(date.getForeground().equals(color));
if ("gtk".equals(SWT.getPlatform())) {
Color bg = new Color(date.getDisplay(), 0, 255, 0);
date.setForeground(color);
date.setBackground(bg);
assertEquals("Setting a background disrupted the foreground color for SWT.DATE DateTime", color, date.getForeground());
assertEquals("Setting a background onto an SWT.DATE DateTime with a foreground failed", bg, date.getBackground());
bg.dispose();
}
color.dispose();
date.dispose();
}
use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_DateTime method test_setBackgroundAlphaTimeDateTime.
@Test
public void test_setBackgroundAlphaTimeDateTime() {
DateTime time = new DateTime(shell, SWT.TIME);
Color color = new Color(time.getDisplay(), 255, 0, 0, 0);
time.setBackground(color);
assertEquals(color, time.getBackground());
Color fg = new Color(time.getDisplay(), 0, 255, 0, 0);
time.setForeground(fg);
assertEquals(color, time.getBackground());
color.dispose();
fg.dispose();
time.dispose();
}
Aggregations