diff options
| author | luccioman <luccioman@users.noreply.github.com> | 2017-10-18 07:53:07 +0200 |
|---|---|---|
| committer | luccioman <luccioman@users.noreply.github.com> | 2017-10-18 07:53:07 +0200 |
| commit | 285f0d6a39478202e432776eee20e9eb1ebc5282 (patch) | |
| tree | cf07f930da24802d354036d7647d81ea8fea529c /test | |
| parent | 4da15db9983f53be542147345c4ae355e8692656 (diff) | |
Consistently encode snapshot image with format requested on the API.
Previously, calling /api/snapshot.png rendered JPEG encoded images.
Diffstat (limited to 'test')
| -rw-r--r-- | test/java/net/yacy/cora/util/Html2ImageTest.java | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/test/java/net/yacy/cora/util/Html2ImageTest.java b/test/java/net/yacy/cora/util/Html2ImageTest.java index 4274cd6df..2e92c2e23 100644 --- a/test/java/net/yacy/cora/util/Html2ImageTest.java +++ b/test/java/net/yacy/cora/util/Html2ImageTest.java @@ -1,3 +1,24 @@ +// Html2ImageTest.java
+// Copyright 2016,2017 by reger; https://github.com/reger24 luccioman; https://github.com/luccioman
+//
+// This is a part of YaCy, a peer-to-peer based web search engine
+//
+// LICENSE
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
package net.yacy.cora.util;
import java.io.File;
@@ -38,8 +59,19 @@ public class Html2ImageTest { if (jpgfile.exists()) {
jpgfile.delete();
}
- Html2Image.pdf2image(pdffile, jpgfile, 1024, 1024, 300, 75);
+ assertTrue(Html2Image.pdf2image(pdffile, jpgfile, 1024, 1024, 300, 75));
assertTrue(jpgfile.exists());
+ assertTrue(jpgfile.length() > 0);
+ System.out.println("Test image file successfully written : " + jpgfile.getAbsolutePath());
+
+ final File pngFile = new File("test/DATA", pdffilename + ".png");
+ if (pngFile.exists()) {
+ pngFile.delete();
+ }
+ assertTrue(Html2Image.pdf2image(pdffile, pngFile, 1024, 1024, 300, 75));
+ assertTrue(pngFile.exists());
+ assertTrue(pngFile.length() > 0);
+ System.out.println("Test image file successfully written : " + pngFile.getAbsolutePath());
}
}
|
