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 124581 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]
additional tests for the css junits
test_patch.txt (text/plain), 5.89 KB, created by
Aghiles Abdesselam
on 2009-02-03 13:06:52 EST
(
hide
)
Description:
additional tests for the css junits
Filename:
MIME Type:
Creator:
Aghiles Abdesselam
Created:
2009-02-03 13:06:52 EST
Size:
5.89 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.e4.ui.tests.css.core >Index: src/org/eclipse/e4/ui/tests/css/core/parser/StyleRuleTest.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/parser/StyleRuleTest.java,v >retrieving revision 1.2 >diff -u -r1.2 StyleRuleTest.java >--- src/org/eclipse/e4/ui/tests/css/core/parser/StyleRuleTest.java 31 Jan 2009 21:38:19 -0000 1.2 >+++ src/org/eclipse/e4/ui/tests/css/core/parser/StyleRuleTest.java 3 Feb 2009 17:02:36 -0000 >@@ -77,4 +77,62 @@ > String colorString = ((CSSPrimitiveValue) value).getStringValue(); > assertEquals("Verdana", colorString); > } >+ >+ public void testTestFontItalic() throws Exception { >+ String css = "Label { font: Arial 12px; font-style: italic }"; >+ CSSStyleSheet styleSheet = ParserTestUtil.parseCss(css); >+ CSSRuleList rules = styleSheet.getCssRules(); >+ CSSRule rule = rules.item(0); >+ assertEquals(CSSRule.STYLE_RULE, rule.getType()); >+ CSSStyleDeclaration style = ((CSSStyleRule) rule).getStyle(); >+ CSSValue value = style.getPropertyCSSValue("font-style"); >+ assertTrue(value instanceof CSSPrimitiveValue); >+ String colorString = ((CSSPrimitiveValue) value).getStringValue(); >+ assertEquals("italic", colorString); >+ } >+ >+ public void testTestFontBold() throws Exception{ >+ String css = "Label { font: Arial 12px; font-style: bold }"; >+ CSSStyleSheet styleSheet = ParserTestUtil.parseCss(css); >+ CSSRuleList rules = styleSheet.getCssRules(); >+ CSSRule rule = rules.item(0); >+ assertEquals(CSSRule.STYLE_RULE, rule.getType()); >+ CSSStyleDeclaration style = ((CSSStyleRule) rule).getStyle(); >+ CSSValue value = style.getPropertyCSSValue("font-style"); >+ assertTrue(value instanceof CSSPrimitiveValue); >+ String colorString = ((CSSPrimitiveValue) value).getStringValue(); >+ assertEquals("bold", colorString); >+ } >+ >+ >+ public void testBackgroundNameColor() throws Exception{ >+ String css = "Label { background-color: green }"; >+ CSSStyleSheet styleSheet = ParserTestUtil.parseCss(css); >+ CSSRuleList rules = styleSheet.getCssRules(); >+ CSSRule rule = rules.item(0); >+ assertEquals(CSSRule.STYLE_RULE, rule.getType()); >+ CSSStyleDeclaration style = ((CSSStyleRule) rule).getStyle(); >+ CSSValue value = style.getPropertyCSSValue("background-color"); >+ assertTrue(value instanceof CSSPrimitiveValue); >+ String colorString = ((CSSPrimitiveValue) value).getStringValue(); >+ assertEquals("green", colorString); >+ } >+ >+ public void testBackgroundHexColor() throws Exception { >+ String css = "Label { background-color: #FF0220 }"; >+ CSSStyleSheet styleSheet = ParserTestUtil.parseCss(css); >+ CSSRuleList rules = styleSheet.getCssRules(); >+ CSSRule rule = rules.item(0); >+ assertEquals(CSSRule.STYLE_RULE, rule.getType()); >+ CSSStyleDeclaration style = ((CSSStyleRule) rule).getStyle(); >+ CSSValue value = style.getPropertyCSSValue("background-color"); >+ assertTrue(value instanceof CSSPrimitiveValue); >+ RGBColor colorValue = ((CSSPrimitiveValue) value).getRGBColorValue(); >+ assertEquals(255.0f, colorValue.getRed().getFloatValue( >+ CSSPrimitiveValue.CSS_NUMBER), 0f); >+ assertEquals(2.0f, colorValue.getGreen().getFloatValue( >+ CSSPrimitiveValue.CSS_NUMBER), 0f); >+ assertEquals(32.0f, colorValue.getBlue().getFloatValue( >+ CSSPrimitiveValue.CSS_NUMBER), 0f); >+ } > } >Index: src/org/eclipse/e4/ui/tests/css/core/parser/CascadeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/parser/CascadeTest.java,v >retrieving revision 1.1 >diff -u -r1.1 CascadeTest.java >--- src/org/eclipse/e4/ui/tests/css/core/parser/CascadeTest.java 31 Jan 2009 21:38:19 -0000 1.1 >+++ src/org/eclipse/e4/ui/tests/css/core/parser/CascadeTest.java 3 Feb 2009 17:02:36 -0000 >@@ -44,8 +44,7 @@ > TestElement button = new TestElement("Button", engine); > CSSStyleDeclaration style = viewCSS.getComputedStyle(button, null); > assertEquals("black", style.getPropertyCSSValue("color").getCssText()); >- assertEquals("bold", style.getPropertyCSSValue("font-weight") >- .getCssText()); >+ assertEquals("bold", style.getPropertyCSSValue("font-weight").getCssText()); > } > > public void testSpecificity() throws Exception { >@@ -95,6 +94,34 @@ > style = viewCSS.getComputedStyle(button, null); > assertEquals("red", style.getPropertyCSSValue("color").getCssText()); > } >+ >+ public void testImportantRule() throws Exception { >+ //Several rules for the same class, if one rule has ! important >+ //it takes precedence over all other, if more than one >+ //last one gets precedence >+ >+ String css = "Button{color:red ! important;}\n" >+ +"Button{ color: blue ! important;}\n" >+ + "Button { color: black }\n"; >+ ViewCSS viewCSS = createViewCss(css); >+ >+ TestElement button = new TestElement("Button", engine); >+ CSSStyleDeclaration style = viewCSS.getComputedStyle(button, null); >+ assertEquals("blue", style.getPropertyCSSValue("color").getCssText()); >+ } >+ >+ public void testBug261081() throws Exception{ >+ // Two rules with the same specificity, the second rule should take >+ // precedence because of its position in the stylesheet >+ String css = "Button, Label { color: blue; font-weight: bold; }\n" >+ + "Button { color: black }\n"; >+ ViewCSS viewCSS = createViewCss(css); >+ >+ TestElement button = new TestElement("Button", engine); >+ CSSStyleDeclaration style = viewCSS.getComputedStyle(button, null); >+ assertEquals("black", style.getPropertyCSSValue("color").getCssText()); >+ assertEquals("bold", style.getPropertyCSSValue("font-weight").getCssText()); >+ } > > private static ViewCSS createViewCss(String css) throws IOException { > CSSStyleSheet styleSheet = ParserTestUtil.parseCss(css);
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