package de.codecentric.centerdevice.javafxsvg;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;

import java.io.InputStream;

import javafx.scene.Parent;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;

import org.junit.BeforeClass;
import org.junit.Test;
import org.loadui.testfx.GuiTest;

import de.codecentric.centerdevice.javafxsvg.bounds.AttributeDimensionProvider;

public class TestLoadImageUsingClass extends GuiTest {

	@BeforeClass
	public static void installSvgLoader() {
		SvgImageLoaderFactory.install(new AttributeDimensionProvider());
	}

	@Override
	protected Parent getRootNode() {
		InputStream imageData = this.getClass().getClassLoader()
				.getResourceAsStream("bacon.svg");

		Image image = new Image(imageData);
		ImageView imageView = new ImageView(image);
		imageView.setId("TestImage");

		return new AnchorPane(imageView);
	}

	@Test
	public void imageShouldBeVisible() {
		ImageView imageView = find("#TestImage");
		Image image = imageView.getImage();

		assertNotNull(image);
		assertFalse(image.errorProperty().get());
	}
}

@@ -161,16 +161,104 @@
 tream;%0A%0A
+import org.junit.BeforeClass;%0Aimport org.junit.Test;%0Aimport org.loadui.testfx.GuiTest;%0A%0A
 import j
@@ -391,177 +391,8 @@
 e;%0A%0A
-import org.junit.BeforeClass;%0Aimport org.junit.Test;%0Aimport org.loadui.testfx.GuiTest;%0A%0Aimport de.codecentric.centerdevice.javafxsvg.bounds.AttributeDimensionProvider;%0A%0A
 publ
@@ -534,40 +534,8 @@
 all(
-new AttributeDimensionProvider()
 );%0A%09

Remove custom dimension provider