/imageio/imageio-batik/src/test/java/com/twelvemonkeys/imageio/plugins/svg/SVGImageReaderTestCase.java

https://github.com/conceptboard/TwelveMonkeys · Java · 78 lines · 33 code · 11 blank · 34 comment · 0 complexity · 975764b0f3bb1fbd935226e4d15866d9 MD5 · raw file

  1. /*
  2. * Copyright (c) 2008, Harald Kuhr
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name "TwelveMonkeys" nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  17. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  19. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  20. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  23. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  24. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  25. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. package com.twelvemonkeys.imageio.plugins.svg;
  29. import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
  30. import javax.imageio.spi.ImageReaderSpi;
  31. import java.awt.*;
  32. import java.util.Arrays;
  33. import java.util.List;
  34. /**
  35. * SVGImageReaderTestCase
  36. *
  37. * @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
  38. * @author last modified by $Author: haraldk$
  39. * @version $Id: SVGImageReaderTestCase.java,v 1.0 Apr 1, 2008 10:39:17 PM haraldk Exp$
  40. */
  41. public class SVGImageReaderTestCase extends ImageReaderAbstractTestCase<SVGImageReader> {
  42. private SVGImageReaderSpi mSVGImageReaderSpi = new SVGImageReaderSpi();
  43. protected List<TestData> getTestData() {
  44. return Arrays.asList(
  45. new TestData(getClassLoaderResource("/svg/batikLogo.svg"), new Dimension(450, 500))
  46. );
  47. }
  48. protected ImageReaderSpi createProvider() {
  49. return mSVGImageReaderSpi;
  50. }
  51. @Override
  52. protected SVGImageReader createReader() {
  53. return new SVGImageReader(createProvider());
  54. }
  55. protected Class<SVGImageReader> getReaderClass() {
  56. return SVGImageReader.class;
  57. }
  58. protected List<String> getFormatNames() {
  59. return Arrays.asList("svg");
  60. }
  61. protected List<String> getSuffixes() {
  62. return Arrays.asList("svg");
  63. }
  64. protected List<String> getMIMETypes() {
  65. return Arrays.asList("image/svg+xml");
  66. }
  67. }