Package org.apache.fop.render.ps

Examples of org.apache.fop.render.ps.PSDictionary$Maker$Token


  /**
   * Tests {@link HtmlAutocompleter#putModeAnchors}.
   */
  public void testPutModeAnchors() {
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<html"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.WHITESPACE, " "));

    prepareAutocompleter();

    Document document = helper.editor.getDocument();
    Line line = document.getFirstLine();
View Full Code Here


    SimpleStringBag excluded = new SimpleStringBag();
    assertEquals(1, htmlAttributes.searchAttributes("html", excluded, sampleAttribute).size());
    excluded.add(sampleAttribute);

    JsonArray<Token> tokens1 = JsonCollections.createArray();
    tokens1.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<html"));
    tokens1.add(new Token(CodeMirror2.HTML, TokenType.WHITESPACE, " "));
    String line1 = tokensToText(tokens1);
    parsedLines.put(line1, tokens1);

    JsonArray<Token> tokens2 = JsonCollections.createArray();
    tokens2.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, sampleAttribute));
    String line2 = tokensToText(tokens2);
    parsedLines.put(line2, tokens2);

    JsonArray<Token> tokens3 = JsonCollections.createArray();
    tokens3.add(new Token(CodeMirror2.HTML, TokenType.WHITESPACE, " "));
    String line3 = tokensToText(tokens3);
    parsedLines.put(line3, tokens3);

    String text = line1 + "\n" + line2 + "\n ";
    helper.setup(path, text, 0, line1.length(), false);
View Full Code Here

  /**
   * Tests that find autocompletions do not ruin existing "clean" results.
   */
  public void testFindDoNotRuinResults() {
    String id = "id";
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<html"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.WHITESPACE, " "));

    prepareAutocompleter();
    HtmlTagWithAttributes before = helper.editor.getDocument().getFirstLine().getTag(
        XmlCodeAnalyzer.TAG_END_TAG);
    assertNotNull(before);

    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, id));
    helper.autocompleter.htmlAutocompleter.findAutocompletions(
        helper.editor.getSelection(), CTRL_SPACE);
    HtmlTagWithAttributes after = helper.editor.getDocument().getFirstLine().getTag(
        XmlCodeAnalyzer.TAG_END_TAG);

View Full Code Here

    HtmlTagsAndAttributes htmlAttributes = HtmlTagsAndAttributes.getInstance();
    SimpleStringBag excluded = new SimpleStringBag();
    assertEquals(1, htmlAttributes.searchAttributes("ol", excluded, reversed).size());
    excluded.add(reversed);

    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<ol"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.WHITESPACE, " "));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, reversed));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATOM, "="));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.STRING, "\"\""));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.WHITESPACE, " "));
    AutocompleteProposals proposals = findAutocompletions();

    assertEquals(htmlAttributes.searchAttributes("ol", excluded, "").size(), proposals.size());
    assertEquals("accesskey", proposals.get(0).getName());
    assertNull(TestUtils.selectProposalByName(proposals, reversed));
View Full Code Here

  /**
   * Tests the proposals for ELEMENT.
   */
  public void testAutocompleteHtmlElements() {
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<a"));
    AutocompleteProposals proposals = findAutocompletions();

    assertEquals(7, proposals.size());
    assertEquals("abbr", proposals.get(1).getName());

    lineTokens.clear();
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<bod"));
    proposals = findAutocompletions();
    assertEquals(1, proposals.size());
    assertEquals("body", proposals.get(0).getName());

    lineTokens.clear();
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<body"));
    assertEquals(1, findAutocompletions().size());

    lineTokens.clear();
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<body"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, ">"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "</body"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, ">"));
    assertTrue(findAutocompletions().isEmpty());

    lineTokens.clear();
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<"));
    assertEquals(
        HtmlTagsAndAttributes.getInstance().searchTags("").size(), findAutocompletions().size());
  }
View Full Code Here

  /**
   * Tests the autocompletion of self-closing tag.
   */
  public void testAutocompleteSelfClosingTag() {
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<lin"));
    AutocompleteProposals autocompletions = findAutocompletions();
    assertNotNull(autocompletions);
    ProposalWithContext linkProposal = TestUtils.selectProposalByName(autocompletions, "link");
    assertNotNull(linkProposal);
    AutocompleteResult commonResult =
View Full Code Here

  /**
   * Tests full autocompletion for ATTRIBUTE.
   */
  public void testJumpLengthAndFullAutocompletionHtmlAttribute() {
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<body"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.WHITESPACE, " "));
    AutocompleteProposals autocompletions = findAutocompletions();
    assertNotNull(autocompletions);
    ProposalWithContext onloadProposal = TestUtils.selectProposalByName(autocompletions, "onload");
    assertNotNull(onloadProposal);
    AutocompleteResult commonResult =
View Full Code Here

  /**
   * Tests full autocompletion for ELEMENT.
   */
  public void testJumpLengthAndFullAutocompletionHtmlElement() {
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<bod"));
    AutocompleteProposals autocompletions = findAutocompletions();
    assertNotNull(autocompletions);
    ProposalWithContext bodyProposal = TestUtils.selectProposalByName(autocompletions, "body");
    assertNotNull(bodyProposal);

View Full Code Here

      tokens.add(JsonCollections.<Token>createArray());
    }
    JsonArray<Token> lineTokens;

    lineTokens = tokens.get(1);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<html"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "first"));

    lineTokens = tokens.get(2);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "second"));

    lineTokens = tokens.get(3);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "third"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, ">"));

    codeAnalyzer.onBeforeParse();
    for (int i = 1; i <= 3; i++) {
      codeAnalyzer.onParseLine(lines.get(i - 1), lines.get(i), tokens.get(i));
    }
View Full Code Here

      tokens.add(JsonCollections.<Token>createArray());
    }
    JsonArray<Token> lineTokens;

    lineTokens = tokens.get(1);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<html"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "first"));

    lineTokens = tokens.get(2);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "second"));

    lineTokens = tokens.get(3);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "third"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, ">"));

    codeAnalyzer.onBeforeParse();
    for (int i = 1; i <= 3; i++) {
      codeAnalyzer.onParseLine(lines.get(i - 1), lines.get(i), tokens.get(i));
    }
    codeAnalyzer.onAfterParse();

    lineTokens = tokens.get(2);
    lineTokens.clear();
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "fixed"));

    codeAnalyzer.onBeforeParse();
    for (int i = 2; i <= 3; i++) {
      codeAnalyzer.onParseLine(lines.get(i - 1), lines.get(i), tokens.get(i));
    }
View Full Code Here

TOP

Related Classes of org.apache.fop.render.ps.PSDictionary$Maker$Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.