mirror of https://github.com/rusefi/jzy3d-api.git
Update baseline image with new text renderer
This commit is contained in:
parent
9d992d8398
commit
d5311e6633
|
@ -588,7 +588,7 @@ public class EmulGLCanvas extends GLCanvas implements IScreenCanvas, IMonitorabl
|
|||
|
||||
@Override
|
||||
public String getDebugInfo() {
|
||||
return null;
|
||||
return "EmulGL (CPU rendering)";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ public class ITTestEmulGLDisk {
|
|||
|
||||
// Then
|
||||
ChartTester tester = new ChartTester();
|
||||
tester.assertSimilar(chart,
|
||||
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
|
||||
tester.assertSimilar(chart, tester.path(this));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,14 +21,13 @@ public class ITTestEmulGLScatterChart {
|
|||
|
||||
EmulGLCanvas c = (EmulGLCanvas) chart.getCanvas();
|
||||
c.setProfileDisplayMethod(false);
|
||||
//c.getGL().setAutoAdaptToHiDPI(false);
|
||||
// c.getGL().setAutoAdaptToHiDPI(false);
|
||||
|
||||
chart.add(scatter());
|
||||
|
||||
// Then
|
||||
ChartTester tester = new ChartTester();
|
||||
tester.assertSimilar(chart,
|
||||
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
|
||||
tester.assertSimilar(chart, tester.path(this));
|
||||
}
|
||||
|
||||
private static Scatter scatter() {
|
||||
|
|
|
@ -22,8 +22,8 @@ public class ITTestEmulGLSurfaceChart {
|
|||
// When
|
||||
EmulGLChartFactory factory = new EmulGLChartFactory();
|
||||
Chart chart = factory.newChart(Quality.Advanced());
|
||||
|
||||
//System.out.println(chart.getQuality().isAlphaActivated());
|
||||
|
||||
// System.out.println(chart.getQuality().isAlphaActivated());
|
||||
|
||||
EmulGLCanvas c = (EmulGLCanvas) chart.getCanvas();
|
||||
c.setProfileDisplayMethod(false);
|
||||
|
@ -33,8 +33,7 @@ public class ITTestEmulGLSurfaceChart {
|
|||
|
||||
// Then
|
||||
ChartTester tester = new ChartTester();
|
||||
tester.assertSimilar(chart,
|
||||
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
|
||||
tester.assertSimilar(chart, tester.path(this));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,14 +9,13 @@ import java.util.List;
|
|||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jzy3d.awt.AWTHelper;
|
||||
import org.jzy3d.chart.IAnimator;
|
||||
import org.jzy3d.chart.factories.IChartFactory;
|
||||
import org.jzy3d.chart.factories.NativePainterFactory;
|
||||
import org.jzy3d.maths.Coord2d;
|
||||
import org.jzy3d.painters.IPainter;
|
||||
import org.jzy3d.painters.NativeDesktopPainter;
|
||||
import org.jzy3d.plot3d.GPUInfo;
|
||||
import org.jzy3d.plot3d.rendering.scene.Scene;
|
||||
import org.jzy3d.plot3d.rendering.view.Renderer3d;
|
||||
import org.jzy3d.plot3d.rendering.view.View;
|
||||
|
@ -203,30 +202,10 @@ public class CanvasAWT extends GLCanvas implements IScreenCanvas, INativeCanvas
|
|||
GLCapabilitiesImmutable caps = getChosenGLCapabilities();
|
||||
|
||||
GL gl = (GL) painter.acquireGL();
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("Capabilities : " + caps + "\n");
|
||||
sb.append("GL_VENDOR : " + gl.glGetString(GL.GL_VENDOR) + "\n");
|
||||
sb.append("GL_RENDERER : " + gl.glGetString(GL.GL_RENDERER) + "\n");
|
||||
sb.append("GL_VERSION : " + gl.glGetString(GL.GL_VERSION) + "\n");
|
||||
|
||||
String ext = gl.glGetString(GL.GL_EXTENSIONS);
|
||||
|
||||
if(ext!=null) {
|
||||
sb.append("GL_EXTENSIONS : " + "\n");
|
||||
for(String e: ext.split(" ")) {
|
||||
sb.append("\t" + e + "\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
sb.append("GL_EXTENSIONS : null\n");
|
||||
}
|
||||
|
||||
// sb.append("INIT GL IS: " + gl.getClass().getName() + "\n");
|
||||
|
||||
GPUInfo info = GPUInfo.load(gl);
|
||||
painter.releaseGL();
|
||||
|
||||
return sb.toString();
|
||||
return "Capabilities : " + caps + "\n" + info.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,7 +8,7 @@ public class Test_GraphicConfig {
|
|||
public static void main(String[] args) {
|
||||
final GraphicsDevice awtDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
|
||||
System.out.println(awtDevice);
|
||||
|
||||
|
||||
for(GraphicsConfiguration c: awtDevice.getConfigurations()) {
|
||||
System.out.println(c);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package jogl;
|
|||
|
||||
import org.junit.Test;
|
||||
import org.jzy3d.os.OperatingSystem;
|
||||
import org.jzy3d.plot3d.GPUInfo;
|
||||
import com.jogamp.opengl.GL;
|
||||
import com.jogamp.opengl.GLAutoDrawable;
|
||||
import com.jogamp.opengl.GLCapabilities;
|
||||
|
@ -76,7 +77,7 @@ public class Test_OpenGLVersion {
|
|||
System.out.println("CAPS (found) : " + drawable.getChosenGLCapabilities());
|
||||
|
||||
System.out.println("--------------------------------------------------");
|
||||
System.out.println(getDebugInfo(gl));
|
||||
System.out.println(GPUInfo.load(gl));
|
||||
|
||||
System.out.println("--------------------------------------------------");
|
||||
System.out.println(drawable.getContext());
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
package org.jzy3d.plot3d;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.jogamp.opengl.GL;
|
||||
import com.jogamp.opengl.GLAutoDrawable;
|
||||
import com.jogamp.opengl.GLCapabilities;
|
||||
import com.jogamp.opengl.GLDrawableFactory;
|
||||
import com.jogamp.opengl.GLProfile;
|
||||
|
||||
public class GPUInfo {
|
||||
protected String vendor;
|
||||
protected String renderer;
|
||||
protected String version;
|
||||
protected List<String> extensions = new ArrayList<>();
|
||||
|
||||
public static void main(String[] args) {
|
||||
GPUInfo gpu = GPUInfo.load();
|
||||
|
||||
System.out.println("GPU : " + gpu.renderer + "\n");
|
||||
}
|
||||
|
||||
/** Initialize a GL context offscreen to query GPU information */
|
||||
public static GPUInfo load() {
|
||||
GLProfile glp = GLProfile.getMaxProgrammable(true);
|
||||
GLCapabilities caps = new GLCapabilities(glp);
|
||||
caps.setOnscreen(false);
|
||||
GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
|
||||
GLAutoDrawable drawable =
|
||||
factory.createOffscreenAutoDrawable(factory.getDefaultDevice(), caps, null, 1, 1);
|
||||
drawable.display();
|
||||
drawable.getContext().makeCurrent();
|
||||
|
||||
GL gl = drawable.getContext().getGL();
|
||||
|
||||
//System.out.println(drawable.getContext().getGLVendorVersionNumber());
|
||||
|
||||
|
||||
GPUInfo gpu = load(gl);
|
||||
|
||||
drawable.getContext().release();
|
||||
|
||||
return gpu;
|
||||
}
|
||||
|
||||
/** Use an existing GL context to query GPU information */
|
||||
public static GPUInfo load(GL gl) {
|
||||
// Load Info
|
||||
GPUInfo gpu = new GPUInfo();
|
||||
gpu.vendor = gl.glGetString(GL.GL_VENDOR);
|
||||
gpu.renderer = gl.glGetString(GL.GL_RENDERER);
|
||||
gpu.version = gl.glGetString(GL.GL_VERSION);
|
||||
|
||||
String ext = gl.glGetString(GL.GL_EXTENSIONS);
|
||||
|
||||
if(ext!=null) {
|
||||
for(String e: ext.split(" ")) {
|
||||
gpu.extensions.add(e);
|
||||
}
|
||||
}
|
||||
return gpu;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("GL_VENDOR : " + vendor + "\n");
|
||||
sb.append("GL_RENDERER : " + renderer + "\n");
|
||||
sb.append("GL_VERSION : " + version + "\n");
|
||||
|
||||
if(extensions!=null) {
|
||||
sb.append("GL_EXTENSIONS : (" + extensions.size() + ")\n");
|
||||
for(String e: extensions) {
|
||||
sb.append("\t" + e + "\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
sb.append("GL_EXTENSIONS : null\n");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getVendor() {
|
||||
return vendor;
|
||||
}
|
||||
|
||||
public void setVendor(String vendor) {
|
||||
this.vendor = vendor;
|
||||
}
|
||||
|
||||
public String getRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
public void setRenderer(String renderer) {
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public List<String> getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
public void setExtensions(List<String> extensions) {
|
||||
this.extensions = extensions;
|
||||
}
|
||||
}
|
|
@ -8,13 +8,16 @@ import org.apache.logging.log4j.LogManager;
|
|||
import org.jzy3d.chart.factories.IChartFactory;
|
||||
import org.jzy3d.chart.factories.NativePainterFactory;
|
||||
import org.jzy3d.maths.Coord2d;
|
||||
import org.jzy3d.painters.IPainter;
|
||||
import org.jzy3d.painters.NativeDesktopPainter;
|
||||
import org.jzy3d.plot3d.GPUInfo;
|
||||
import org.jzy3d.plot3d.pipelines.NotImplementedException;
|
||||
import org.jzy3d.plot3d.rendering.scene.Scene;
|
||||
import org.jzy3d.plot3d.rendering.view.Renderer3d;
|
||||
import org.jzy3d.plot3d.rendering.view.View;
|
||||
import com.jogamp.opengl.GL;
|
||||
import com.jogamp.opengl.GLCapabilities;
|
||||
import com.jogamp.opengl.GLCapabilitiesImmutable;
|
||||
import com.jogamp.opengl.GLDrawableFactory;
|
||||
import com.jogamp.opengl.GLFBODrawable;
|
||||
import com.jogamp.opengl.GLOffscreenAutoDrawable;
|
||||
|
@ -181,19 +184,21 @@ public class OffscreenCanvas implements ICanvas, INativeCanvas {
|
|||
public Renderer3d getRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getDebugInfo() {
|
||||
GL gl = ((NativeDesktopPainter) getView().getPainter()).getCurrentGL(this);
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("Chosen GLCapabilities: " + offscreenDrawable.getChosenGLCapabilities() + "\n");
|
||||
sb.append("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR) + "\n");
|
||||
sb.append("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\n");
|
||||
sb.append("GL_VERSION: " + gl.glGetString(GL.GL_VERSION) + "\n");
|
||||
return sb.toString();
|
||||
IPainter painter = getView().getPainter();
|
||||
|
||||
GLCapabilitiesImmutable caps = offscreenDrawable.getChosenGLCapabilities();
|
||||
|
||||
GL gl = (GL) painter.acquireGL();
|
||||
GPUInfo info = GPUInfo.load(gl);
|
||||
painter.releaseGL();
|
||||
|
||||
return "Capabilities : " + caps + "\n" + info.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addMouseController(Object o) {}
|
||||
|
||||
|
|
|
@ -17,7 +17,9 @@ import org.jzy3d.chart.NativeAnimator;
|
|||
import org.jzy3d.chart.factories.IChartFactory;
|
||||
import org.jzy3d.chart.factories.NativePainterFactory;
|
||||
import org.jzy3d.maths.Coord2d;
|
||||
import org.jzy3d.painters.IPainter;
|
||||
import org.jzy3d.painters.NativeDesktopPainter;
|
||||
import org.jzy3d.plot3d.GPUInfo;
|
||||
import org.jzy3d.plot3d.rendering.scene.Scene;
|
||||
import org.jzy3d.plot3d.rendering.view.Renderer3d;
|
||||
import org.jzy3d.plot3d.rendering.view.View;
|
||||
|
@ -222,15 +224,15 @@ public class CanvasNewtAwt extends Panel implements IScreenCanvas, INativeCanvas
|
|||
|
||||
@Override
|
||||
public String getDebugInfo() {
|
||||
GL gl = ((NativeDesktopPainter) getView().getPainter()).getCurrentGL(this);
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("Chosen GLCapabilities: " + window.getChosenGLCapabilities() + "\n");
|
||||
sb.append("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR) + "\n");
|
||||
sb.append("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\n");
|
||||
sb.append("GL_VERSION: " + gl.glGetString(GL.GL_VERSION) + "\n");
|
||||
// sb.append("INIT GL IS: " + gl.getClass().getName() + "\n");
|
||||
return sb.toString();
|
||||
IPainter painter = getView().getPainter();
|
||||
|
||||
GLCapabilitiesImmutable caps = window.getChosenGLCapabilities();
|
||||
|
||||
GL gl = (GL) painter.acquireGL();
|
||||
GPUInfo info = GPUInfo.load(gl);
|
||||
painter.releaseGL();
|
||||
|
||||
return "Capabilities : " + caps + "\n" + info.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,9 @@ import org.jzy3d.chart.IAnimator;
|
|||
import org.jzy3d.chart.factories.IChartFactory;
|
||||
import org.jzy3d.chart.factories.NativePainterFactory;
|
||||
import org.jzy3d.maths.Coord2d;
|
||||
import org.jzy3d.painters.IPainter;
|
||||
import org.jzy3d.painters.NativeDesktopPainter;
|
||||
import org.jzy3d.plot3d.GPUInfo;
|
||||
import org.jzy3d.plot3d.rendering.scene.Scene;
|
||||
import org.jzy3d.plot3d.rendering.view.Renderer3d;
|
||||
import org.jzy3d.plot3d.rendering.view.View;
|
||||
|
@ -249,17 +251,17 @@ public class CanvasSwing extends GLJPanel implements IScreenCanvas, INativeCanva
|
|||
|
||||
@Override
|
||||
public String getDebugInfo() {
|
||||
GL gl = ((NativeDesktopPainter) getView().getPainter()).getCurrentGL(this);
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("Chosen GLCapabilities: " + getChosenGLCapabilities() + "\n");
|
||||
sb.append("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR) + "\n");
|
||||
sb.append("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\n");
|
||||
sb.append("GL_VERSION: " + gl.glGetString(GL.GL_VERSION) + "\n");
|
||||
// sb.append("INIT GL IS: " + gl.getClass().getName() + "\n");
|
||||
return sb.toString();
|
||||
IPainter painter = getView().getPainter();
|
||||
|
||||
GLCapabilitiesImmutable caps = getChosenGLCapabilities();
|
||||
|
||||
GL gl = (GL) painter.acquireGL();
|
||||
GPUInfo info = GPUInfo.load(gl);
|
||||
painter.releaseGL();
|
||||
|
||||
return "Capabilities : " + caps + "\n" + info.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addMouseController(Object o) {
|
||||
addMouseListener((MouseListener) o);
|
||||
|
|
|
@ -13,7 +13,9 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.jzy3d.awt.AWTHelper;
|
||||
import org.jzy3d.chart.IAnimator;
|
||||
import org.jzy3d.maths.Coord2d;
|
||||
import org.jzy3d.painters.IPainter;
|
||||
import org.jzy3d.painters.NativeDesktopPainter;
|
||||
import org.jzy3d.plot3d.GPUInfo;
|
||||
import org.jzy3d.plot3d.rendering.canvas.ICanvasListener;
|
||||
import org.jzy3d.plot3d.rendering.canvas.INativeCanvas;
|
||||
import org.jzy3d.plot3d.rendering.canvas.IScreenCanvas;
|
||||
|
@ -201,17 +203,18 @@ public class CanvasNewtSWT extends Composite implements IScreenCanvas, INativeCa
|
|||
TextureData screen = screenshot();
|
||||
TextureIO.write(screen, file);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getDebugInfo() {
|
||||
GL gl = ((NativeDesktopPainter) getView().getPainter()).getCurrentGL(this);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Chosen GLCapabilities: " + window.getChosenGLCapabilities() + "\n");
|
||||
sb.append("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR) + "\n");
|
||||
sb.append("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\n");
|
||||
sb.append("GL_VERSION: " + gl.glGetString(GL.GL_VERSION) + "\n");
|
||||
return sb.toString();
|
||||
IPainter painter = getView().getPainter();
|
||||
|
||||
GLCapabilitiesImmutable caps = window.getChosenGLCapabilities();
|
||||
|
||||
GL gl = (GL) painter.acquireGL();
|
||||
GPUInfo info = GPUInfo.load(gl);
|
||||
painter.releaseGL();
|
||||
|
||||
return "Capabilities : " + caps + "\n" + info.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,9 @@ import org.jzy3d.chart.AWTNativeChart;
|
|||
import org.jzy3d.chart.Chart;
|
||||
import org.jzy3d.chart.controllers.mouse.camera.AWTCameraMouseController;
|
||||
import org.jzy3d.chart.factories.AWTChartFactory;
|
||||
import org.jzy3d.os.OperatingSystem;
|
||||
import org.jzy3d.painters.NativeDesktopPainter;
|
||||
import org.jzy3d.plot3d.GPUInfo;
|
||||
import org.jzy3d.plot3d.primitives.Drawable;
|
||||
import org.jzy3d.plot3d.rendering.canvas.INativeCanvas;
|
||||
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
||||
|
@ -21,6 +23,7 @@ import com.jogamp.opengl.util.texture.TextureData;
|
|||
import com.jogamp.opengl.util.texture.TextureIO;
|
||||
|
||||
public class NativeChartTester extends ChartTester {
|
||||
|
||||
protected BufferedImage getBufferedImage(Chart chart) throws IOException {
|
||||
if (classicScreenshotGen) {
|
||||
// This screenshot generation is working well
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package org.jzy3d.junit;
|
||||
|
||||
import org.jzy3d.plot3d.GPUInfo;
|
||||
|
||||
public class NativePlatform extends Platform{
|
||||
protected GPUInfo info = GPUInfo.load();
|
||||
|
||||
public NativePlatform() {
|
||||
gpuName = info.getRenderer().replace(" ", "");
|
||||
}
|
||||
}
|
|
@ -32,13 +32,29 @@ public class ChartTester {
|
|||
protected String testCaseOutputFolder = ERROR_IMAGE_FOLDER_DEFAULT;
|
||||
protected String testCaseInputFolder = EXPECTED_IMAGE_FOLDER;
|
||||
|
||||
public static final String EXPECTED_IMAGE_FOLDER = "src/test/resources/";
|
||||
private static final String EXPECTED_IMAGE_FOLDER = "src/test/resources/";
|
||||
public static final String ERROR_IMAGE_FOLDER_DEFAULT = "target/";
|
||||
|
||||
// int bufImgType = BufferedImage.TYPE_3BYTE_BGR;// );
|
||||
protected int WIDTH = 800;
|
||||
protected int HEIGHT = 600;
|
||||
|
||||
public String path(Object obj) {
|
||||
return path(obj.getClass());
|
||||
}
|
||||
|
||||
public String path(Class<?> clazz) {
|
||||
return path(clazz.getSimpleName());
|
||||
}
|
||||
|
||||
public String path(String filename) {
|
||||
if (!filename.contains("."))
|
||||
return ChartTester.EXPECTED_IMAGE_FOLDER + filename + ".png";
|
||||
else
|
||||
return ChartTester.EXPECTED_IMAGE_FOLDER + filename;
|
||||
|
||||
}
|
||||
|
||||
public boolean isTextInvisible() {
|
||||
return textInvisible;
|
||||
}
|
||||
|
@ -48,7 +64,7 @@ public class ChartTester {
|
|||
}
|
||||
|
||||
public void assertSimilar(Chart chart, String testImage) {
|
||||
if(isTextInvisible()){
|
||||
if (isTextInvisible()) {
|
||||
chart.getAxisLayout().setXTickColor(chart.getView().getBackgroundColor());
|
||||
chart.getAxisLayout().setYTickColor(chart.getView().getBackgroundColor());
|
||||
chart.getAxisLayout().setZTickColor(chart.getView().getBackgroundColor());
|
||||
|
@ -56,9 +72,9 @@ public class ChartTester {
|
|||
chart.getAxisLayout().setYTickLabelDisplayed(false);
|
||||
chart.getAxisLayout().setZTickLabelDisplayed(false);
|
||||
chart.render();
|
||||
//chart.getAxisLayout().setMainColor(chart.getView().getBackgroundColor());
|
||||
// chart.getAxisLayout().setMainColor(chart.getView().getBackgroundColor());
|
||||
}
|
||||
if(!chart.getFactory().getPainterFactory().isOffscreen()) {
|
||||
if (!chart.getFactory().getPainterFactory().isOffscreen()) {
|
||||
logger.warn("Making assertions on a non offscreen chart");
|
||||
}
|
||||
try {
|
||||
|
@ -171,15 +187,15 @@ public class ChartTester {
|
|||
|
||||
BufferedImage diffImage = copyImage(expected);
|
||||
highlightPixel(diffImage, e.getDiffCoordinates(), Highlight.RED);
|
||||
|
||||
|
||||
|
||||
|
||||
if (!e.isSameImageSize()) {
|
||||
String m = e.getImageSizeDifferenceMessage();
|
||||
|
||||
|
||||
logger.error(m);
|
||||
|
||||
m+= " - Diff will only show expected image. See the actual image separately";
|
||||
|
||||
|
||||
m += " - Diff will only show expected image. See the actual image separately";
|
||||
|
||||
highlightSize(diffImage, m);
|
||||
}
|
||||
|
||||
|
@ -188,8 +204,8 @@ public class ChartTester {
|
|||
logger.error("DIFF IMAGE : " + diffFile);
|
||||
|
||||
// LET TEST FAIL
|
||||
|
||||
|
||||
|
||||
|
||||
fail("Chart test failed: " + e.getMessage() + " see " + diffFile);
|
||||
|
||||
} catch (IOException e) {
|
||||
|
@ -202,12 +218,12 @@ public class ChartTester {
|
|||
|
||||
private void highlightSize(BufferedImage diffImage, String m) {
|
||||
Graphics g = diffImage.createGraphics();
|
||||
|
||||
|
||||
int fontSize = 16;
|
||||
|
||||
|
||||
g.setColor(java.awt.Color.RED);
|
||||
g.setFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, fontSize));
|
||||
g.drawString(m, 10, 10+fontSize);
|
||||
g.drawString(m, 10, 10 + fontSize);
|
||||
g.dispose();
|
||||
}
|
||||
|
||||
|
@ -320,7 +336,8 @@ public class ChartTester {
|
|||
}
|
||||
|
||||
} else {
|
||||
String m = "image size differ: actual={" + i1W + "," + i1H + "} expected={" + i2W + "," + i2H + "}";
|
||||
String m =
|
||||
"image size differ: actual={" + i1W + "," + i1H + "} expected={" + i2W + "," + i2H + "}";
|
||||
throw new ChartTestFailed(m, actual, expected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package org.jzy3d.junit;
|
||||
|
||||
import org.jzy3d.os.OperatingSystem;
|
||||
|
||||
public class Platform {
|
||||
protected OperatingSystem os = new OperatingSystem();
|
||||
protected String gpuName = "unknownGPU";
|
||||
|
||||
public String getLabel() {
|
||||
String osName = clean(os.getName());
|
||||
String osVer = clean(os.getVersion());
|
||||
|
||||
return osName + "_" + osVer + "_" + gpuName;
|
||||
}
|
||||
|
||||
protected String clean(String s) {
|
||||
return s.toLowerCase().replace(" ", "");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -250,17 +250,14 @@ public class ITTest {
|
|||
chart.render();
|
||||
}
|
||||
|
||||
// Verify
|
||||
ChartTester tester = new ChartTester();
|
||||
|
||||
// EMULGL
|
||||
if(chart.getFactory() instanceof EmulGLChartFactory) {
|
||||
ChartTester tester = new ChartTester();
|
||||
tester.assertSimilar(chart, ChartTester.EXPECTED_IMAGE_FOLDER + name + ".png");
|
||||
}
|
||||
// NATIVE
|
||||
else {
|
||||
NativeChartTester tester = new NativeChartTester();
|
||||
tester.assertSimilar(chart, ChartTester.EXPECTED_IMAGE_FOLDER + name + ".png");
|
||||
if(!(chart.getFactory() instanceof EmulGLChartFactory)) {
|
||||
tester = new NativeChartTester();
|
||||
}
|
||||
|
||||
tester.assertSimilar(chart, tester.path(name));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------- //
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.junit.Test;
|
|||
import org.jzy3d.chart.Chart;
|
||||
import org.jzy3d.chart.factories.AWTChartFactory;
|
||||
import org.jzy3d.colors.Color;
|
||||
import org.jzy3d.junit.ChartTester;
|
||||
import org.jzy3d.junit.NativeChartTester;
|
||||
import org.jzy3d.maths.Coord3d;
|
||||
import org.jzy3d.plot3d.primitives.Scatter;
|
||||
|
@ -24,8 +23,7 @@ public class ITTestNativeScatterChart {
|
|||
|
||||
// Then
|
||||
NativeChartTester tester = new NativeChartTester();
|
||||
tester.assertSimilar(chart,
|
||||
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
|
||||
tester.assertSimilar(chart, tester.path(this));
|
||||
}
|
||||
|
||||
private static Scatter scatter() {
|
||||
|
|
|
@ -47,8 +47,7 @@ public class ITTestNativeSurfaceChart {
|
|||
|
||||
// Then
|
||||
ChartTester tester = new NativeChartTester();
|
||||
tester.assertSimilar(chart,
|
||||
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
|
||||
tester.assertSimilar(chart, tester.path(this));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,28 +29,27 @@ public class ITTestNativeSurfaceChart_Swing {
|
|||
|
||||
chart.add(surface());
|
||||
|
||||
FrameSwing f = (FrameSwing)chart.open(800,600);
|
||||
FrameSwing f = (FrameSwing) chart.open(800, 600);
|
||||
|
||||
chart.render();
|
||||
|
||||
|
||||
// We want to ensure that we won't start baseline image
|
||||
// comparison before the canvas is (1) displayed
|
||||
// comparison before the canvas is (1) displayed
|
||||
// and (2) having the good image size.
|
||||
CanvasSwing canvas = (CanvasSwing)chart.getCanvas();
|
||||
|
||||
while(!f.isVisible() || !canvas.isRealized()) {
|
||||
CanvasSwing canvas = (CanvasSwing) chart.getCanvas();
|
||||
|
||||
while (!f.isVisible() || !canvas.isRealized()) {
|
||||
int waitTimeMs = 1500;
|
||||
System.out.println("Waiting " + waitTimeMs);
|
||||
|
||||
|
||||
chart.sleep(waitTimeMs);
|
||||
//canvas.forceRepaint();
|
||||
// canvas.forceRepaint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Then
|
||||
ChartTester tester = new NativeChartTester();
|
||||
tester.assertSimilar(chart,
|
||||
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
|
||||
tester.assertSimilar(chart, tester.path(this));
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +61,8 @@ public class ITTestNativeSurfaceChart_Swing {
|
|||
|
||||
// Create the object to represent the function over the given range.
|
||||
final Shape surface = new SurfaceBuilder().orthonormal(new OrthonormalGrid(range, steps), func);
|
||||
surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface, new Color(1, 1, 1, .5f)));
|
||||
surface
|
||||
.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface, new Color(1, 1, 1, .5f)));
|
||||
surface.setFaceDisplayed(true);
|
||||
surface.setWireframeDisplayed(true);
|
||||
return surface;
|
||||
|
|
18
pom.xml
18
pom.xml
|
@ -1,6 +1,4 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.jzy3d</groupId>
|
||||
|
@ -61,12 +59,11 @@
|
|||
<module>jzy3d-native-jogl-swing</module>
|
||||
<module>jzy3d-native-jogl-swt</module>
|
||||
|
||||
<!-- <module>jzy3d-native-jogl-newt</module> -->
|
||||
<module>jzy3d-native-jogl-newt</module>
|
||||
|
||||
<!-- <module>jzy3d-native-jogl-javafx</module> -->
|
||||
|
||||
|
||||
|
||||
<module>jzy3d-tester</module>
|
||||
<module>jzy3d-tester-native</module>
|
||||
|
||||
|
@ -225,6 +222,13 @@
|
|||
<version>${version.swt}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.platform</groupId>
|
||||
<artifactId>org.eclipse.swt.gtk.linux.aarch64</artifactId>
|
||||
<optional>true</optional>
|
||||
<version>${version.swt}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.platform</groupId>
|
||||
<artifactId>org.eclipse.swt.win32.win32.x86_64</artifactId>
|
||||
|
@ -479,7 +483,7 @@
|
|||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
<doclint>none</doclint>
|
||||
<source>8</source>
|
||||
<quiet>true</quiet><!-- only show warnings/errors -->
|
||||
<quiet>true</quiet> <!-- only show warnings/errors -->
|
||||
<failOnError>false</failOnError>
|
||||
<additionalJOption>--no-module-directories</additionalJOption>
|
||||
<configuration>
|
||||
|
@ -617,4 +621,4 @@
|
|||
</profile>
|
||||
|
||||
</profiles>
|
||||
</project>
|
||||
</project>
|
Loading…
Reference in New Issue