/bundles/plugins-trunk/XML/test/sidekick/html/HtmlParserTest.java
Java | 89 lines | 48 code | 20 blank | 21 comment | 0 complexity | af521d7c0bc867146fc1222e3ccbbd74 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
- /*
- * HtmlParserTest.java
- * :folding=explicit:collapseFolds=1:
- *
- * Copyright (C) 2010 Eric Le Lay
- *
- * The XML plugin is licensed under the GNU General Public License, with
- * the following exception:
- *
- * "Permission is granted to link this code with software released under
- * the Apache license version 1.1, for example used by the Xerces XML
- * parser package."
- */
- package sidekick.html;
- // {{{ jUnit imports
- import java.util.concurrent.TimeUnit;
- import org.junit.*;
- import static org.junit.Assert.*;
- import org.fest.swing.fixture.*;
- import org.fest.swing.core.*;
- import org.fest.swing.finder.*;
- import org.fest.swing.edt.*;
- import org.fest.swing.timing.*;
- import static org.fest.assertions.Assertions.*;
- import org.gjt.sp.jedit.testframework.Log;
- import static xml.XMLTestUtils.*;
- import static org.gjt.sp.jedit.testframework.EBFixture.*;
- import static org.gjt.sp.jedit.testframework.TestUtils.*;
- import org.gjt.sp.jedit.testframework.PluginOptionsFixture;
- import org.gjt.sp.jedit.testframework.TestUtils;
- // }}}
- import java.io.*;
- import org.gjt.sp.jedit.textarea.JEditTextArea;
- /**
- * $Id: HtmlParserTest.java 21248 2012-03-05 19:37:01Z kerik-sf $
- */
- public class HtmlParserTest{
- private static File testData;
- @BeforeClass
- public static void setUpjEdit() throws IOException{
- TestUtils.beforeClass();
- testData = new File(System.getProperty("test_data")).getCanonicalFile();
- assertTrue(testData.exists());
- }
- @AfterClass
- public static void tearDownjEdit() {
- TestUtils.afterClass();
- }
- @Test
- public void testErrorInCss(){
- File xml = new File(testData,"html/error_in_css.html");
-
- openParseAndWait(xml.getPath());
-
- action("sidekick-tree");
-
- FrameFixture sidekick = TestUtils.findFrameByTitle("Sidekick");
- JTreeFixture sourceTree = sidekick.tree();
-
- // inspect the tree
- selectPath(sourceTree,",<html><html>,<head>,<STYLE type=\"text/css\">");
-
- // ensure some coherence in the assets
- JEditTextArea area = TestUtils.view().getTextArea();
- assertEquals("<style", area.getBuffer().getText(area.getCaretPosition(),6));
-
- // ensure that errors in CSS are reported at the correct location
- action("error-list-show",1);
-
- FrameFixture errorlist = TestUtils.findFrameByTitle("Error List");
- errorlist.resizeWidthTo(1024);
- errorlist.tree().selectRow(1);
- assertEquals(";",area.getSelectedText());
- assertEquals(2,area.getCaretLine());
- }
-
- }