You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cz...@apache.org on 2012/12/02 11:43:10 UTC
svn commit: r1416151 -
/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/
Author: czadra
Date: Sun Dec 2 10:43:08 2012
New Revision: 1416151
URL: http://svn.apache.org/viewvc?rev=1416151&view=rev
Log:
added new css tests for Combinator, Document and MediaQueryCondition
Added:
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSCombinatorTests.java (with props)
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSDocumentTests.java (with props)
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSMediaQueryConditionTests.java (with props)
Modified:
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSArrayPropertyValueTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSColorPropertyValueTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSFontFaceTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSFunctionCallPropertyValueTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSKeywordPropertyValueTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSNamespaceDefinitionTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSNumberPropertyValueTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSPropertyTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSRuleTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSSelectorConditionTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSSelectorTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSStringPropertyValueTests.java
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSArrayPropertyValueTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSArrayPropertyValueTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSArrayPropertyValueTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSArrayPropertyValueTests.java Sun Dec 2 10:43:08 2012
@@ -52,14 +52,14 @@ public class CSSArrayPropertyValueTests
{
String code = " fillColor: #FFFFFF, #CCCCCC, #FFFFFF, #EEEEEE;";
- List<CSSArrayPropertyValue> nodes = getCSSArrayPropertyValues(code);
- assertThat("nodes size" , nodes.size(), is(1) );
+ List<CSSArrayPropertyValue> arrayPropertyValues = getCSSArrayPropertyValues(code);
+ assertThat("arrayPropertyValues.size()" , arrayPropertyValues.size(), is(1) );
- CSSArrayPropertyValue propertyValue = nodes.get(0);
- assertThat("getElements" , propertyValue.getElements().size(), is( 4) );
+ CSSArrayPropertyValue arrayPropertyValue = arrayPropertyValues.get(0);
+ assertThat("colorPropertyValue.getOperator()" , arrayPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
+ assertThat("arrayPropertyValue.getElements().size()" , arrayPropertyValue.getElements().size(), is( 4) );
-
- ImmutableList<? extends ICSSPropertyValue> elements = propertyValue.getElements();
+ ImmutableList<? extends ICSSPropertyValue> elements = arrayPropertyValue.getElements();
assertThat("element 0" , ((CSSColorPropertyValue)elements.get(0)).getText() , is( "#FFFFFF" ) );
assertThat("element 1" , ((CSSColorPropertyValue)elements.get(1)).getText() , is( "#CCCCCC" ) );
assertThat("element 2" , ((CSSColorPropertyValue)elements.get(2)).getText() , is( "#FFFFFF" ) );
@@ -71,13 +71,14 @@ public class CSSArrayPropertyValueTests
{
String code = " fillColor: #FFFFFF, 'String', Red, 0, Embed('image.gif'), bold; ";
- List<CSSArrayPropertyValue> nodes = getCSSArrayPropertyValues(code);
- assertThat("nodes size" , nodes.size(), is(1) );
+ List<CSSArrayPropertyValue> arrayPropertyValues = getCSSArrayPropertyValues(code);
+ assertThat("arrayPropertyValues.size()" , arrayPropertyValues.size(), is(1) );
- CSSArrayPropertyValue propertyValue = nodes.get(0);
- assertThat("getElements" , propertyValue.getElements().size(), is( 6 ) );
+ CSSArrayPropertyValue arrayPropertyValue = arrayPropertyValues.get(0);
+ assertThat("arrayPropertyValue.getOperator()" , arrayPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
+ assertThat("arrayPropertyValue.getElements().size()" , arrayPropertyValue.getElements().size(), is( 6 ) );
- ImmutableList<? extends ICSSPropertyValue> elements = propertyValue.getElements();
+ ImmutableList<? extends ICSSPropertyValue> elements = arrayPropertyValue.getElements();
assertThat("element 0" , ((CSSColorPropertyValue)elements.get(0)).getText() , is( "#FFFFFF" ) );
assertThat("element 1" , ((CSSStringPropertyValue)elements.get(1)).getValue() , is( "String" ) );
assertThat("element 2" , ((CSSColorPropertyValue)elements.get(2)).getText() , is( "Red" ) );
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSColorPropertyValueTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSColorPropertyValueTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSColorPropertyValueTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSColorPropertyValueTests.java Sun Dec 2 10:43:08 2012
@@ -54,6 +54,7 @@ public class CSSColorPropertyValueTests
assertThat("colorProperties.size()" , colorProperties.size(), is(1) );
CSSColorPropertyValue colorPropertyValue = colorProperties.get(0);
+ assertThat("colorPropertyValue.getOperator()" , colorPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("colorPropertyValue.getText()" , colorPropertyValue.getText(), is( "blue" ) );
assertThat("colorPropertyValue.getColorAsInt()" , colorPropertyValue.getColorAsInt(), is( 255 ) );
}
@@ -76,6 +77,7 @@ public class CSSColorPropertyValueTests
assertThat("colorProperties.size()" , colorProperties.size(), is(1) );
CSSColorPropertyValue colorPropertyValue = colorProperties.get(0);
+ assertThat("colorPropertyValue.getOperator()" , colorPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("colorPropertyValue.getText()" , colorPropertyValue.getText(), is( "RED" ) );
assertThat("colorPropertyValue.getColorAsInt()" , colorPropertyValue.getColorAsInt(), is( 16711680 ) );
}
@@ -89,6 +91,7 @@ public class CSSColorPropertyValueTests
assertThat("colorProperties.size()" , colorProperties.size(), is(1) );
CSSColorPropertyValue colorPropertyValue = colorProperties.get(0);
+ assertThat("colorPropertyValue.getOperator()" , colorPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("colorPropertyValue.getText()" , colorPropertyValue.getText(), is( "#FF0000" ) );
assertThat("colorPropertyValue.getColorAsInt()" , colorPropertyValue.getColorAsInt(), is( 16711680 ) );
}
Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSCombinatorTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSCombinatorTests.java?rev=1416151&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSCombinatorTests.java (added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSCombinatorTests.java Sun Dec 2 10:43:08 2012
@@ -0,0 +1,106 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.css;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.apache.flex.compiler.css.CombinatorType;
+import org.apache.flex.compiler.css.ICSSCombinator;
+import org.apache.flex.compiler.css.ICSSDocument;
+import org.apache.flex.compiler.css.ICSSSelector;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link CSSCombinator}.
+ *
+ * @author Gordon Smith
+ */
+public class CSSCombinatorTests extends CSSBaseTests {
+
+ private String getPostfix()
+ {
+ return " { } ";
+ }
+
+ @Override
+ public ICSSDocument getCSSNodeBase(String code) {
+ return super.getCSSNodeBase(code + getPostfix());
+ }
+
+
+ protected CSSCombinator getCSSCombinator(String code) {
+ List<ICSSSelector> selectors = getCSSSelectors( code );
+ assertThat("selectors", selectors, not( (List<ICSSSelector>) null) );
+ assertThat("selectors.size()", selectors.size(), is( 1 ) );
+
+ ICSSSelector selector = selectors.get(0);
+ assertThat("selector", selector, not( (ICSSSelector) null) );
+
+ return (CSSCombinator) selector.getCombinator();
+ }
+
+
+ @Test
+ public void CSSSelectorConditionTests_descendant_combinator1()
+ {
+ String code = " s|VBox s|Label ";
+
+ CSSCombinator combinator = getCSSCombinator(code);
+ //TODO why CSSCombinator doesn't extend CSSNodeBase??
+ //assertThat("combinator.getOperator()" , combinator.getOperator(), is( CSSModelTreeType.COMBINATOR ) );
+ assertThat("combinator.getCombinatorType()" , combinator.getCombinatorType(), is(CombinatorType.DESCENDANT) );
+ assertThat("combinator.getSelector()" , combinator.getSelector(), not( (ICSSSelector) null) );
+
+ ICSSSelector selector = combinator.getSelector();
+ assertThat("selector.getElementName()" , selector.getElementName(), is( "VBox" ) );
+ assertThat("selector.getNamespacePrefix()" , selector.getNamespacePrefix(), is( "s" ) );
+ assertThat("selector.getCombinator()" , selector.getCombinator(), is( (ICSSCombinator) null) );
+ }
+
+ @Test
+ public void CSSSelectorConditionTests_descendant_combinator2()
+ {
+ String code = " s|VBox s|HBox s|Label";
+
+ CSSCombinator combinator = getCSSCombinator(code);
+ assertThat("combinator.getCombinatorType()" , combinator.getCombinatorType(), is(CombinatorType.DESCENDANT) );
+ assertThat("combinator.getSelector()" , combinator.getSelector(), not( (ICSSSelector) null) );
+
+ ICSSSelector selector1 = combinator.getSelector();
+ assertThat("selector1.getElementName()" , selector1.getElementName(), is( "HBox" ) );
+ assertThat("selector1.getNamespacePrefix()" , selector1.getNamespacePrefix(), is( "s" ) );
+ assertThat("selector1.getCombinator()" , selector1.getCombinator(), not( (ICSSCombinator) null) );
+ assertThat("selector1.getCombinator().getSelector()" , selector1.getCombinator().getSelector(), not( (ICSSSelector) null) );
+
+
+ ICSSSelector selector2 = selector1.getCombinator().getSelector();
+ assertThat("selector2.getElementName()" , selector2.getElementName(), is( "VBox" ) );
+ assertThat("selector2.getNamespacePrefix()" , selector2.getNamespacePrefix(), is( "s" ) );
+ assertThat("selector2.getCombinator()" , selector2.getCombinator(), is( (ICSSCombinator) null) );
+
+
+ }
+
+
+}
Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSCombinatorTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSDocumentTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSDocumentTests.java?rev=1416151&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSDocumentTests.java (added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSDocumentTests.java Sun Dec 2 10:43:08 2012
@@ -0,0 +1,190 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.css;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.apache.flex.compiler.css.ICSSNamespaceDefinition;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link CSSDocument}.
+ *
+ * @author Gordon Smith
+ */
+public class CSSDocumentTests extends CSSBaseTests {
+
+ private static final String EOL = "\n\t\t";
+
+ @Test
+ public void CSSDocumentTests_namespaces()
+ {
+ String code =
+ " @namespace s \"library://ns.adobe.com/flex/spark\";" + EOL +
+ " @namespace mx \"library://ns.adobe.com/flex/mx\";";
+
+ CSSDocument cssDoc = (CSSDocument) getCSSNodeBase(code);
+ assertThat("cssDoc" , cssDoc, not( (CSSDocument) null ) );
+ assertThat("cssDoc" , cssDoc.getOperator(), is( CSSModelTreeType.DOCUMENT ) );
+
+ assertThat("cssDoc.getAtNamespaces().size()" , cssDoc.getAtNamespaces().size(), is( 2 ) );
+ CSSNamespaceDefinition defaultNamespaceDefinition = (CSSNamespaceDefinition) cssDoc.getDefaultNamespaceDefinition();
+ assertNull("defaultNamespaceDefinition not null" , defaultNamespaceDefinition );
+ assertThat("cssDoc.getNamespaceDefinition(\"s\")" , cssDoc.getNamespaceDefinition("s"), not( (ICSSNamespaceDefinition) null ) );
+ assertThat("cssDoc.getNamespaceDefinition(\"mxm\")" , cssDoc.getNamespaceDefinition("mxm"), is( (ICSSNamespaceDefinition) null ) );
+
+ }
+
+ @Test
+ public void CSSDocumentTests_defaultnamespaces()
+ {
+ String code = " @namespace \"library://ns.adobe.com/flex/spark\"; ";
+
+ CSSDocument cssDoc = (CSSDocument) getCSSNodeBase(code);
+ assertThat("cssDoc" , cssDoc, not( (CSSDocument) null ) );
+ assertThat("cssDoc.getOperator()" , cssDoc.getOperator(), is( CSSModelTreeType.DOCUMENT ) );
+
+ assertThat("cssDoc.getAtNamespaces().size()" , cssDoc.getAtNamespaces().size(), is( 1 ) );
+ CSSNamespaceDefinition defaultNamespaceDefinition = (CSSNamespaceDefinition) cssDoc.getDefaultNamespaceDefinition();
+ assertNotNull("defaultNamespaceDefinition is null" , defaultNamespaceDefinition );
+ assertThat("defaultNamespaceDefinition.getPrefix()" , defaultNamespaceDefinition.getPrefix(), is( (String) null ) );
+ assertThat("defaultNamespaceDefinition.getURI()" , defaultNamespaceDefinition.getURI(), is( "library://ns.adobe.com/flex/spark" ) );
+
+ CSSTypedNode namespaceList = (CSSTypedNode) cssDoc.children.get(0);
+ assertThat("namespaceList.getOperator()", namespaceList.getOperator(), is( CSSModelTreeType.NAMESPACE_LIST ) );
+ assertThat("namespaceList.children.size()", namespaceList.children.size(), is( 1 ) );
+ CSSTypedNode fontFaceList = (CSSTypedNode) cssDoc.children.get(1);
+ assertThat("fontFaceList.getOperator()", fontFaceList.getOperator(), is( CSSModelTreeType.FONT_FACE_LIST ) );
+ assertThat("fontFaceList.children.size()", fontFaceList.children.size(), is( 0 ) );
+ CSSTypedNode ruleList = (CSSTypedNode) cssDoc.children.get(2);
+ assertThat("ruleList.getOperator()", ruleList.getOperator(), is( CSSModelTreeType.RULE_LIST ) );
+ assertThat("ruleList.children.size()", ruleList.children.size(), is( 0 ) );
+ }
+
+ @Test
+ public void CSSDocumentTests_fontfaces()
+ {
+ String code =
+ "@font-faces { " + EOL +
+ " src: url('font.ttf'); " + EOL +
+ " fontFamily: 'font'; " + EOL +
+ "}" + EOL +
+ "@font-faces { " + EOL +
+ " src: url('font1.ttf'); " + EOL +
+ " fontFamily: 'font1'; " + EOL +
+ "}";
+
+ CSSDocument cssDoc = (CSSDocument) getCSSNodeBase(code);
+ assertThat("cssDoc" , cssDoc, not( (CSSDocument) null ) );
+ assertThat("cssDoc.getOperator()" , cssDoc.getOperator(), is( CSSModelTreeType.DOCUMENT ) );
+ assertThat("cssDoc.getFontFaces().size())" , cssDoc.getFontFaces().size(), is( 2 ) );
+
+ CSSTypedNode namespaceList = (CSSTypedNode) cssDoc.children.get(0);
+ assertThat("namespaceList.getOperator()", namespaceList.getOperator(), is( CSSModelTreeType.NAMESPACE_LIST ) );
+ assertThat("namespaceList.children.size()", namespaceList.children.size(), is( 0 ) );
+ CSSTypedNode fontFaceList = (CSSTypedNode) cssDoc.children.get(1);
+ assertThat("fontFaceList.getOperator()", fontFaceList.getOperator(), is( CSSModelTreeType.FONT_FACE_LIST ) );
+ assertThat("fontFaceList.children.size()", fontFaceList.children.size(), is( 2 ) );
+ CSSTypedNode ruleList = (CSSTypedNode) cssDoc.children.get(2);
+ assertThat("ruleList.getOperator()", ruleList.getOperator(), is( CSSModelTreeType.RULE_LIST ) );
+ assertThat("ruleList.children.size()", ruleList.children.size(), is( 0 ) );
+ }
+
+ @Test
+ public void CSSDocumentTests_rules()
+ {
+ String code =
+ "s|Label { " + EOL +
+ " fontFamily: 'font'; " + EOL +
+ "}" + EOL +
+ "s|Label.test { " + EOL +
+ " fontFamily: 'font1'; " + EOL +
+ "}";
+
+ CSSDocument cssDoc = (CSSDocument) getCSSNodeBase(code);
+ assertThat("cssDoc" , cssDoc, not( (CSSDocument) null ) );
+ assertThat("cssDoc.getOperator()" , cssDoc.getOperator(), is( CSSModelTreeType.DOCUMENT ) );
+ assertThat("cssDoc.getRules().size())" , cssDoc.getRules().size(), is( 2 ) );
+
+ CSSTypedNode namespaceList = (CSSTypedNode) cssDoc.children.get(0);
+ assertThat("namespaceList.getOperator()", namespaceList.getOperator(), is( CSSModelTreeType.NAMESPACE_LIST ) );
+ assertThat("namespaceList.children.size()", namespaceList.children.size(), is( 0 ) );
+ CSSTypedNode fontFaceList = (CSSTypedNode) cssDoc.children.get(1);
+ assertThat("fontFaceList.getOperator()", fontFaceList.getOperator(), is( CSSModelTreeType.FONT_FACE_LIST ) );
+ assertThat("fontFaceList.children.size()", fontFaceList.children.size(), is( 0 ) );
+ CSSTypedNode ruleList = (CSSTypedNode) cssDoc.children.get(2);
+ assertThat("ruleList.getOperator()", ruleList.getOperator(), is( CSSModelTreeType.RULE_LIST ) );
+ assertThat("ruleList.children.size()", ruleList.children.size(), is( 2 ) );
+
+ }
+
+ @Test
+ public void CSSDocumentTests_combination_namespace_fontface_rules()
+ {
+ String code =
+ " @namespace s \"library://ns.adobe.com/flex/spark\";" + EOL +
+ " @namespace mx \"library://ns.adobe.com/flex/mx\";" + EOL +
+ " " + EOL +
+ "@font-faces { " + EOL +
+ " src: url('font.ttf'); " + EOL +
+ " fontFamily: 'font'; " + EOL +
+ "}" + EOL +
+ "@font-faces { " + EOL +
+ " src: url('font1.ttf'); " + EOL +
+ " fontFamily: 'font1'; " + EOL +
+ "}" + EOL +
+ " " + EOL +
+ "s|Label { " + EOL +
+ " fontFamily: 'font'; " + EOL +
+ "}" + EOL +
+ "s|Label.test { " + EOL +
+ " fontFamily: 'font1'; " + EOL +
+ "}";
+
+ CSSDocument cssDoc = (CSSDocument) getCSSNodeBase(code);
+ assertThat("cssDoc" , cssDoc, not( (CSSDocument) null ) );
+ assertThat("cssDoc.getOperator()" , cssDoc.getOperator(), is( CSSModelTreeType.DOCUMENT ) );
+
+ assertThat("cssDoc.getAtNamespaces().size()" , cssDoc.getAtNamespaces().size(), is( 2 ) );
+ CSSNamespaceDefinition defaultNamespaceDefinition = (CSSNamespaceDefinition) cssDoc.getDefaultNamespaceDefinition();
+ assertNull("defaultNamespaceDefinition not null" , defaultNamespaceDefinition );
+ assertThat("cssDoc.getNamespaceDefinition(\"s\")" , cssDoc.getNamespaceDefinition("s"), not( (ICSSNamespaceDefinition) null ) );
+ assertThat("cssDoc.getNamespaceDefinition(\"mxm\")" , cssDoc.getNamespaceDefinition("mxm"), is( (ICSSNamespaceDefinition) null ) );
+
+ assertThat("cssDoc.getRules().size())" , cssDoc.getRules().size(), is( 2 ) );
+ assertThat("cssDoc.getFontFaces().size())" , cssDoc.getFontFaces().size(), is( 2 ) );
+
+ CSSTypedNode namespaceList = (CSSTypedNode) cssDoc.children.get(0);
+ assertThat("namespaceList.getOperator()", namespaceList.getOperator(), is( CSSModelTreeType.NAMESPACE_LIST ) );
+ assertThat("namespaceList.children.size()", namespaceList.children.size(), is( 2 ) );
+ CSSTypedNode fontFaceList = (CSSTypedNode) cssDoc.children.get(1);
+ assertThat("fontFaceList.getOperator()", fontFaceList.getOperator(), is( CSSModelTreeType.FONT_FACE_LIST ) );
+ assertThat("fontFaceList.children.size()", fontFaceList.children.size(), is( 2 ) );
+ CSSTypedNode ruleList = (CSSTypedNode) cssDoc.children.get(2);
+ assertThat("ruleList.getOperator()", ruleList.getOperator(), is( CSSModelTreeType.RULE_LIST ) );
+ assertThat("ruleList.children.size()", ruleList.children.size(), is( 2 ) );
+ }
+
+
+}
Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSDocumentTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSFontFaceTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSFontFaceTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSFontFaceTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSFontFaceTests.java Sun Dec 2 10:43:08 2012
@@ -61,6 +61,7 @@ public class CSSFontFaceTests extends CS
assertThat("fontfaces.size()" , fontfaces.size(), is(1) );
CSSFontFace fontface = (CSSFontFace) fontfaces.get(0);
+ assertThat("fontface.getOperator()" , fontface.getOperator(), is( CSSModelTreeType.FONT_FACE ) );
assertThat("fontface.getFontFamily()" , fontface.getFontFamily(), is( "font" ) );
assertThat("fontface.getFontStyle()" , fontface.getFontStyle(), is( "normal" ) );
assertThat("fontface.getFontWeight()" , fontface.getFontWeight(), is( "normal" ) );
@@ -88,6 +89,7 @@ public class CSSFontFaceTests extends CS
assertThat("fontfaces.size()" , fontfaces.size(), is(1) );
CSSFontFace fontface = (CSSFontFace) fontfaces.get(0);
+ assertThat("fontface.getOperator()" , fontface.getOperator(), is( CSSModelTreeType.FONT_FACE ) );
assertThat("fontface.getFontFamily()" , fontface.getFontFamily(), is( "font" ) );
assertThat("fontface.getFontStyle()" , fontface.getFontStyle(), is( "italic" ) );
assertThat("fontface.getFontWeight()" , fontface.getFontWeight(), is( "bold" ) );
@@ -114,6 +116,7 @@ public class CSSFontFaceTests extends CS
assertThat("fontfaces.size()" , fontfaces.size(), is(1) );
CSSFontFace fontface = (CSSFontFace) fontfaces.get(0);
+ assertThat("fontface.getOperator()" , fontface.getOperator(), is( CSSModelTreeType.FONT_FACE ) );
assertThat("fontface.getFontFamily()" , fontface.getFontFamily(), is( "font" ) );
assertThat("fontface.getFontStyle()" , fontface.getFontStyle(), is( "oblique" ) );
assertThat("fontface.getFontWeight()" , fontface.getFontWeight(), is( "heavy" ) );
@@ -137,6 +140,7 @@ public class CSSFontFaceTests extends CS
assertThat("fontfaces.size()" , fontfaces.size(), is(1) );
CSSFontFace fontface = (CSSFontFace) fontfaces.get(0);
+ assertThat("fontface.getOperator()" , fontface.getOperator(), is( CSSModelTreeType.FONT_FACE ) );
assertThat("fontface.getFontFamily()" , fontface.getFontFamily(), is( "font" ) );
assertThat("fontface.getFontStyle()" , fontface.getFontStyle(), is( "normal" ) );
assertThat("fontface.getFontWeight()" , fontface.getFontWeight(), is( "normal" ) );
@@ -159,6 +163,7 @@ public class CSSFontFaceTests extends CS
assertThat("fontfaces.size()" , fontfaces.size(), is(1) );
CSSFontFace fontface = (CSSFontFace) fontfaces.get(0);
+ assertThat("fontface.getOperator()" , fontface.getOperator(), is( CSSModelTreeType.FONT_FACE ) );
assertThat("fontface.getFontFamily()" , fontface.getFontFamily(), is( "font" ) );
assertThat("fontface.getFontStyle()" , fontface.getFontStyle(), is( "normal" ) );
assertThat("fontface.getFontWeight()" , fontface.getFontWeight(), is( "normal" ) );
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSFunctionCallPropertyValueTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSFunctionCallPropertyValueTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSFunctionCallPropertyValueTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSFunctionCallPropertyValueTests.java Sun Dec 2 10:43:08 2012
@@ -54,6 +54,7 @@ public class CSSFunctionCallPropertyValu
assertThat("functionCallProperties.size()" , functionCallProperties.size(), is(1) );
CSSFunctionCallPropertyValue functionCallPropertyValue = functionCallProperties.get(0);
+ assertThat("functionCallPropertyValue.getOperator()" , functionCallPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("functionCallPropertyValue.name" , functionCallPropertyValue.name, is( CSSFunctionCallPropertyValue.EMBED ) );
assertThat("functionCallPropertyValue.rawArguments" , functionCallPropertyValue.rawArguments, is( "\"image.gif\"" ) );
}
@@ -67,6 +68,7 @@ public class CSSFunctionCallPropertyValu
assertThat("functionCallProperties.size()" , functionCallProperties.size(), is(1) );
CSSFunctionCallPropertyValue functionCallPropertyValue = functionCallProperties.get(0);
+ assertThat("functionCallPropertyValue.getOperator()" , functionCallPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("functionCallPropertyValue.name" , functionCallPropertyValue.name, is( CSSFunctionCallPropertyValue.PROPERTY_REFERENCE ) );
assertThat("functionCallPropertyValue.rawArguments" , functionCallPropertyValue.rawArguments, is( "'colorValue'" ) );
}
@@ -80,6 +82,7 @@ public class CSSFunctionCallPropertyValu
assertThat("functionCallProperties.size()" , functionCallProperties.size(), is(1) );
CSSFunctionCallPropertyValue functionCallPropertyValue = functionCallProperties.get(0);
+ assertThat("functionCallPropertyValue.getOperator()" , functionCallPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("functionCallPropertyValue.name" , functionCallPropertyValue.name, is( CSSFunctionCallPropertyValue.CLASS_REFERENCE ) );
assertThat("functionCallPropertyValue.rawArguments" , functionCallPropertyValue.rawArguments, is( "'Label'" ) );
}
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSKeywordPropertyValueTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSKeywordPropertyValueTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSKeywordPropertyValueTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSKeywordPropertyValueTests.java Sun Dec 2 10:43:08 2012
@@ -54,6 +54,7 @@ public class CSSKeywordPropertyValueTest
assertThat("keywordProperties.size()" , keywordProperties.size(), is(1) );
CSSKeywordPropertyValue keywordPropertyValue = keywordProperties.get(0);
+ assertThat("keywordPropertyValue.getOperator()" , keywordPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("keywordPropertyValue.getValue()" , keywordPropertyValue.getKeyword(), is( "keyWord" ) );
}
Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSMediaQueryConditionTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSMediaQueryConditionTests.java?rev=1416151&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSMediaQueryConditionTests.java (added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSMediaQueryConditionTests.java Sun Dec 2 10:43:08 2012
@@ -0,0 +1,120 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.css;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.flex.compiler.css.ICSSDocument;
+import org.apache.flex.compiler.css.ICSSMediaQueryCondition;
+import org.apache.flex.compiler.css.ICSSPropertyValue;
+import org.apache.flex.compiler.css.ICSSRule;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * JUnit tests for {@link CSSMediaQueryCondition}.
+ *
+ * @author Gordon Smith
+ */
+public class CSSMediaQueryConditionTests extends CSSBaseTests {
+
+ private static final String EOL = "\n\t\t";
+
+ private String getPostfix()
+ {
+ return "{ " + EOL +
+ " s|VBox { } " + EOL +
+ "}";
+ }
+
+ @Override
+ public ICSSDocument getCSSNodeBase(String code) {
+ return super.getCSSNodeBase(code + getPostfix());
+ }
+
+ protected List<ICSSMediaQueryCondition> getCSSMediaQueryCondition(String code) {
+ ImmutableList<ICSSRule> rules = getCSSNodeBase( code ).getRules();
+ assertThat("rules", rules, not( (ImmutableList<ICSSRule>) null) );
+ List<ICSSMediaQueryCondition> mediaQueryCondition = new ArrayList<ICSSMediaQueryCondition>();
+ for (ICSSRule icssRule : rules) {
+ mediaQueryCondition.addAll( icssRule.getMediaQueryConditions() );
+ }
+ assertThat("mediaQueryCondition", mediaQueryCondition, not( (List<ICSSMediaQueryCondition>) null) );
+ return mediaQueryCondition;
+ }
+
+ @Test
+ public void CSSMediaQueryCondition_media1()
+ {
+ String code = "@media all";
+
+ List<ICSSMediaQueryCondition> mediaQueryConditions = getCSSMediaQueryCondition(code);
+ assertThat("mediaQueryConditions.size()" , mediaQueryConditions.size(), is(1) );
+
+ ICSSMediaQueryCondition mediaQueryCondition = mediaQueryConditions.get(0);
+ assertThat("mediaQueryCondition.getOperator()" , mediaQueryCondition.getOperator(), is( CSSModelTreeType.MEDIA_QUERY_CONDITION ) );
+ assertThat("mediaQueryCondition.getKey()" , mediaQueryCondition.getKey(), is( (String) null ) );
+ assertThat("mediaQueryCondition.getValue()" , mediaQueryCondition.getValue(), not( (ICSSPropertyValue) null ) );
+ assertTrue( mediaQueryCondition.getValue() instanceof CSSKeywordPropertyValue );
+
+ CSSKeywordPropertyValue property = (CSSKeywordPropertyValue) mediaQueryCondition.getValue();
+ assertThat("property.getKey()" , property.getKeyword(), is( "all" ) );
+
+ }
+
+ @Test
+ public void CSSMediaQueryCondition_media_combined()
+ {
+ String code = "@media (application-dpi: 240) and (os-platform: \"Android\") ";
+
+ List<ICSSMediaQueryCondition> mediaQueryConditions = getCSSMediaQueryCondition(code);
+ assertThat("mediaQueryConditions.size()" , mediaQueryConditions.size(), is(2) );
+
+ ICSSMediaQueryCondition mediaQueryCondition1 = mediaQueryConditions.get(0);
+ assertThat("mediaQueryCondition1.getOperator()" , mediaQueryCondition1.getOperator(), is( CSSModelTreeType.MEDIA_QUERY_CONDITION ) );
+ assertThat("mediaQueryCondition1.getKey()" , mediaQueryCondition1.getKey(), is( (String) null ) );
+ assertThat("mediaQueryCondition1.getValue()" , mediaQueryCondition1.getValue(), not( (ICSSPropertyValue) null ) );
+ assertTrue( mediaQueryCondition1.getValue() instanceof CSSKeywordPropertyValue );
+
+ CSSKeywordPropertyValue property1 = (CSSKeywordPropertyValue) mediaQueryCondition1.getValue();
+ assertThat("property1.getOperator()" , property1.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
+ assertThat("property1.getKey()" , property1.getKeyword(), is( "(application-dpi: 240)" ) );
+
+ ICSSMediaQueryCondition mediaQueryCondition2 = mediaQueryConditions.get(0);
+ assertThat("mediaQueryCondition2.getOperator()" , mediaQueryCondition2.getOperator(), is( CSSModelTreeType.MEDIA_QUERY_CONDITION ) );
+ assertThat("mediaQueryCondition2.getKey()" , mediaQueryCondition2.getKey(), is( (String) null ) );
+ assertThat("mediaQueryCondition2.getValue()" , mediaQueryCondition2.getValue(), not( (ICSSPropertyValue) null ) );
+ assertTrue( mediaQueryCondition2.getValue() instanceof CSSKeywordPropertyValue );
+
+ CSSKeywordPropertyValue property2 = (CSSKeywordPropertyValue) mediaQueryCondition2.getValue();
+ assertThat("property2.getOperator()" , property2.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
+ assertThat("property2.getKey()" , property2.getKeyword(), is( "(application-dpi: 240)" ) );
+
+ }
+
+
+}
Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSMediaQueryConditionTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSNamespaceDefinitionTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSNamespaceDefinitionTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSNamespaceDefinitionTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSNamespaceDefinitionTests.java Sun Dec 2 10:43:08 2012
@@ -47,11 +47,12 @@ public class CSSNamespaceDefinitionTests
" @namespace s \"library://ns.adobe.com/flex/spark\";";
List<ICSSNamespaceDefinition> namespaces = getCSSNamespaceDefinition(code);
- assertThat("fontfaces.size()" , namespaces.size(), is(1) );
+ assertThat("namespaces.size()" , namespaces.size(), is(1) );
CSSNamespaceDefinition namespace = (CSSNamespaceDefinition) namespaces.get(0);
- assertThat("fontface.getPrefix()" , namespace.getPrefix(), is( "s" ) );
- assertThat("fontface.getURI()" , namespace.getURI(), is( "library://ns.adobe.com/flex/spark" ) );
+ assertThat("namespace.getOperator()" , namespace.getOperator(), is( CSSModelTreeType.NAMESPACE_DEFINITION ) );
+ assertThat("namespace.getPrefix()" , namespace.getPrefix(), is( "s" ) );
+ assertThat("namespace.getURI()" , namespace.getURI(), is( "library://ns.adobe.com/flex/spark" ) );
}
@Test
@@ -61,12 +62,13 @@ public class CSSNamespaceDefinitionTests
" @namespace s ;";
List<ICSSNamespaceDefinition> namespaces = getCSSNamespaceDefinition(code);
- assertThat("fontfaces.size()" , namespaces.size(), is(1) );
+ assertThat("namespaces.size()" , namespaces.size(), is(1) );
CSSNamespaceDefinition namespace = (CSSNamespaceDefinition) namespaces.get(0);
- assertThat("fontface.getPrefix()" , namespace.getPrefix(), is( "s" ) );
+ assertThat("namespace.getOperator()" , namespace.getOperator(), is( CSSModelTreeType.NAMESPACE_DEFINITION ) );
+ assertThat("namespace.getPrefix()" , namespace.getPrefix(), is( "s" ) );
//TODO why is it "missing STRING"?
- assertThat("fontface.getURI()" , namespace.getURI(), is( "missing STRING" ) );
+ assertThat("namespace.getURI()" , namespace.getURI(), is( "missing STRING" ) );
}
@Test
@@ -76,12 +78,13 @@ public class CSSNamespaceDefinitionTests
" @namespace ;";
List<ICSSNamespaceDefinition> namespaces = getCSSNamespaceDefinition(code);
- assertThat("fontfaces.size()" , namespaces.size(), is(1) );
+ assertThat("namespaces.size()" , namespaces.size(), is(1) );
CSSNamespaceDefinition namespace = (CSSNamespaceDefinition) namespaces.get(0);
- assertThat("fontface.getPrefix()" , namespace.getPrefix(), is( (String)null ) );
+ assertThat("namespace.getOperator()" , namespace.getOperator(), is( CSSModelTreeType.NAMESPACE_DEFINITION ) );
+ assertThat("namespace.getPrefix()" , namespace.getPrefix(), is( (String)null ) );
//TODO why is it "missing STRING"?
- assertThat("fontface.getURI()" , namespace.getURI(), is( "missing STRING" ) );
+ assertThat("namespace.getURI()" , namespace.getURI(), is( "missing STRING" ) );
}
@Test
@@ -92,15 +95,17 @@ public class CSSNamespaceDefinitionTests
" @namespace s \"library://ns.adobe.com/flex/spark\";";
List<ICSSNamespaceDefinition> namespaces = getCSSNamespaceDefinition(code);
- assertThat("fontfaces.size()" , namespaces.size(), is(2) );
+ assertThat("namespaces.size()" , namespaces.size(), is(2) );
CSSNamespaceDefinition namespace1 = (CSSNamespaceDefinition) namespaces.get(0);
- assertThat("fontface.getPrefix()" , namespace1.getPrefix(), is( "s" ) );
- assertThat("fontface.getURI()" , namespace1.getURI(), is( "library://ns.adobe.com/flex/spark" ) );
+ assertThat("namespace1.getOperator()" , namespace1.getOperator(), is( CSSModelTreeType.NAMESPACE_DEFINITION ) );
+ assertThat("namespace1.getPrefix()" , namespace1.getPrefix(), is( "s" ) );
+ assertThat("namespace1.getURI()" , namespace1.getURI(), is( "library://ns.adobe.com/flex/spark" ) );
CSSNamespaceDefinition namespace2 = (CSSNamespaceDefinition) namespaces.get(1);
- assertThat("fontface.getPrefix()" , namespace2.getPrefix(), is( "s" ) );
- assertThat("fontface.getURI()" , namespace2.getURI(), is( "library://ns.adobe.com/flex/spark" ) );
+ assertThat("namespace2.getOperator()" , namespace2.getOperator(), is( CSSModelTreeType.NAMESPACE_DEFINITION ) );
+ assertThat("namespace2.getPrefix()" , namespace2.getPrefix(), is( "s" ) );
+ assertThat("namespace2.getURI()" , namespace2.getURI(), is( "library://ns.adobe.com/flex/spark" ) );
}
@Test
@@ -111,15 +116,17 @@ public class CSSNamespaceDefinitionTests
" @namespace mx \"library://ns.adobe.com/flex/mx\";";
List<ICSSNamespaceDefinition> namespaces = getCSSNamespaceDefinition(code);
- assertThat("fontfaces.size()" , namespaces.size(), is(2) );
+ assertThat("namespaces.size()" , namespaces.size(), is(2) );
CSSNamespaceDefinition namespace1 = (CSSNamespaceDefinition) namespaces.get(0);
- assertThat("fontface.getPrefix()" , namespace1.getPrefix(), is( "s" ) );
- assertThat("fontface.getURI()" , namespace1.getURI(), is( "library://ns.adobe.com/flex/spark" ) );
+ assertThat("namespace1.getOperator()" , namespace1.getOperator(), is( CSSModelTreeType.NAMESPACE_DEFINITION ) );
+ assertThat("namespace1.getPrefix()" , namespace1.getPrefix(), is( "s" ) );
+ assertThat("namespace1.getURI()" , namespace1.getURI(), is( "library://ns.adobe.com/flex/spark" ) );
CSSNamespaceDefinition namespace2 = (CSSNamespaceDefinition) namespaces.get(1);
- assertThat("fontface.getPrefix()" , namespace2.getPrefix(), is( "mx" ) );
- assertThat("fontface.getURI()" , namespace2.getURI(), is( "library://ns.adobe.com/flex/mx" ) );
+ assertThat("namespace2.getOperator()" , namespace2.getOperator(), is( CSSModelTreeType.NAMESPACE_DEFINITION ) );
+ assertThat("namespace1.getPrefix()" , namespace2.getPrefix(), is( "mx" ) );
+ assertThat("namespace1.getURI()" , namespace2.getURI(), is( "library://ns.adobe.com/flex/mx" ) );
}
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSNumberPropertyValueTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSNumberPropertyValueTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSNumberPropertyValueTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSNumberPropertyValueTests.java Sun Dec 2 10:43:08 2012
@@ -54,6 +54,7 @@ public class CSSNumberPropertyValueTests
assertThat("numberProperties.size()" , numberProperties.size(), is(1) );
CSSNumberPropertyValue numberPropertyValue = numberProperties.get(0);
+ assertThat("numberPropertyValue.getOperator()" , numberPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("numberPropertyValue.getUnit()" , numberPropertyValue.getUnit(), is( "" ) );
assertThat("numberPropertyValue.getNumber()" , numberPropertyValue.getNumber(), is( (Number) new Float(10) ) );
}
@@ -66,9 +67,10 @@ public class CSSNumberPropertyValueTests
List<CSSNumberPropertyValue> numberProperties = getCSSNumberPropertyValues(code);
assertThat("numberProperties.size()" , numberProperties.size(), is(1) );
- CSSNumberPropertyValue propertyValue = numberProperties.get(0);
- assertThat("numberPropertyValue.getUnit()" , propertyValue.getUnit(), is( "px" ) );
- assertThat("numberPropertyValue.getNumber()" , propertyValue.getNumber(), is( (Number) new Float(10) ) );
+ CSSNumberPropertyValue numberPropertyValue = numberProperties.get(0);
+ assertThat("numberPropertyValue.getOperator()" , numberPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
+ assertThat("numberPropertyValue.getUnit()" , numberPropertyValue.getUnit(), is( "px" ) );
+ assertThat("numberPropertyValue.getNumber()" , numberPropertyValue.getNumber(), is( (Number) new Float(10) ) );
}
@Test
@@ -79,9 +81,10 @@ public class CSSNumberPropertyValueTests
List<CSSNumberPropertyValue> numberProperties = getCSSNumberPropertyValues(code);
assertThat("numberProperties.size()" , numberProperties.size(), is(1) );
- CSSNumberPropertyValue propertyValue = numberProperties.get(0);
- assertThat("numberPropertyValue.getUnit()" , propertyValue.getUnit(), is( "em" ) );
- assertThat("numberPropertyValue.getNumber()" , propertyValue.getNumber(), is( (Number) new Float(10) ) );
+ CSSNumberPropertyValue numberPropertyValue = numberProperties.get(0);
+ assertThat("numberPropertyValue.getOperator()" , numberPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
+ assertThat("numberPropertyValue.getUnit()" , numberPropertyValue.getUnit(), is( "em" ) );
+ assertThat("numberPropertyValue.getNumber()" , numberPropertyValue.getNumber(), is( (Number) new Float(10) ) );
}
@Test
@@ -93,6 +96,7 @@ public class CSSNumberPropertyValueTests
assertThat("numberProperties.size()" , numberProperties.size(), is(1) );
CSSNumberPropertyValue numberPropertyValue = numberProperties.get(0);
+ assertThat("numberPropertyValue.getOperator()" , numberPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("numberPropertyValue.getUnit()" , numberPropertyValue.getUnit(), is( "%" ) );
assertThat("numberPropertyValue.getNumber()" , numberPropertyValue.getNumber(), is( (Number) new Float(10) ) );
}
@@ -106,6 +110,7 @@ public class CSSNumberPropertyValueTests
assertThat("numberProperties.size()" , numberProperties.size(), is(1) );
CSSNumberPropertyValue numberPropertyValue = numberProperties.get(0);
+ assertThat("numberPropertyValue.getOperator()" , numberPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("numberPropertyValue.getUnit()" , numberPropertyValue.getUnit(), is( "" ) );
assertThat("numberPropertyValue.getNumber()" , numberPropertyValue.getNumber(), is( (Number) new Float(-10) ) );
}
@@ -119,6 +124,7 @@ public class CSSNumberPropertyValueTests
assertThat("numberProperties.size()" , numberProperties.size(), is(1) );
CSSNumberPropertyValue numberPropertyValue = numberProperties.get(0);
+ assertThat("numberPropertyValue.getOperator()" , numberPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("numberPropertyValue.getUnit()" , numberPropertyValue.getUnit(), is( "" ) );
assertThat("numberPropertyValue.getNumber()" , numberPropertyValue.getNumber(), is( (Number) new Float(10) ) );
}
@@ -132,6 +138,7 @@ public class CSSNumberPropertyValueTests
assertThat("numberProperties.size()" , numberProperties.size(), is(1) );
CSSNumberPropertyValue numberPropertyValue = numberProperties.get(0);
+ assertThat("numberPropertyValue.getOperator()" , numberPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("numberPropertyValue.getUnit()()" , numberPropertyValue.getUnit(), is( "" ) );
assertThat("numberPropertyValue.getNumber()()" , numberPropertyValue.getNumber(), is( (Number) new Float(.31) ) );
}
@@ -145,6 +152,7 @@ public class CSSNumberPropertyValueTests
assertThat("numberProperties.size()" , numberProperties.size(), is(1) );
CSSNumberPropertyValue numberPropertyValue = numberProperties.get(0);
+ assertThat("numberPropertyValue.getOperator()" , numberPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("numberPropertyValue.getUnit()" , numberPropertyValue.getUnit(), is( "" ) );
assertThat("numberPropertyValue.getNumber()" , numberPropertyValue.getNumber(), is( (Number) new Float(10.31) ) );
}
@@ -158,6 +166,7 @@ public class CSSNumberPropertyValueTests
assertThat("numberProperties.size()" , numberProperties.size(), is(1) );
CSSNumberPropertyValue numberPropertyValue = numberProperties.get(0);
+ assertThat("numberPropertyValue.getOperator()" , numberPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("numberPropertyValue.getUnit()" , numberPropertyValue.getUnit(), is( "" ) );
assertThat("numberPropertyValue.getNumber()" , numberPropertyValue.getNumber(), is( (Number) new Float(-10.31) ) );
}
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSPropertyTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSPropertyTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSPropertyTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSPropertyTests.java Sun Dec 2 10:43:08 2012
@@ -63,7 +63,8 @@ public class CSSPropertyTests extends CS
assertThat("properties.size()" , properties.size(), is(1) );
CSSProperty property = (CSSProperty) properties.get(0);
- assertThat("stringPropertyValue.getValue()" , property.getName(), is( "color" ) );
+ assertThat("property.getOperator()" , property.getOperator(), is( CSSModelTreeType.PROPERTY ) );
+ assertThat("property.getValue()" , property.getName(), is( "color" ) );
}
@@ -76,18 +77,19 @@ public class CSSPropertyTests extends CS
assertThat("properties.size()" , properties.size(), is(1) );
CSSProperty property = (CSSProperty) properties.get(0);
- assertThat("stringPropertyValue.getValue()" , property.getName(), is( "fontFamily" ) );
+ assertThat("property.getOperator()" , property.getOperator(), is( CSSModelTreeType.PROPERTY ) );
+ assertThat("property.getValue()" , property.getName(), is( "fontFamily" ) );
}
@Test
public void CSSPropertyTests_static_normalize()
{
- assertThat("stringPropertyValue.getValue()" , CSSProperty.normalize("font-family") , is( "fontFamily" ) );
- assertThat("stringPropertyValue.getValue()" , CSSProperty.normalize("fontfamily") , is( "fontfamily" ) );
- assertThat("stringPropertyValue.getValue()" , CSSProperty.normalize("-font-family") , is( "FontFamily" ) );
- assertThat("stringPropertyValue.getValue()" , CSSProperty.normalize("-fontfamily") , is( "Fontfamily" ) );
- assertThat("stringPropertyValue.getValue()" , CSSProperty.normalize("fontfamily-") , is( "fontfamily" ) );
+ assertThat("normalize()" , CSSProperty.normalize("font-family") , is( "fontFamily" ) );
+ assertThat("normalize()" , CSSProperty.normalize("fontfamily") , is( "fontfamily" ) );
+ assertThat("normalize()" , CSSProperty.normalize("-font-family") , is( "FontFamily" ) );
+ assertThat("normalize()" , CSSProperty.normalize("-fontfamily") , is( "Fontfamily" ) );
+ assertThat("normalize()" , CSSProperty.normalize("fontfamily-") , is( "fontfamily" ) );
}
}
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSRuleTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSRuleTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSRuleTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSRuleTests.java Sun Dec 2 10:43:08 2012
@@ -53,9 +53,20 @@ public class CSSRuleTests extends CSSBas
assertThat("rules.size()" , rules.size(), is(1) );
CSSRule rule = (CSSRule) rules.get(0);
+ assertThat("rule.getOperator()" , rule.getOperator(), is( CSSModelTreeType.RULE ) );
assertThat("rule.getMediaQueryConditions().size()" , rule.getMediaQueryConditions().size(), is( 0 ) );
assertThat("rule.getProperties().size()" , rule.getProperties().size(), is( 1 ) );
assertThat("rule.getSelectorGroup().size()" , rule.getSelectorGroup().size(), is( 1 ) );
+
+ CSSTypedNode selectorGroup = (CSSTypedNode) rule.children.get(0);
+ assertThat("selectorGroup.getOperator()", selectorGroup.getOperator(), is( CSSModelTreeType.SELECTOR_GROUP ) );
+ assertThat("selectorGroup.children.size()", selectorGroup.children.size(), is( 1 ) );
+ CSSTypedNode mediaQuery = (CSSTypedNode) rule.children.get(1);
+ assertThat("mediaQuery.getOperator()", mediaQuery.getOperator(), is( CSSModelTreeType.MEDIA_QUERY ) );
+ assertThat("mediaQuery.children.size()", mediaQuery.children.size(), is( 0 ) );
+ CSSTypedNode propertyList = (CSSTypedNode) rule.children.get(2);
+ assertThat("propertyList.getOperator()", propertyList.getOperator(), is( CSSModelTreeType.PROPERTY_LIST ) );
+ assertThat("propertyList.children.size()", propertyList.children.size(), is( 1 ) );
}
@Test
@@ -71,9 +82,20 @@ public class CSSRuleTests extends CSSBas
assertThat("rules.size()" , rules.size(), is(1) );
CSSRule rule = (CSSRule) rules.get(0);
+ assertThat("rule.getOperator()" , rule.getOperator(), is( CSSModelTreeType.RULE ) );
assertThat("rule.getMediaQueryConditions().size()" , rule.getMediaQueryConditions().size(), is( 0 ) );
assertThat("rule.getProperties().size()" , rule.getProperties().size(), is( 2 ) );
assertThat("rule.getSelectorGroup().size()" , rule.getSelectorGroup().size(), is( 1 ) );
+
+ CSSTypedNode selectorGroup = (CSSTypedNode) rule.children.get(0);
+ assertThat("selectorGroup.getOperator()", selectorGroup.getOperator(), is( CSSModelTreeType.SELECTOR_GROUP ) );
+ assertThat("selectorGroup.children.size()", selectorGroup.children.size(), is( 1 ) );
+ CSSTypedNode mediaQuery = (CSSTypedNode) rule.children.get(1);
+ assertThat("mediaQuery.getOperator()", mediaQuery.getOperator(), is( CSSModelTreeType.MEDIA_QUERY ) );
+ assertThat("mediaQuery.children.size()", mediaQuery.children.size(), is( 0 ) );
+ CSSTypedNode propertyList = (CSSTypedNode) rule.children.get(2);
+ assertThat("propertyList.getOperator()", propertyList.getOperator(), is( CSSModelTreeType.PROPERTY_LIST ) );
+ assertThat("propertyList.children.size()", propertyList.children.size(), is( 2 ) );
}
@Test
@@ -89,9 +111,20 @@ public class CSSRuleTests extends CSSBas
assertThat("rules.size()" , rules.size(), is(1) );
CSSRule rule = (CSSRule) rules.get(0);
+ assertThat("rule.getOperator()" , rule.getOperator(), is( CSSModelTreeType.RULE ) );
assertThat("rule.getMediaQueryConditions().size()" , rule.getMediaQueryConditions().size(), is( 0 ) );
assertThat("rule.getProperties().size()" , rule.getProperties().size(), is( 1 ) );
assertThat("rule.getSelectorGroup().size()" , rule.getSelectorGroup().size(), is( 2 ) );
+
+ CSSTypedNode selectorGroup = (CSSTypedNode) rule.children.get(0);
+ assertThat("selectorGroup.getOperator()", selectorGroup.getOperator(), is( CSSModelTreeType.SELECTOR_GROUP ) );
+ assertThat("selectorGroup.children.size()", selectorGroup.children.size(), is( 2 ) );
+ CSSTypedNode mediaQuery = (CSSTypedNode) rule.children.get(1);
+ assertThat("mediaQuery.getOperator()", mediaQuery.getOperator(), is( CSSModelTreeType.MEDIA_QUERY ) );
+ assertThat("mediaQuery.children.size()", mediaQuery.children.size(), is( 0 ) );
+ CSSTypedNode propertyList = (CSSTypedNode) rule.children.get(2);
+ assertThat("propertyList.getOperator()", propertyList.getOperator(), is( CSSModelTreeType.PROPERTY_LIST ) );
+ assertThat("propertyList.children.size()", propertyList.children.size(), is( 1 ) );
}
@Test
@@ -107,14 +140,25 @@ public class CSSRuleTests extends CSSBas
assertThat("rules.size()" , rules.size(), is(1) );
CSSRule rule = (CSSRule) rules.get(0);
+ assertThat("rule.getOperator()" , rule.getOperator(), is( CSSModelTreeType.RULE ) );
assertThat("rule.getMediaQueryConditions().size()" , rule.getMediaQueryConditions().size(), is( 0 ) );
assertThat("rule.getProperties().size()" , rule.getProperties().size(), is( 1 ) );
assertThat("rule.getSelectorGroup().size()" , rule.getSelectorGroup().size(), is( 6 ) );
+
+ CSSTypedNode selectorGroup = (CSSTypedNode) rule.children.get(0);
+ assertThat("selectorGroup.getOperator()", selectorGroup.getOperator(), is( CSSModelTreeType.SELECTOR_GROUP ) );
+ assertThat("selectorGroup.children.size()", selectorGroup.children.size(), is( 6 ) );
+ CSSTypedNode mediaQuery = (CSSTypedNode) rule.children.get(1);
+ assertThat("mediaQuery.getOperator()", mediaQuery.getOperator(), is( CSSModelTreeType.MEDIA_QUERY ) );
+ assertThat("mediaQuery.children.size()", mediaQuery.children.size(), is( 0 ) );
+ CSSTypedNode propertyList = (CSSTypedNode) rule.children.get(2);
+ assertThat("propertyList.getOperator()", propertyList.getOperator(), is( CSSModelTreeType.PROPERTY_LIST ) );
+ assertThat("propertyList.children.size()", propertyList.children.size(), is( 1 ) );
}
@Test
- public void CSSRulesTests_mediaQueryCondition1()
+ public void CSSRulesTests_mediaQueryConditioselectorGroup()
{
String code =
@@ -126,13 +170,24 @@ public class CSSRuleTests extends CSSBas
assertThat("rules.size()" , rules.size(), is(1) );
CSSRule rule = (CSSRule) rules.get(0);
+ assertThat("rule.getOperator()" , rule.getOperator(), is( CSSModelTreeType.RULE ) );
assertThat("rule.getMediaQueryConditions().size()" , rule.getMediaQueryConditions().size(), is( 3 ) );
assertThat("rule.getProperties().size()" , rule.getProperties().size(), is( 1 ) );
assertThat("rule.getSelectorGroup().size()" , rule.getSelectorGroup().size(), is( 1 ) );
+
+ CSSTypedNode selectorGroup = (CSSTypedNode) rule.children.get(0);
+ assertThat("selectorGroup.getOperator()", selectorGroup.getOperator(), is( CSSModelTreeType.SELECTOR_GROUP ) );
+ assertThat("selectorGroup.children.size()", selectorGroup.children.size(), is( 1 ) );
+ CSSTypedNode mediaQuery = (CSSTypedNode) rule.children.get(1);
+ assertThat("mediaQuery.getOperator()", mediaQuery.getOperator(), is( CSSModelTreeType.MEDIA_QUERY ) );
+ assertThat("mediaQuery.children.size()", mediaQuery.children.size(), is( 3 ) );
+ CSSTypedNode propertyList = (CSSTypedNode) rule.children.get(2);
+ assertThat("propertyList.getOperator()", propertyList.getOperator(), is( CSSModelTreeType.PROPERTY_LIST ) );
+ assertThat("propertyList.children.size()", propertyList.children.size(), is( 1 ) );
}
@Test
- public void CSSRulesTests_mediaQueryCondition2()
+ public void CSSRulesTests_mediaQueryConditiomediaQuery()
{
String code =
@@ -144,9 +199,20 @@ public class CSSRuleTests extends CSSBas
assertThat("rules.size()" , rules.size(), is(1) );
CSSRule rule = (CSSRule) rules.get(0);
+ assertThat("rule.getOperator()" , rule.getOperator(), is( CSSModelTreeType.RULE ) );
assertThat("rule.getMediaQueryConditions().size()" , rule.getMediaQueryConditions().size(), is( 1 ) );
assertThat("rule.getProperties().size()" , rule.getProperties().size(), is( 1 ) );
assertThat("rule.getSelectorGroup().size()" , rule.getSelectorGroup().size(), is( 1 ) );
+
+ CSSTypedNode selectorGroup = (CSSTypedNode) rule.children.get(0);
+ assertThat("selectorGroup.getOperator()", selectorGroup.getOperator(), is( CSSModelTreeType.SELECTOR_GROUP ) );
+ assertThat("selectorGroup.children.size()", selectorGroup.children.size(), is( 1 ) );
+ CSSTypedNode mediaQuery = (CSSTypedNode) rule.children.get(1);
+ assertThat("mediaQuery.getOperator()", mediaQuery.getOperator(), is( CSSModelTreeType.MEDIA_QUERY ) );
+ assertThat("mediaQuery.children.size()", mediaQuery.children.size(), is( 1 ) );
+ CSSTypedNode propertyList = (CSSTypedNode) rule.children.get(2);
+ assertThat("propertyList.getOperator()", propertyList.getOperator(), is( CSSModelTreeType.PROPERTY_LIST ) );
+ assertThat("propertyList.children.size()", propertyList.children.size(), is( 1 ) );
}
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSSelectorConditionTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSSelectorConditionTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSSelectorConditionTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSSelectorConditionTests.java Sun Dec 2 10:43:08 2012
@@ -72,6 +72,7 @@ public class CSSSelectorConditionTests e
assertThat("conditions.size()" , conditions.size(), is(1) );
CSSSelectorCondition condition = (CSSSelectorCondition) conditions.get(0);
+ assertThat("condition.getOperator()" , condition.getOperator(), is( CSSModelTreeType.SELECTOR_CONDITION ) );
assertThat("condition.getConditionType()" , condition.getConditionType() , is( ConditionType.PSEUDO ) );
assertThat("condition.getValue()" , condition.getValue(), is( "up" ) );
}
@@ -85,6 +86,7 @@ public class CSSSelectorConditionTests e
assertThat("conditions.size()" , conditions.size(), is(1) );
CSSSelectorCondition condition = (CSSSelectorCondition) conditions.get(0);
+ assertThat("condition.getOperator()" , condition.getOperator(), is( CSSModelTreeType.SELECTOR_CONDITION ) );
assertThat("condition.getConditionType()" , condition.getConditionType() , is( ConditionType.CLASS ) );
assertThat("condition.getValue()" , condition.getValue(), is( "rounded" ) );
}
@@ -98,6 +100,7 @@ public class CSSSelectorConditionTests e
assertThat("conditions.size()" , conditions.size(), is(1) );
CSSSelectorCondition condition = (CSSSelectorCondition) conditions.get(0);
+ assertThat("condition.getOperator()" , condition.getOperator(), is( CSSModelTreeType.SELECTOR_CONDITION ) );
assertThat("condition.getConditionType()" , condition.getConditionType() , is( ConditionType.ID ) );
assertThat("condition.getValue())" , condition.getValue(), is( "main" ) );
}
@@ -111,16 +114,19 @@ public class CSSSelectorConditionTests e
assertThat("conditions.size()" , conditions.size(), is(3) );
CSSSelectorCondition condition1 = (CSSSelectorCondition) conditions.get(0);
- assertThat("condition.getConditionType()" , condition1.getConditionType() , is( ConditionType.CLASS ) );
- assertThat("condition.getValue()" , condition1.getValue(), is( "rounded" ) );
+ assertThat("condition1.getOperator()" , condition1.getOperator(), is( CSSModelTreeType.SELECTOR_CONDITION ) );
+ assertThat("condition1.getConditionType()" , condition1.getConditionType() , is( ConditionType.CLASS ) );
+ assertThat("condition1.getValue()" , condition1.getValue(), is( "rounded" ) );
CSSSelectorCondition condition2 = (CSSSelectorCondition) conditions.get(1);
- assertThat("condition.getConditionType()" , condition2.getConditionType() , is( ConditionType.ID ) );
- assertThat("condition.getValue()" , condition2.getValue(), is( "main" ) );
+ assertThat("condition2.getOperator()" , condition2.getOperator(), is( CSSModelTreeType.SELECTOR_CONDITION ) );
+ assertThat("condition2.getConditionType()" , condition2.getConditionType() , is( ConditionType.ID ) );
+ assertThat("condition2.getValue()" , condition2.getValue(), is( "main" ) );
CSSSelectorCondition condition3 = (CSSSelectorCondition) conditions.get(2);
- assertThat("condition.getConditionType()" , condition3.getConditionType() , is( ConditionType.PSEUDO ) );
- assertThat("condition.getValue()" , condition3.getValue(), is( "up" ) );
+ assertThat("condition3.getOperator()" , condition3.getOperator(), is( CSSModelTreeType.SELECTOR_CONDITION ) );
+ assertThat("condition3.getConditionType()" , condition3.getConditionType() , is( ConditionType.PSEUDO ) );
+ assertThat("condition3.getValue()" , condition3.getValue(), is( "up" ) );
}
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSSelectorTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSSelectorTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSSelectorTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSSelectorTests.java Sun Dec 2 10:43:08 2012
@@ -66,6 +66,7 @@ public class CSSSelectorTests extends CS
assertThat("selectors.size()" , selectors.size(), is(1) );
CSSSelector selector = (CSSSelector) selectors.get(0);
+ assertThat("selector" , selector.getOperator(), is( CSSModelTreeType.SELECTOR ) );
assertThat("selector.getCombinator()" , selector.getCombinator() , is( (ICSSCombinator) null ) );
assertThat("selector.getConditions().size()" , selector.getConditions().size(), is( 0 ) );
assertThat("selector.getCSSSyntax()" , selector.getCSSSyntax(), is( "s|VBox" ) );
@@ -83,6 +84,7 @@ public class CSSSelectorTests extends CS
assertThat("selectors.size()" , selectors.size(), is(2) );
CSSSelector selector1 = (CSSSelector) selectors.get(0);
+ assertThat("selector1.getOperator()" , selector1.getOperator(), is( CSSModelTreeType.SELECTOR ) );
assertThat("selector.getCombinator()" , selector1.getCombinator() , is( (ICSSCombinator) null ) );
assertThat("selector1.getConditions().size()" , selector1.getConditions().size(), is( 0 ) );
assertThat("selector1.getCSSSyntax()" , selector1.getCSSSyntax(), is( "s|VBox" ) );
@@ -91,7 +93,8 @@ public class CSSSelectorTests extends CS
assertThat("selector1.isAdvanced()" , selector1.isAdvanced(), is( true ) );
CSSSelector selector2 = (CSSSelector) selectors.get(0);
- assertThat("selector.getCombinator()" , selector2.getCombinator() , is( (ICSSCombinator) null ) );
+ assertThat("selector2.getOperator()" , selector2.getOperator(), is( CSSModelTreeType.SELECTOR ) );
+ assertThat("selector2.getCombinator()" , selector2.getCombinator() , is( (ICSSCombinator) null ) );
assertThat("selector2.getConditions().size()" , selector2.getConditions().size(), is( 0 ) );
assertThat("selector2.getCSSSyntax()" , selector2.getCSSSyntax(), is( "s|VBox" ) );
assertThat("selector2.getElementName()" , selector2.getElementName(), is( "VBox" ) );
@@ -108,6 +111,7 @@ public class CSSSelectorTests extends CS
assertThat("selectors.size()" , selectors.size(), is(1) );
CSSSelector selector = (CSSSelector) selectors.get(0);
+ assertThat("selector.getOperator()" , selector.getOperator(), is( CSSModelTreeType.SELECTOR ) );
assertThat("selector.getCombinator()" , selector.getCombinator() , not( (ICSSCombinator) null ) );
assertThat("selector.getConditions().size()" , selector.getConditions().size(), is( 1 ) );
assertThat("selector.getCSSSyntax()" , selector.getCSSSyntax(), is( "s|VBox .test" ) );
@@ -125,6 +129,7 @@ public class CSSSelectorTests extends CS
assertThat("selectors.size()" , selectors.size(), is(1) );
CSSSelector selector = (CSSSelector) selectors.get(0);
+ assertThat("selector.getOperator()" , selector.getOperator(), is( CSSModelTreeType.SELECTOR ) );
assertThat("selector.getCombinator()" , selector.getCombinator() , is( (ICSSCombinator) null ) );
assertThat("selector.getConditions().size()" , selector.getConditions().size(), is( 3 ) );
assertThat("selector.getCSSSyntax()" , selector.getCSSSyntax(), is( "s|Button.rounded#main:up" ) );
@@ -143,6 +148,7 @@ public class CSSSelectorTests extends CS
assertThat("selectors.size()" , selectors.size(), is(1) );
CSSSelector selector = (CSSSelector) selectors.get(0);
+ assertThat("selector.getOperator()" , selector.getOperator(), is( CSSModelTreeType.SELECTOR ) );
assertThat("selector.getCombinator()" , selector.getCombinator() , not( (ICSSCombinator) null ) );
assertThat("selector.getConditions().size()" , selector.getConditions().size(), is( 1 ) );
assertThat("selector.getCSSSyntax()" , selector.getCSSSyntax(), is( "s|VBox s|Label .test" ) );
@@ -161,7 +167,8 @@ public class CSSSelectorTests extends CS
assertThat("selectors.size()" , selectors.size(), is(2) );
CSSSelector selector1 = (CSSSelector) selectors.get(0);
- assertThat("selector.getCombinator()" , selector1.getCombinator() , is( (ICSSCombinator) null ) );
+ assertThat("selector1.getOperator()" , selector1.getOperator(), is( CSSModelTreeType.SELECTOR ) );
+ assertThat("selector1.getCombinator()" , selector1.getCombinator() , is( (ICSSCombinator) null ) );
assertThat("selector1.getConditions().size()" , selector1.getConditions().size(), is( 0 ) );
assertThat("selector1.getCSSSyntax()" , selector1.getCSSSyntax(), is( "s|VBox" ) );
assertThat("selector1.getElementName()" , selector1.getElementName(), is( "VBox") );
@@ -169,7 +176,8 @@ public class CSSSelectorTests extends CS
assertThat("selector1.isAdvanced()" , selector1.isAdvanced(), is( true ) );
CSSSelector selector2 = (CSSSelector) selectors.get(1);
- assertThat("selector.getCombinator()" , selector2.getCombinator() , not( (ICSSCombinator) null ) );
+ assertThat("selector2.getOperator()" , selector1.getOperator(), is( CSSModelTreeType.SELECTOR ) );
+ assertThat("selector2.getCombinator()" , selector2.getCombinator() , not( (ICSSCombinator) null ) );
assertThat("selector2.getConditions().size()" , selector2.getConditions().size(), is( 3 ) );
assertThat("selector2.getCSSSyntax()" , selector2.getCSSSyntax(), is( "s|HBox s|Button.rounded#main:up" ) );
assertThat("selector2.getElementName()" , selector2.getElementName(), is( "Button" ) );
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSStringPropertyValueTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSStringPropertyValueTests.java?rev=1416151&r1=1416150&r2=1416151&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSStringPropertyValueTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/css/CSSStringPropertyValueTests.java Sun Dec 2 10:43:08 2012
@@ -54,6 +54,7 @@ public class CSSStringPropertyValueTests
assertThat("stringProperties.size()" , stringProperties.size(), is(1) );
CSSStringPropertyValue stringPropertyValue = stringProperties.get(0);
+ assertThat("stringPropertyValue" , stringPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("stringPropertyValue.getValue()" , stringPropertyValue.getValue(), is( "Verdana" ) );
}
@@ -66,6 +67,7 @@ public class CSSStringPropertyValueTests
assertThat("stringProperties.size()" , stringProperties.size(), is(1) );
CSSStringPropertyValue stringPropertyValue = stringProperties.get(0);
+ assertThat("stringPropertyValue" , stringPropertyValue.getOperator(), is( CSSModelTreeType.PROPERTY_VALUE ) );
assertThat("stringPropertyValue.getValue()" , stringPropertyValue.getValue(), is( "Verdana" ) );
}