Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 282575 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyTextSWTHandler.java (-15 / +31 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008 Angelo Zerr and others.
2
 * Copyright (c) 2008, 2009 Angelo Zerr and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 16-21 Link Here
16
import org.eclipse.e4.ui.css.swt.CSSSWTConstants;
16
import org.eclipse.e4.ui.css.swt.CSSSWTConstants;
17
import org.eclipse.e4.ui.css.swt.helpers.SWTElementHelpers;
17
import org.eclipse.e4.ui.css.swt.helpers.SWTElementHelpers;
18
import org.eclipse.swt.custom.CTabFolder;
18
import org.eclipse.swt.custom.CTabFolder;
19
import org.eclipse.swt.custom.CTabItem;
19
import org.eclipse.swt.events.VerifyEvent;
20
import org.eclipse.swt.events.VerifyEvent;
20
import org.eclipse.swt.events.VerifyListener;
21
import org.eclipse.swt.events.VerifyListener;
21
import org.eclipse.swt.graphics.Color;
22
import org.eclipse.swt.graphics.Color;
Lines 23-28 Link Here
23
import org.eclipse.swt.widgets.Control;
24
import org.eclipse.swt.widgets.Control;
24
import org.eclipse.swt.widgets.Label;
25
import org.eclipse.swt.widgets.Label;
25
import org.eclipse.swt.widgets.Text;
26
import org.eclipse.swt.widgets.Text;
27
import org.eclipse.swt.widgets.Widget;
26
import org.w3c.dom.css.CSSValue;
28
import org.w3c.dom.css.CSSValue;
27
29
28
public class CSSPropertyTextSWTHandler extends AbstractCSSPropertyTextHandler {
30
public class CSSPropertyTextSWTHandler extends AbstractCSSPropertyTextHandler {
Lines 31-39 Link Here
31
33
32
	public boolean applyCSSProperty(Object element, String property,
34
	public boolean applyCSSProperty(Object element, String property,
33
			CSSValue value, String pseudo, CSSEngine engine) throws Exception {
35
			CSSValue value, String pseudo, CSSEngine engine) throws Exception {
34
		Control control = SWTElementHelpers.getControl(element);
36
		Widget widget = SWTElementHelpers.getWidget(element);
35
		if (control != null) {
37
		if (widget != null) {
36
			super.applyCSSProperty(control, property, value, pseudo, engine);
38
			super.applyCSSProperty(widget, property, value, pseudo, engine);
37
			return true;
39
			return true;
38
		}
40
		}
39
		return false;
41
		return false;
Lines 42-64 Link Here
42
44
43
	public String retrieveCSSProperty(Object element, String property,
45
	public String retrieveCSSProperty(Object element, String property,
44
			String pseudo, CSSEngine engine) throws Exception {
46
			String pseudo, CSSEngine engine) throws Exception {
45
		Control control = SWTElementHelpers.getControl(element);
47
		Widget widget = SWTElementHelpers.getWidget(element);
46
		if (control != null) {
48
		if (widget != null) {
47
			return super.retrieveCSSProperty(control, property, pseudo, engine);
49
			return super.retrieveCSSProperty(widget, property, pseudo, engine);
48
		}
50
		}
49
		return null;
51
		return null;
50
	}
52
	}
51
53
52
	public void applyCSSPropertyColor(Object element, CSSValue value,
54
	public void applyCSSPropertyColor(Object element, CSSValue value,
53
			String pseudo, CSSEngine engine) throws Exception {
55
			String pseudo, CSSEngine engine) throws Exception {
54
		Control control = (Control) element;
56
		Widget widget = (Widget) element;
55
		if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
57
		if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
56
			Color newColor = (Color) engine.convert(value, Color.class, control
58
			Color newColor = (Color) engine.convert(value, Color.class, widget
57
					.getDisplay());
59
					.getDisplay());
58
			if (control instanceof CTabFolder && "selected".equals(pseudo)) {
60
			if (widget instanceof CTabItem) {
59
				((CTabFolder) control).setSelectionForeground(newColor);
61
				CTabFolder folder = ((CTabItem) widget).getParent();
60
			} else {
62
				if ("selected".equals(pseudo)) {
61
				control.setForeground(newColor);
63
					folder.setSelectionForeground(newColor);
64
				} else {
65
					folder.setForeground(newColor);
66
				}
67
			} else if (widget instanceof Control) {
68
				((Control) widget).setForeground(newColor);
62
			}
69
			}
63
		}
70
		}
64
	}
71
	}
Lines 116-123 Link Here
116
123
117
	public String retrieveCSSPropertyColor(Object element, String pseudo,
124
	public String retrieveCSSPropertyColor(Object element, String pseudo,
118
			CSSEngine engine) throws Exception {
125
			CSSEngine engine) throws Exception {
119
		Control control = (Control) element;
126
		Widget widget = (Widget) element;
120
		Color color = control.getForeground();
127
		Color color = null;
128
		if (widget instanceof CTabItem) {
129
			if ("selected".equals(pseudo)) {
130
				color = ((CTabItem) widget).getParent().getSelectionForeground();	
131
			} else {
132
				color = ((CTabItem) widget).getParent().getForeground();
133
			}
134
		} else if (widget instanceof Control) {
135
			color = ((Control) widget).getForeground();	
136
		}
121
		return engine.convert(color, Color.class, null);
137
		return engine.convert(color, Color.class, null);
122
	}
138
	}
123
139
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java (-21 / +38 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008 Angelo Zerr and others.
2
 * Copyright (c) 2008, 2009 Angelo Zerr and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 19-28 Link Here
19
import org.eclipse.e4.ui.css.swt.helpers.SWTElementHelpers;
19
import org.eclipse.e4.ui.css.swt.helpers.SWTElementHelpers;
20
import org.eclipse.e4.ui.css.swt.properties.GradientBackgroundListener;
20
import org.eclipse.e4.ui.css.swt.properties.GradientBackgroundListener;
21
import org.eclipse.swt.custom.CTabFolder;
21
import org.eclipse.swt.custom.CTabFolder;
22
import org.eclipse.swt.custom.CTabItem;
22
import org.eclipse.swt.graphics.Color;
23
import org.eclipse.swt.graphics.Color;
23
import org.eclipse.swt.graphics.Image;
24
import org.eclipse.swt.graphics.Image;
24
import org.eclipse.swt.widgets.Button;
25
import org.eclipse.swt.widgets.Button;
25
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.swt.widgets.Control;
27
import org.eclipse.swt.widgets.Widget;
26
import org.w3c.dom.css.CSSValue;
28
import org.w3c.dom.css.CSSValue;
27
29
28
public class CSSPropertyBackgroundSWTHandler extends
30
public class CSSPropertyBackgroundSWTHandler extends
Lines 32-40 Link Here
32
34
33
	public boolean applyCSSProperty(Object element, String property,
35
	public boolean applyCSSProperty(Object element, String property,
34
			CSSValue value, String pseudo, CSSEngine engine) throws Exception {
36
			CSSValue value, String pseudo, CSSEngine engine) throws Exception {
35
		Control control = SWTElementHelpers.getControl(element);
37
		Widget widget = SWTElementHelpers.getWidget(element);
36
		if (control != null) {
38
		if (widget != null) {
37
			super.applyCSSProperty(control, property, value, pseudo, engine);
39
			super.applyCSSProperty(widget, property, value, pseudo, engine);
38
			return true;
40
			return true;
39
		}
41
		}
40
		return false;
42
		return false;
Lines 43-51 Link Here
43
45
44
	public String retrieveCSSProperty(Object element, String property,
46
	public String retrieveCSSProperty(Object element, String property,
45
			String pseudo, CSSEngine engine) throws Exception {
47
			String pseudo, CSSEngine engine) throws Exception {
46
		Control control = SWTElementHelpers.getControl(element);
48
		Widget widget = SWTElementHelpers.getWidget(element);
47
		if (control != null) {
49
		if (widget != null) {
48
			return super.retrieveCSSProperty(control, property, pseudo, engine);
50
			return super.retrieveCSSProperty(widget, property, pseudo, engine);
49
		}
51
		}
50
		return null;
52
		return null;
51
	}
53
	}
Lines 59-83 Link Here
59
	 */
61
	 */
60
	public void applyCSSPropertyBackgroundColor(Object element, CSSValue value,
62
	public void applyCSSPropertyBackgroundColor(Object element, CSSValue value,
61
			String pseudo, CSSEngine engine) throws Exception {
63
			String pseudo, CSSEngine engine) throws Exception {
62
		Control control = (Control) element;
64
		Widget widget = (Widget) element;
63
		if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
65
		if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
64
			Color newColor = (Color) engine.convert(value, Color.class, control
66
			Color newColor = (Color) engine.convert(value, Color.class, widget
65
					.getDisplay());
67
					.getDisplay());
66
			if (control instanceof CTabFolder && "selected".equals(pseudo)) {
68
			if (widget instanceof CTabItem) {
67
				((CTabFolder) control).setSelectionBackground(newColor);
69
				CTabFolder folder = ((CTabItem) widget).getParent();
68
			} else {
70
				if ("selected".equals(pseudo)) {
69
				control.setBackground(newColor);
71
					folder.setSelectionBackground(newColor);
72
				} else {
73
					folder.setBackground(newColor);
74
				}
75
			} else if (widget instanceof Control) {
76
				((Control) widget).setBackground(newColor);
70
			}
77
			}
71
		} else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
78
		} else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
72
			Gradient grad = (Gradient) engine.convert(value, Gradient.class,
79
			Gradient grad = (Gradient) engine.convert(value, Gradient.class,
73
					control.getDisplay());
80
					widget.getDisplay());
74
			if (control instanceof CTabFolder && "selected".equals(pseudo)) {
81
			if (widget instanceof CTabItem && "selected".equals(pseudo)) {
75
					((CTabFolder) control).setSelectionBackground(
82
				CTabFolder folder = ((CTabItem) widget).getParent();
76
							CSSSWTColorHelper.getSWTColors(grad, control.getDisplay()),
83
					folder.setSelectionBackground(
84
							CSSSWTColorHelper.getSWTColors(grad, folder.getDisplay()),
77
							CSSSWTColorHelper.getPercents(grad),
85
							CSSSWTColorHelper.getPercents(grad),
78
							true);
86
							true);
79
			} else {
87
			} else if (widget instanceof Control) {
80
				GradientBackgroundListener.handle(control, grad);
88
				GradientBackgroundListener.handle((Control) widget, grad);
81
			}
89
			}
82
		}
90
		}
83
	}
91
	}
Lines 121-128 Link Here
121
129
122
	public String retrieveCSSPropertyBackgroundColor(Object element,
130
	public String retrieveCSSPropertyBackgroundColor(Object element,
123
			String pseudo, CSSEngine engine) throws Exception {
131
			String pseudo, CSSEngine engine) throws Exception {
124
		Control control = (Control) element;
132
		Widget widget = (Widget) element;
125
		Color color = control.getBackground();
133
		Color color = null;
134
		if (widget instanceof CTabItem) {
135
			if ("selected".equals(pseudo)) {
136
				color = ((CTabItem) widget).getParent().getSelectionBackground();	
137
			} else {
138
				color = ((CTabItem) widget).getParent().getBackground();				
139
			}
140
		} else if (widget instanceof Control) {
141
			color = ((Control) widget).getBackground();	
142
		}
126
		return engine.convert(color, Color.class, null);
143
		return engine.convert(color, Color.class, null);
127
	}
144
	}
128
145
(-)src/org/eclipse/e4/ui/tests/css/swt/CTabFolderTest.java (-10 lines)
Lines 72-87 Link Here
72
		assertEquals(BLUE, folderToTest.getForeground().getRGB());
72
		assertEquals(BLUE, folderToTest.getForeground().getRGB());
73
	}
73
	}
74
74
75
	public void testSelectedPseudo() throws Exception {
76
		CTabFolder folderToTest = createTestCTabFolder(
77
				"CTabFolder { color: #FFFFFF; background-color: #0000FF }\n" +
78
				"CTabFolder:selected { color: #FF0000;  background-color: #00FF00 }");
79
		assertEquals(WHITE, folderToTest.getForeground().getRGB());
80
		assertEquals(BLUE, folderToTest.getBackground().getRGB());
81
		assertEquals(RED, folderToTest.getSelectionForeground().getRGB());
82
		assertEquals(GREEN, folderToTest.getSelectionBackground().getRGB());
83
	}
84
85
	//See GradientTest for testing background gradient
75
	//See GradientTest for testing background gradient
86
76
87
	public void testFontRegular() throws Exception {
77
	public void testFontRegular() throws Exception {
(-)src/org/eclipse/e4/ui/tests/css/swt/GradientTest.java (-10 / +10 lines)
Lines 60-73 Link Here
60
	
60
	
61
	public void testGradients() throws Exception {
61
	public void testGradients() throws Exception {
62
		CTabFolder folderToTest = createTestCTabFolder(
62
		CTabFolder folderToTest = createTestCTabFolder(
63
				"CTabFolder:selected { background-color: #FF0000 #0000FF}");
63
				"CTabItem:selected { background-color: #FF0000 #0000FF}");
64
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
64
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
65
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
65
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
66
	}
66
	}
67
	
67
	
68
	public void testDefaultPercents() throws Exception {
68
	public void testDefaultPercents() throws Exception {
69
		CTabFolder folderToTest = createTestCTabFolder(
69
		CTabFolder folderToTest = createTestCTabFolder(
70
				"CTabFolder:selected { background-color: #FF0000 #0000FF}");
70
				"CTabItem:selected { background-color: #FF0000 #0000FF}");
71
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
71
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
72
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
72
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
73
		assertEquals(new int[] {100}, getSelectionGradientPercents(folderToTest)); //default percent
73
		assertEquals(new int[] {100}, getSelectionGradientPercents(folderToTest)); //default percent
Lines 75-93 Link Here
75
75
76
	public void testDefaultManyPercents() throws Exception {
76
	public void testDefaultManyPercents() throws Exception {
77
		CTabFolder folderToTest = createTestCTabFolder(
77
		CTabFolder folderToTest = createTestCTabFolder(
78
				"CTabFolder:selected { background-color: red green blue yellow}");
78
				"CTabItem:selected { background-color: red green blue yellow}");
79
		assertEquals(new int[] {33, 67, 100}, getSelectionGradientPercents(folderToTest)); //default percent
79
		assertEquals(new int[] {33, 67, 100}, getSelectionGradientPercents(folderToTest)); //default percent
80
	}
80
	}
81
	
81
	
82
	public void testSpecifiedPercents() throws Exception {
82
	public void testSpecifiedPercents() throws Exception {
83
		CTabFolder folderToTest = createTestCTabFolder(
83
		CTabFolder folderToTest = createTestCTabFolder(
84
				"CTabFolder:selected { background-color: #FF0000 #0000FF 53%}");
84
				"CTabItem:selected { background-color: #FF0000 #0000FF 53%}");
85
		assertEquals(new int[] {53}, getSelectionGradientPercents(folderToTest)); 
85
		assertEquals(new int[] {53}, getSelectionGradientPercents(folderToTest)); 
86
	}
86
	}
87
87
88
	public void testManyColorsAndSpecifiedManyPercents() throws Exception {
88
	public void testManyColorsAndSpecifiedManyPercents() throws Exception {
89
		CTabFolder folderToTest = createTestCTabFolder(
89
		CTabFolder folderToTest = createTestCTabFolder(
90
				"CTabFolder:selected { background-color: #FF0000 #00FF00 #0000FF 22% 44%}");
90
				"CTabItem:selected { background-color: #FF0000 #00FF00 #0000FF 22% 44%}");
91
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
91
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
92
		assertEquals(GREEN, getSelectionBackground(folderToTest, 1).getRGB()); //2nd gradient 
92
		assertEquals(GREEN, getSelectionBackground(folderToTest, 1).getRGB()); //2nd gradient 
93
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
93
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
Lines 100-106 Link Here
100
	public void testBadPercents() throws Exception {
100
	public void testBadPercents() throws Exception {
101
		//There should be either zero or three percent declarations, otherwise it acts as default
101
		//There should be either zero or three percent declarations, otherwise it acts as default
102
		CTabFolder folderToTest = createTestCTabFolder(
102
		CTabFolder folderToTest = createTestCTabFolder(
103
				"CTabFolder:selected { background-color: red green blue yellow 10%}");
103
				"CTabItem:selected { background-color: red green blue yellow 10%}");
104
		assertEquals(new int[] {33, 67, 100}, getSelectionGradientPercents(folderToTest)); //default percent
104
		assertEquals(new int[] {33, 67, 100}, getSelectionGradientPercents(folderToTest)); //default percent
105
	}
105
	}
106
106
Lines 110-116 Link Here
110
	 */
110
	 */
111
	public void testBadColors() throws Exception {
111
	public void testBadColors() throws Exception {
112
		CTabFolder folderToTest = createTestCTabFolder(
112
		CTabFolder folderToTest = createTestCTabFolder(
113
				"CTabFolder:selected { background-color: #FF0000 notAColor #0000FF}");
113
				"CTabItem:selected { background-color: #FF0000 notAColor #0000FF}");
114
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
114
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
115
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
115
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
116
		assertEquals(new int[] {100}, getSelectionGradientPercents(folderToTest)); //default percent
116
		assertEquals(new int[] {100}, getSelectionGradientPercents(folderToTest)); //default percent
Lines 121-127 Link Here
121
	 */
121
	 */
122
	public void testAboveRangePercents() throws Exception {
122
	public void testAboveRangePercents() throws Exception {
123
		CTabFolder folderToTest = createTestCTabFolder(
123
		CTabFolder folderToTest = createTestCTabFolder(
124
				"CTabFolder:selected { background-color: #FF0000 #00FF00 #0000FF 20% 110%}");
124
				"CTabItem:selected { background-color: #FF0000 #00FF00 #0000FF 20% 110%}");
125
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
125
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
126
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
126
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
127
		assertEquals(new int[] {50, 100}, getSelectionGradientPercents(folderToTest)); //default percent
127
		assertEquals(new int[] {50, 100}, getSelectionGradientPercents(folderToTest)); //default percent
Lines 132-138 Link Here
132
	 */
132
	 */
133
	public void testBelowRangePercents() throws Exception {
133
	public void testBelowRangePercents() throws Exception {
134
		CTabFolder folderToTest = createTestCTabFolder(
134
		CTabFolder folderToTest = createTestCTabFolder(
135
				"CTabFolder:selected { background-color: #FF0000 #00FF00 #0000FF -20% 50%}");
135
				"CTabItem:selected { background-color: #FF0000 #00FF00 #0000FF -20% 50%}");
136
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
136
		assertEquals(RED, getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
137
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
137
		assertEquals(BLUE, folderToTest.getSelectionBackground().getRGB()); //gradient end
138
		assertEquals(new int[] {50, 100}, getSelectionGradientPercents(folderToTest)); //default percent
138
		assertEquals(new int[] {50, 100}, getSelectionGradientPercents(folderToTest)); //default percent
Lines 147-153 Link Here
147
	 */
147
	 */
148
	public void testAltSyntax() throws Exception {
148
	public void testAltSyntax() throws Exception {
149
		CTabFolder folderToTest = createTestCTabFolder(
149
		CTabFolder folderToTest = createTestCTabFolder(
150
				"CTabFolder:selected { background-color: gradient, rgb(140,140,140), rgb(48,48,48), 100%;");
150
				"CTabItem:selected { background-color: gradient, rgb(140,140,140), rgb(48,48,48), 100%;");
151
		assertEquals(new RGB(140,140,140), getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
151
		assertEquals(new RGB(140,140,140), getSelectionBackgroundBegin(folderToTest).getRGB()); //gradient begin		
152
		assertEquals(new RGB(48,48,48), folderToTest.getSelectionBackground().getRGB()); //gradient end
152
		assertEquals(new RGB(48,48,48), folderToTest.getSelectionBackground().getRGB()); //gradient end
153
		assertEquals(new int[] {100}, getSelectionGradientPercents(folderToTest)); //default percent
153
		assertEquals(new int[] {100}, getSelectionGradientPercents(folderToTest)); //default percent
(-)src/org/eclipse/e4/ui/tests/css/swt/CTabItemTest.java (+43 lines)
Lines 16-21 Link Here
16
import org.eclipse.swt.custom.CTabFolder;
16
import org.eclipse.swt.custom.CTabFolder;
17
import org.eclipse.swt.custom.CTabItem;
17
import org.eclipse.swt.custom.CTabItem;
18
import org.eclipse.swt.graphics.FontData;
18
import org.eclipse.swt.graphics.FontData;
19
import org.eclipse.swt.graphics.RGB;
19
import org.eclipse.swt.layout.FillLayout;
20
import org.eclipse.swt.layout.FillLayout;
20
import org.eclipse.swt.widgets.Button;
21
import org.eclipse.swt.widgets.Button;
21
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Composite;
Lines 538-541 Link Here
538
			}
539
			}
539
		}
540
		}
540
	}
541
	}
542
543
	public void testBackground() throws Exception {
544
		CTabFolder folder = createTestTabFolder("CTabItem { background-color: #0000ff }");
545
		assertEquals(new RGB(0, 0, 255), folder.getBackground().getRGB());
546
547
		for (int i = 0; i < folder.getItemCount(); i++) {
548
			assertEquals("#0000ff", engine.retrieveCSSProperty(folder
549
					.getItem(i), "background-color", null));
550
		}
551
	}
552
553
	public void testSelectionBackground() throws Exception {
554
		CTabFolder folder = createTestTabFolder("CTabItem:selected { background-color: #00ff00 }");
555
		assertEquals(new RGB(0, 255, 0), folder.getSelectionBackground()
556
				.getRGB());
557
558
		for (int i = 0; i < folder.getItemCount(); i++) {
559
			assertEquals("#00ff00", engine.retrieveCSSProperty(folder
560
					.getItem(i), "background-color", "selected"));
561
		}
562
	}
563
564
	public void testForeground() throws Exception {
565
		CTabFolder folder = createTestTabFolder("CTabItem { color: #0000ff }");
566
		assertEquals(new RGB(0, 0, 255), folder.getForeground().getRGB());
567
568
		for (int i = 0; i < folder.getItemCount(); i++) {
569
			assertEquals("#0000ff", engine.retrieveCSSProperty(folder
570
					.getItem(i), "color", null));
571
		}
572
	}
573
574
	public void testSelectionForeground() throws Exception {
575
		CTabFolder folder = createTestTabFolder("CTabItem:selected { color: #00ff00 }");
576
		assertEquals(new RGB(0, 255, 0), folder.getSelectionForeground()
577
				.getRGB());
578
579
		for (int i = 0; i < folder.getItemCount(); i++) {
580
			assertEquals("#00ff00", engine.retrieveCSSProperty(folder
581
					.getItem(i), "color", "selected"));
582
		}
583
	}
541
}
584
}

Return to bug 282575