Author: yradtsevich
Date: 2008-11-29 11:37:04 -0500 (Sat, 29 Nov 2008)
New Revision: 12148
Added:
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide3280/
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide3280/jbide3280.html
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/jbide/
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/jbide/JBIDE3280Test.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlAllTests.java
Log:
RESOLVED - issue JBIDE-3280: Styles crash in <body> tag after refresh button press.
https://jira.jboss.org/jira/browse/JBIDE-3280
- JUnit test has been written
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2008-11-29
15:58:03 UTC (rev 12147)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2008-11-29
16:37:04 UTC (rev 12148)
@@ -86,7 +86,7 @@
public class MozillaEditor extends EditorPart implements IReusableEditor {
protected static final String INIT_URL = /*"file://" +*/ (new
File(VpePlugin.getDefault().getResourcePath("ve"),
"init.html")).getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$
- private static final String CONTENT_AREA_ID = "__content__area__";
//$NON-NLS-1$
+ public static final String CONTENT_AREA_ID = "__content__area__";
//$NON-NLS-1$
static String SELECT_BAR = "SELECT_LBAR"; //$NON-NLS-1$
private XulRunnerEditor xulRunnerEditor;
Added:
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide3280/jbide3280.html
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide3280/jbide3280.html
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide3280/jbide3280.html 2008-11-29
16:37:04 UTC (rev 12148)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
+<title>Insert title here</title>
+</head>
+<body style="color:red;">
+ Red Text
+</body>
+</html>
\ No newline at end of file
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlAllTests.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlAllTests.java 2008-11-29
15:58:03 UTC (rev 12147)
+++
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlAllTests.java 2008-11-29
16:37:04 UTC (rev 12148)
@@ -17,6 +17,7 @@
import junit.framework.TestSuite;
import org.jboss.tools.tests.ImportBean;
+import org.jboss.tools.vpe.html.test.jbide.JBIDE3280Test;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
@@ -36,6 +37,7 @@
TestSuite suite = new TestSuite("Tests for Vpe Jsf components");
//$NON-NLS-1$
// $JUnit-BEGIN$
+ suite.addTestSuite(JBIDE3280Test.class);
suite.addTestSuite(HtmlComponentTest.class);
suite.addTestSuite(HtmlComponentContentTest.class);
Added:
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/jbide/JBIDE3280Test.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/jbide/JBIDE3280Test.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/jbide/JBIDE3280Test.java 2008-11-29
16:37:04 UTC (rev 12148)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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.vpe.html.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.VpeDebug;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.html.test.HtmlAllTests;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
+import org.mozilla.interfaces.nsIDOMDocument;
+
+/**
+ * Check if style of body before refresh equals style of body after refresh
+ *
+ * @author yradtsevich
+ *
+ */
+public class JBIDE3280Test extends VpeTest {
+
+ private static final String TEST_PAGE_NAME="jbide3280/jbide3280.html";
//$NON-NLS-1$
+
+ public JBIDE3280Test(String name) {
+ super(name);
+ }
+
+ public void testJBIDE3280() throws Throwable {
+ setException(null);
+
+ IFile elementPageFile = (IFile) TestUtil.getComponentPath(
+ TEST_PAGE_NAME, HtmlAllTests.IMPORT_PROJECT_NAME);
+
+ IEditorInput input = new FileEditorInput(elementPageFile);
+
+ TestUtil.waitForJobs();
+
+ IEditorPart editor = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().openEditor(input,
+ EDITOR_ID, true);
+
+ assertNotNull(editor);
+
+ TestUtil.waitForJobs();
+
+ VpeController controller = getVpeController((JSPMultiPageEditor) editor);
+
+ final nsIDOMDocument oldDocument = controller.getXulRunnerEditor().getDOMDocument();
+ final String oldStyle = oldDocument
+ .getElementById(MozillaEditor.CONTENT_AREA_ID)
+ .getAttribute(HTML.ATTR_STYLE);
+
+ controller.visualRefresh();
+
+ TestUtil.waitForIdle();
+
+ final nsIDOMDocument newDocument = controller.getXulRunnerEditor().getDOMDocument();
+ final String newStyle = newDocument
+ .getElementById(MozillaEditor.CONTENT_AREA_ID)
+ .getAttribute(HTML.ATTR_STYLE);
+
+
+ // check if style of body before refresh equals style of body after refresh
+ assertEquals(oldStyle, newStyle);
+
+ if (getException() != null) {
+ throw getException();
+ }
+ }
+
+ protected String dump(nsIDOMDocument document) {
+ DOMTreeDumper dumper = new DOMTreeDumper(
+ VpeDebug.VISUAL_DUMP_PRINT_HASH);
+ dumper.setIgnoredAttributes(VpeDebug.VISUAL_DUMP_IGNORED_ATTRIBUTES);
+ dumper.dumpToStream(System.out, document);
+ return null;
+ }
+}