Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 124314 Details for
Bug 263081
[CSS] Need cascading order tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
new junits
test_patch.txt (text/plain), 5.12 KB, created by
Aghiles Abdesselam
on 2009-01-30 13:42:55 EST
(
hide
)
Description:
new junits
Filename:
MIME Type:
Creator:
Aghiles Abdesselam
Created:
2009-01-30 13:42:55 EST
Size:
5.12 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.e4.ui.tests.css.swt >Index: src/org/eclipse/e4/ui/tests/css/swt/CSSTestCase.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CSSTestCase.java,v >retrieving revision 1.1 >diff -u -r1.1 CSSTestCase.java >--- src/org/eclipse/e4/ui/tests/css/swt/CSSTestCase.java 17 Dec 2008 04:18:12 -0000 1.1 >+++ src/org/eclipse/e4/ui/tests/css/swt/CSSTestCase.java 30 Jan 2009 15:18:34 -0000 >@@ -1,6 +1,7 @@ > package org.eclipse.e4.ui.tests.css.swt; > > import java.io.IOException; >+import java.io.Reader; > import java.io.StringReader; > > import junit.framework.TestCase; >@@ -13,6 +14,10 @@ > public class CSSTestCase extends TestCase { > > public CSSEngine createEngine(String styleSheet, Display display) { >+ return createEngine(new StringReader(styleSheet), display); >+ } >+ >+ public CSSEngine createEngine(Reader reader, Display display) { > CSSEngine engine = new CSSSWTEngineImpl(display); > > engine.setErrorHandler(new CSSErrorHandler() { >@@ -22,7 +27,7 @@ > }); > > try { >- engine.parseStyleSheet(new StringReader(styleSheet)); >+ engine.parseStyleSheet(reader); > } catch (IOException e) { > fail(e.getMessage()); > } >Index: src/org/eclipse/e4/ui/tests/css/swt/CssSwtTestSuite.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CssSwtTestSuite.java,v >retrieving revision 1.5 >diff -u -r1.5 CssSwtTestSuite.java >--- src/org/eclipse/e4/ui/tests/css/swt/CssSwtTestSuite.java 14 Jan 2009 21:35:34 -0000 1.5 >+++ src/org/eclipse/e4/ui/tests/css/swt/CssSwtTestSuite.java 30 Jan 2009 15:18:34 -0000 >@@ -18,5 +18,7 @@ > addTestSuite(LabelTest.class); > addTestSuite(CTabFolderTest.class); > addTestSuite(IdClassLabelColorTest.class); >+ addTestSuite(Test.class); >+ addTestSuite(CssSelectorPrecedence.class); > } > } >Index: src/org/eclipse/e4/ui/tests/css/swt/CssSelectorPrecedence.java >=================================================================== >RCS file: src/org/eclipse/e4/ui/tests/css/swt/CssSelectorPrecedence.java >diff -N src/org/eclipse/e4/ui/tests/css/swt/CssSelectorPrecedence.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/e4/ui/tests/css/swt/CssSelectorPrecedence.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,79 @@ >+package org.eclipse.e4.ui.tests.css.swt; >+ >+import org.eclipse.e4.ui.css.core.engine.CSSEngine; >+import org.eclipse.e4.ui.css.swt.CSSSWTConstants; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.graphics.RGB; >+import org.eclipse.swt.layout.FillLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Shell; >+ >+ >+public class CssSelectorPrecedence extends CSSTestCase{ >+ >+ static final RGB RED = new RGB(255, 0, 0); >+ static final RGB BLUE = new RGB(0, 0, 255); >+ public Label labelToTest; >+ >+ protected Label labelToTest(String styleSheet) { >+ Display display = Display.getDefault(); >+ CSSEngine engine = createEngine(styleSheet, display); >+ >+ // Create widgets >+ Shell shell = new Shell(display, SWT.SHELL_TRIM); >+ FillLayout layout = new FillLayout(); >+ shell.setLayout(layout); >+ >+ Composite panel = new Composite(shell, SWT.NONE); >+ panel.setLayout(new FillLayout()); >+ >+ Label label = new Label(panel, SWT.NONE); >+ label.setText("Some label text"); >+ label.setData(CSSSWTConstants.CSS_ID_KEY, "labelTest"); >+ label.setData(CSSSWTConstants.CSS_CLASS_NAME_KEY, "labelTest"); >+ >+ >+ // Apply styles >+ engine.applyStyles(shell,true); >+ >+ shell.pack(); >+ shell.open(); >+ engine.applyStyles(labelToTest, true); >+ return label; >+ } >+ >+ >+ public void testRedundancy(){ >+ labelToTest = labelToTest("Label { background-color: #FF0000;} " + >+ "Label {background-color: #0000FF;} "); >+ assertEquals(BLUE, labelToTest.getBackground().getRGB()); >+ } >+ >+ public void testBug261018(){ >+ labelToTest = labelToTest("Button, Label {background-color: #FF0000;}" + >+ "Shell, Label {background-color: #0000FF;}"); >+ assertEquals(BLUE, labelToTest.getBackground().getRGB()); >+ } >+ >+ public void testWithClassNameAndID() { >+ labelToTest = labelToTest("Label { background-color: #FF0000; color: #0000FF} " + >+ "#labelTest {background-color: #0000FF;} "); >+ assertEquals(BLUE, labelToTest.getBackground().getRGB()); >+ } >+ >+ public void testWithClassNameAndPseudoClass() { >+ labelToTest = labelToTest("Label { background-color: #FF0000; color: #0000FF} " + >+ ".labelTest {background-color: #0000FF;} "); >+ assertEquals(BLUE, labelToTest.getBackground().getRGB()); >+ } >+ >+ public void testImportant(){ >+ labelToTest = labelToTest("Label {background-color: rgb(255,0,0);}" + >+ "Label { background-color: rgb(0,0,255) ! important;}" + >+ "Label {background-color: rgb(255,0,0);}"); >+ assertEquals(BLUE, labelToTest.getBackground().getRGB()); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 263081
:
124314
|
124581
|
125559