PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/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
  1. /*
  2. * HtmlParserTest.java
  3. * :folding=explicit:collapseFolds=1:
  4. *
  5. * Copyright (C) 2010 Eric Le Lay
  6. *
  7. * The XML plugin is licensed under the GNU General Public License, with
  8. * the following exception:
  9. *
  10. * "Permission is granted to link this code with software released under
  11. * the Apache license version 1.1, for example used by the Xerces XML
  12. * parser package."
  13. */
  14. package sidekick.html;
  15. // {{{ jUnit imports
  16. import java.util.concurrent.TimeUnit;
  17. import org.junit.*;
  18. import static org.junit.Assert.*;
  19. import org.fest.swing.fixture.*;
  20. import org.fest.swing.core.*;
  21. import org.fest.swing.finder.*;
  22. import org.fest.swing.edt.*;
  23. import org.fest.swing.timing.*;
  24. import static org.fest.assertions.Assertions.*;
  25. import org.gjt.sp.jedit.testframework.Log;
  26. import static xml.XMLTestUtils.*;
  27. import static org.gjt.sp.jedit.testframework.EBFixture.*;
  28. import static org.gjt.sp.jedit.testframework.TestUtils.*;
  29. import org.gjt.sp.jedit.testframework.PluginOptionsFixture;
  30. import org.gjt.sp.jedit.testframework.TestUtils;
  31. // }}}
  32. import java.io.*;
  33. import org.gjt.sp.jedit.textarea.JEditTextArea;
  34. /**
  35. * $Id: HtmlParserTest.java 21248 2012-03-05 19:37:01Z kerik-sf $
  36. */
  37. public class HtmlParserTest{
  38. private static File testData;
  39. @BeforeClass
  40. public static void setUpjEdit() throws IOException{
  41. TestUtils.beforeClass();
  42. testData = new File(System.getProperty("test_data")).getCanonicalFile();
  43. assertTrue(testData.exists());
  44. }
  45. @AfterClass
  46. public static void tearDownjEdit() {
  47. TestUtils.afterClass();
  48. }
  49. @Test
  50. public void testErrorInCss(){
  51. File xml = new File(testData,"html/error_in_css.html");
  52. openParseAndWait(xml.getPath());
  53. action("sidekick-tree");
  54. FrameFixture sidekick = TestUtils.findFrameByTitle("Sidekick");
  55. JTreeFixture sourceTree = sidekick.tree();
  56. // inspect the tree
  57. selectPath(sourceTree,",<html>&lt;html&gt;,<head>,<STYLE type=\"text/css\">");
  58. // ensure some coherence in the assets
  59. JEditTextArea area = TestUtils.view().getTextArea();
  60. assertEquals("<style", area.getBuffer().getText(area.getCaretPosition(),6));
  61. // ensure that errors in CSS are reported at the correct location
  62. action("error-list-show",1);
  63. FrameFixture errorlist = TestUtils.findFrameByTitle("Error List");
  64. errorlist.resizeWidthTo(1024);
  65. errorlist.tree().selectRow(1);
  66. assertEquals(";",area.getSelectedText());
  67. assertEquals(2,area.getCaretLine());
  68. }
  69. }