[412350] editing css font-family result in exceptions
diff --git a/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/model/CSSFontFamilyTest.java b/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/model/CSSFontFamilyTest.java
index e6ce0d5..b77e736 100644
--- a/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/model/CSSFontFamilyTest.java
+++ b/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/model/CSSFontFamilyTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,6 +13,7 @@
import java.io.IOException;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSValue;
import org.eclipse.wst.css.core.tests.util.FileUtil;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.w3c.dom.css.CSSPrimitiveValue;
@@ -78,4 +79,38 @@
value = declaration.getPropertyCSSValue(FONT_FAMILY);
checkPrimitiveString(value, new PrimitiveString(CSSPrimitiveValue.CSS_IDENT, "Comic Sans"));
}
+
+ public void testValueModification() throws IOException {
+ ICSSModel model = getModel();
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ structuredDocument.set(FileUtil.createString("src/org/eclipse/wst/css/core/tests/testfiles", "CSSFontFamilyTest.css"));
+
+ CSSStyleSheet sheet = (CSSStyleSheet) model.getDocument();
+ CSSRuleList rules = sheet.getCssRules();
+ assertEquals(4, rules.getLength());
+
+ // Rule 1: No whitespace
+ CSSRule rule;
+ CSSStyleDeclaration declaration;
+ CSSValue value;
+
+ // Rule 1: No whitespace
+ rule = rules.item(0);
+ assertEquals(CSSRule.STYLE_RULE, rule.getType());
+ assertTrue(rule instanceof CSSStyleRule);
+
+ declaration = ((CSSStyleRule) rule).getStyle();
+ value = declaration.getPropertyCSSValue(FONT_FAMILY);
+ checkPrimitiveString(value, new PrimitiveString(CSSPrimitiveValue.CSS_IDENT, "Courier"));
+
+ declaration.setProperty(FONT_FAMILY, "\"Times New Roman\", Times, serif", "");
+ value = declaration.getPropertyCSSValue(FONT_FAMILY);
+ assertTrue(value instanceof ICSSValue);
+ assertEquals("\"Times New Roman\", Times, serif", ((ICSSValue) value).getCSSValueText());
+
+ declaration.setProperty(FONT_FAMILY, "\"Times New Roman\", Times", "");
+ value = declaration.getPropertyCSSValue(FONT_FAMILY);
+ assertTrue(value instanceof ICSSValue);
+ assertEquals("\"Times New Roman\", Times", ((ICSSValue) value).getCSSValueText());
+ }
}