Skip to content

Commit

Permalink
Upgraded dependencies so we could handle more SVGs
Browse files Browse the repository at this point in the history
Batik 1.9 in particular helps a lot with a particularly problematic
SVG, which has now been added to the tests.
  • Loading branch information
dlew committed Jul 17, 2017
1 parent ab57ea9 commit f2d7447
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
10 changes: 5 additions & 5 deletions victor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

plugins {
id 'nu.studer.plugindev' version '1.0.3'
id 'nu.studer.plugindev' version '1.0.6'

// Should come along with plugindev, but plugindev uses an old version
id 'com.jfrog.bintray' version '1.6'
Expand All @@ -42,11 +42,11 @@ repositories {
// Batik dependencies

dependencies {
compile 'org.apache.xmlgraphics:batik-codec:1.8'
compile 'org.apache.xmlgraphics:batik-anim:1.8'
compile 'org.apache.xmlgraphics:xmlgraphics-commons:2.1'
compile 'org.apache.xmlgraphics:batik-codec:1.9'
compile 'org.apache.xmlgraphics:batik-anim:1.9'
compile 'org.apache.xmlgraphics:xmlgraphics-commons:2.2'
compile 'com.romainpiel.svgtoandroid:svgtoandroid:0.1.0'
testCompile 'junit:junit:4.11'
testCompile 'junit:junit:4.12'
}

// Plugin publishing
Expand Down
15 changes: 15 additions & 0 deletions victor/src/test/groovy/com/trello/victor/ConverterTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@ class ConverterTests {
assertTrue FileUtils.contentEquals(destination, expected)
}

@Test
void canRasterizeProblematicSvg2() {
Converter converter = new Converter()

File svgFile = new File(RESOURCE_PATH, 'problematic2.svg')
SVGResource svgResource = new SVGResource(svgFile, 72)
File destination = new File(OUT_PATH, 'problematic2-rasterize.png')
converter.transcode(svgResource, Density.XXXHDPI, destination)

assertTrue destination.exists()

File expected = new File(RESOURCE_PATH, 'problematic2-rasterize-expected.png')
assertTrue FileUtils.contentEquals(destination, expected)
}

@Test
void ignoresNonexistantFiles() {
Converter converter = new Converter()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions victor/src/test/resources/problematic2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f2d7447

Please sign in to comment.