Package br.com.caelum.tubaina.chunk

Examples of br.com.caelum.tubaina.chunk.ImageChunk


      throw new TubainaException("Image not existant", e);
    } catch (NullPointerException e) {
      throw new TubainaException(path + " is not a valid image");
    }
    resources.add(new ImageResource(image, matcher.group(2)));
    return new ImageChunk(path, matcher.group(2), width);
  }
View Full Code Here


  }

  @Test
  public void testFullImageTag() {
    ChapterBuilder.restartChapterCounter();
    ImageChunk chunk = makeChunk("imagem.png", "w=30 \"Imagem de alguma coisa\"", 30);
    String result = tag.parse(chunk, false);
    assertEquals(imageWithSubtitle, result);
  }
View Full Code Here

  }

  @Test
  public void testImageTagWithoutBounds() {
    ChapterBuilder.restartChapterCounter();
    ImageChunk chunk = makeChunk("imagem.png", "\"Imagem de alguma coisa\"", 100);
    String result = tag.parse(chunk, false);
    assertEquals(imageWithSubtitle, result);
  }
View Full Code Here

  }

  @Test
  public void testImageTagWithoutDesc() {
    ChapterBuilder.restartChapterCounter();
    ImageChunk chunk = makeChunk("imagem.png", "w=42", 42);
    String result = tag.parse(chunk, false);
    assertEquals(imageWithoutSubtitle, result);
  }
View Full Code Here

  }
 
  @Test
  public void testImageTagWithPath() {
    ChapterBuilder.restartChapterCounter();
    ImageChunk chunk = makeChunk("some/path/imagem.png", "w=42", 42);
    String result = tag.parse(chunk, false);
    assertEquals(imageWithoutSubtitle, result);
  }
View Full Code Here

  }
 
  @Test
  public void testImageTagWithPercentageSymbol() {
    ChapterBuilder.restartChapterCounter();
    ImageChunk chunk = makeChunk("some/path/imagem.png", "w=50%", 50);
    String result = tag.parse(chunk, false);
    assertEquals(imageWithoutSubtitle, result);
  }
View Full Code Here

  }
 
  @Test
  public void testImageTagWithoutPercentageSymbol() {
    ChapterBuilder.restartChapterCounter();
    ImageChunk chunk = makeChunk("some/path/imagem.png", "w=50", 50);
    String result = tag.parse(chunk, true);
    String imageWithWidthWithoutPercentageSymbol = "<img src=\"$$RELATIVE$$/imagem.png\" id=\"imagem.png\" width='50%' alt=\"imagem.png\" />\n<div><i>Fig. 0.1</i></div><br><br>";
    assertEquals(imageWithWidthWithoutPercentageSymbol, result);
  }
View Full Code Here

  }
 
  @Test
  public void shouldUseLabelAsId() throws Exception {
    ChapterBuilder.restartChapterCounter();
    ImageChunk chunk = makeChunk("imagem.png", "w=50 label=image-label", 50);
    String result = tag.parse(chunk, true);
      String imageUsingLabelAsId = "<img src=\"$$RELATIVE$$/imagem.png\" id=\"image-label\" width='50%' alt=\"imagem.png\" />\n<div><i>Fig. 0.1</i></div><br><br>";
    assertEquals(imageUsingLabelAsId, result);
  }
View Full Code Here

  }
 
  @Test
  public void shouldParseTagsInsideCaption() throws Exception {
    ChapterBuilder.restartChapterCounter();
    ImageChunk chunk = makeChunk("imagem.png", "\"Configurações de zoom do Android 4 e do **Chrome** http://google.com.br/ Mobile\"", 50);
    String result = tag.parse(chunk, true);
    result.contains("<strong>");
    result.contains("href=\"http://google.com/\"");
  }
View Full Code Here

    result.contains("<strong>");
    result.contains("href=\"http://google.com/\"");
  }
 
  private ImageChunk makeChunk(String path, String options, int width) {
    return new ImageChunk(path, options, width, 1, new SectionsManager());
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.tubaina.chunk.ImageChunk

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.