Skip to content

Commit

Permalink
Reseting chapter count for tests consistency
Browse files Browse the repository at this point in the history
Identation fix ~~
  • Loading branch information
marcosalles committed Sep 18, 2014
1 parent 460a9a8 commit 408ddaa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,31 @@ public void testImageTagWithoutBounds() {

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

@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);
}

@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);
}

@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>Figura 0.1</i></div><br><br>";
Expand All @@ -75,6 +79,7 @@ public void testImageTagWithoutPercentageSymbol() {

@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>Figura 0.1</i></div><br><br>";
Expand All @@ -83,6 +88,7 @@ public void shouldUseLabelAsId() throws Exception {

@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>");
Expand Down
23 changes: 11 additions & 12 deletions src/test/java/br/com/caelum/tubaina/parser/latex/ImageTagTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,25 +153,24 @@ public void imageTagWithoutDefinedImageProportionShouldConstrainToPageWidthWhenI
}

@Test
public void shouldParseLabelEvenWithStrangeChars() throws Exception {
public void shouldParseLabelEvenWithStrangeChars() throws Exception {
ImageChunk chunk = makeChunk("image.png", "label=name-with-strange_chars");
String result = getContent(chunk);
assertEquals(
BEGIN +
"\\includegraphics[width=\\textwidth]{image.png}\n" +
assertEquals(
BEGIN +
"\\includegraphics[width=\\textwidth]{image.png}\n" +
NO_CAPTION +
"\\label{name-with-strange_chars}\n" +
END, result);

}
"\\label{name-with-strange_chars}\n" +
END, result);
}

@Test
public void shouldParseTagsInsideSubtitle() {
public void shouldParseTagsInsideSubtitle() {
ImageChunk chunk = makeChunk("blabla.png", "\"lala **bold text** http://caelum.com.br/ \"");
String output = getContent(chunk);
assertTrue(output.contains("\\url"));
assertTrue(output.contains("\\definition"));
}
assertTrue(output.contains("\\url"));
assertTrue(output.contains("\\definition"));
}

private ImageChunk makeChunk(String path, String options) {
ImageChunk chunk = new ImageChunk(path, options, 100, 1, new SectionsManager());
Expand Down

0 comments on commit 408ddaa

Please sign in to comment.