Author: sdzmitrovich
Date: 2009-08-27 13:17:05 -0400 (Thu, 27 Aug 2009)
New Revision: 17340
Added:
trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/WebContent/pages/JBIDE/
trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/WebContent/pages/JBIDE/4790/
trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/WebContent/pages/JBIDE/4790/inputFractional.css
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/InputFractionalValueTest_JBIDE4790.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/CSSAllTests.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4790
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2009-08-27
16:26:29 UTC (rev 17339)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2009-08-27
17:17:05 UTC (rev 17340)
@@ -133,8 +133,8 @@
declaration.removeProperty(me.getKey());
} else {
- // FIX FOR BIDE-4790 in that case simple setting of new
- // value leads to error
+ // FIX FOR BIDE-4790 simple setting of new
+ // value leads to error in issue's case
if (declaration.getPropertyValue(me.getKey()) != null)
declaration.removeProperty(me.getKey());
Modified: trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF 2009-08-27 16:26:29
UTC (rev 17339)
+++ trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF 2009-08-27 17:17:05
UTC (rev 17340)
@@ -19,7 +19,8 @@
org.eclipse.jface.text,
org.jboss.tools.jst.css,
org.eclipse.core.databinding,
- org.eclipse.ui.views.properties.tabbed
+ org.eclipse.ui.views.properties.tabbed,
+ org.jboss.tools.jst.jsp
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Added:
trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/WebContent/pages/JBIDE/4790/inputFractional.css
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/WebContent/pages/JBIDE/4790/inputFractional.css
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/WebContent/pages/JBIDE/4790/inputFractional.css 2009-08-27
17:17:05 UTC (rev 17340)
@@ -0,0 +1,3 @@
+.clasA {
+ font-size: 1em;
+}
\ No newline at end of file
Property changes on:
trunk/jst/tests/org.jboss.tools.jst.css.test/resources/cssTest/WebContent/pages/JBIDE/4790/inputFractional.css
___________________________________________________________________
Name: svn:mime-type
+ text/css
Name: svn:eol-style
+ native
Modified:
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/CSSAllTests.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/CSSAllTests.java 2009-08-27
16:26:29 UTC (rev 17339)
+++
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/CSSAllTests.java 2009-08-27
17:17:05 UTC (rev 17340)
@@ -14,6 +14,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.tools.jst.css.test.jbide.InputFractionalValueTest_JBIDE4790;
import org.jboss.tools.test.util.ProjectImportTestSetup;
/**
@@ -29,6 +30,7 @@
TestSuite suite = new TestSuite("Tests for CSS views"); //$NON-NLS-1$
// $JUnit-BEGIN$
suite.addTestSuite(CSSViewTest.class);
+ suite.addTestSuite(InputFractionalValueTest_JBIDE4790.class);
// $JUnit-END$
return new ProjectImportTestSetup(
Added:
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/InputFractionalValueTest_JBIDE4790.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/InputFractionalValueTest_JBIDE4790.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/InputFractionalValueTest_JBIDE4790.java 2009-08-27
17:17:05 UTC (rev 17340)
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.css.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.css.core.internal.document.CSSStructuredDocumentRegionContainer;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.jst.css.properties.CSSPropertyPage;
+import org.jboss.tools.jst.css.test.AbstractCSSViewTest;
+import org.jboss.tools.jst.css.view.CSSEditorView;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.css.CSSStyleRule;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class InputFractionalValueTest_JBIDE4790 extends AbstractCSSViewTest {
+
+ public static final String IMPORT_PROJECT_NAME = "cssTest"; //$NON-NLS-1$
+
+ public static final String TEST_PAGE_NAME = "JBIDE/4790/inputFractional.css";
//$NON-NLS-1$
+
+ public static final String TEST_CSS_ATTRIBUTE_NAME = "font-size";
//$NON-NLS-1$
+
+ public void testInputFractionalValue() throws CoreException {
+
+ IFile pageFile = getComponentPath(TEST_PAGE_NAME, getProjectName());
+
+ assertNotNull(pageFile);
+
+ StructuredTextEditor editor = (StructuredTextEditor) openEditor(
+ pageFile, CSS_EDITOR_ID);
+
+ assertNotNull(editor);
+
+ CSSEditorView view = (CSSEditorView) openView(CSS_EDITOR_VIEW);
+
+ assertNotNull(view);
+
+ CSSPropertyPage page = (CSSPropertyPage) view.getCurrentPage();
+
+ assertNotNull(page);
+
+ ICSSModel model = (ICSSModel) getStructuredModel(pageFile);
+
+ assertNotNull(model);
+
+ ICSSStyleSheet document = (ICSSStyleSheet) model.getDocument();
+
+ assertNotNull(document);
+
+ CSSRule cssRule = document.getCssRules().item(0);
+
+ assertNotNull(cssRule);
+
+ int offset = ((CSSStructuredDocumentRegionContainer) cssRule)
+ .getStartOffset();
+
+ setSelection(editor, offset, 0);
+
+ CSSStyleDeclaration declaration = ((CSSStyleRule) cssRule).getStyle();
+
+ String testedValue = declaration
+ .getPropertyValue(TEST_CSS_ATTRIBUTE_NAME);
+
+ assertNotNull(testedValue);
+
+ StyleAttributes styleAttributes = page.getStyleAttributes();
+
+ assertEquals(testedValue, styleAttributes
+ .getAttribute(TEST_CSS_ATTRIBUTE_NAME));
+
+ String[] parsedTestValue = Util.convertExtString(testedValue);
+
+ assertEquals(parsedTestValue.length, 2);
+
+ String newTestedValue = parsedTestValue[0] + "." + parsedTestValue[1];
//$NON-NLS-1$
+
+ styleAttributes.getAttributeMap().put(TEST_CSS_ATTRIBUTE_NAME,
+ newTestedValue);
+
+ testedValue = declaration.getPropertyValue(TEST_CSS_ATTRIBUTE_NAME);
+
+ assertNotNull(testedValue);
+
+ assertEquals(removeWhitespaces(newTestedValue),
+ removeWhitespaces(testedValue));
+
+ parsedTestValue = Util.convertExtString(testedValue);
+
+ assertEquals(parsedTestValue.length, 2);
+
+ newTestedValue = parsedTestValue[0] + "3" + parsedTestValue[1];
//$NON-NLS-1$
+
+ try {
+ styleAttributes.getAttributeMap().put(TEST_CSS_ATTRIBUTE_NAME,
+ newTestedValue);
+
+ } catch (DOMException e) {
+ fail("Changing of attribute's value leads to DOMException. Probably it is
regression of JBIDE-4790 "); //$NON-NLS-1$
+ }
+ testedValue = declaration.getPropertyValue(TEST_CSS_ATTRIBUTE_NAME);
+
+ assertNotNull(testedValue);
+
+ assertEquals(removeWhitespaces(testedValue),
+ removeWhitespaces(newTestedValue));
+
+ }
+
+ private String removeWhitespaces(String text) {
+ return text.replaceAll(" ", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.jst.css.test.AbstractCSSViewTest#getProjectName()
+ */
+ @Override
+ public String getProjectName() {
+ return IMPORT_PROJECT_NAME;
+ }
+
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/InputFractionalValueTest_JBIDE4790.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native