Update baseline image with new text renderer

This commit is contained in:
Martin Pernollet 2022-04-29 15:53:16 +02:00
parent 9d992d8398
commit d5311e6633
21 changed files with 276 additions and 123 deletions

View File

@ -588,7 +588,7 @@ public class EmulGLCanvas extends GLCanvas implements IScreenCanvas, IMonitorabl
@Override @Override
public String getDebugInfo() { public String getDebugInfo() {
return null; return "EmulGL (CPU rendering)";
} }

View File

@ -23,8 +23,7 @@ public class ITTestEmulGLDisk {
// Then // Then
ChartTester tester = new ChartTester(); ChartTester tester = new ChartTester();
tester.assertSimilar(chart, tester.assertSimilar(chart, tester.path(this));
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
} }
} }

View File

@ -21,14 +21,13 @@ public class ITTestEmulGLScatterChart {
EmulGLCanvas c = (EmulGLCanvas) chart.getCanvas(); EmulGLCanvas c = (EmulGLCanvas) chart.getCanvas();
c.setProfileDisplayMethod(false); c.setProfileDisplayMethod(false);
//c.getGL().setAutoAdaptToHiDPI(false); // c.getGL().setAutoAdaptToHiDPI(false);
chart.add(scatter()); chart.add(scatter());
// Then // Then
ChartTester tester = new ChartTester(); ChartTester tester = new ChartTester();
tester.assertSimilar(chart, tester.assertSimilar(chart, tester.path(this));
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
} }
private static Scatter scatter() { private static Scatter scatter() {

View File

@ -23,7 +23,7 @@ public class ITTestEmulGLSurfaceChart {
EmulGLChartFactory factory = new EmulGLChartFactory(); EmulGLChartFactory factory = new EmulGLChartFactory();
Chart chart = factory.newChart(Quality.Advanced()); Chart chart = factory.newChart(Quality.Advanced());
//System.out.println(chart.getQuality().isAlphaActivated()); // System.out.println(chart.getQuality().isAlphaActivated());
EmulGLCanvas c = (EmulGLCanvas) chart.getCanvas(); EmulGLCanvas c = (EmulGLCanvas) chart.getCanvas();
c.setProfileDisplayMethod(false); c.setProfileDisplayMethod(false);
@ -33,8 +33,7 @@ public class ITTestEmulGLSurfaceChart {
// Then // Then
ChartTester tester = new ChartTester(); ChartTester tester = new ChartTester();
tester.assertSimilar(chart, tester.assertSimilar(chart, tester.path(this));
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
} }

View File

@ -9,14 +9,13 @@ import java.util.List;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jzy3d.awt.AWTHelper; import org.jzy3d.awt.AWTHelper;
import org.jzy3d.chart.IAnimator; import org.jzy3d.chart.IAnimator;
import org.jzy3d.chart.factories.IChartFactory; import org.jzy3d.chart.factories.IChartFactory;
import org.jzy3d.chart.factories.NativePainterFactory; import org.jzy3d.chart.factories.NativePainterFactory;
import org.jzy3d.maths.Coord2d; import org.jzy3d.maths.Coord2d;
import org.jzy3d.painters.IPainter; 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.scene.Scene;
import org.jzy3d.plot3d.rendering.view.Renderer3d; import org.jzy3d.plot3d.rendering.view.Renderer3d;
import org.jzy3d.plot3d.rendering.view.View; import org.jzy3d.plot3d.rendering.view.View;
@ -203,30 +202,10 @@ public class CanvasAWT extends GLCanvas implements IScreenCanvas, INativeCanvas
GLCapabilitiesImmutable caps = getChosenGLCapabilities(); GLCapabilitiesImmutable caps = getChosenGLCapabilities();
GL gl = (GL) painter.acquireGL(); GL gl = (GL) painter.acquireGL();
GPUInfo info = GPUInfo.load(gl);
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");
painter.releaseGL(); painter.releaseGL();
return sb.toString(); return "Capabilities : " + caps + "\n" + info.toString();
} }
@Override @Override

View File

@ -2,6 +2,7 @@ package jogl;
import org.junit.Test; import org.junit.Test;
import org.jzy3d.os.OperatingSystem; import org.jzy3d.os.OperatingSystem;
import org.jzy3d.plot3d.GPUInfo;
import com.jogamp.opengl.GL; import com.jogamp.opengl.GL;
import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLCapabilities;
@ -76,7 +77,7 @@ public class Test_OpenGLVersion {
System.out.println("CAPS (found) : " + drawable.getChosenGLCapabilities()); System.out.println("CAPS (found) : " + drawable.getChosenGLCapabilities());
System.out.println("--------------------------------------------------"); System.out.println("--------------------------------------------------");
System.out.println(getDebugInfo(gl)); System.out.println(GPUInfo.load(gl));
System.out.println("--------------------------------------------------"); System.out.println("--------------------------------------------------");
System.out.println(drawable.getContext()); System.out.println(drawable.getContext());

View File

@ -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;
}
}

View File

@ -8,13 +8,16 @@ import org.apache.logging.log4j.LogManager;
import org.jzy3d.chart.factories.IChartFactory; import org.jzy3d.chart.factories.IChartFactory;
import org.jzy3d.chart.factories.NativePainterFactory; import org.jzy3d.chart.factories.NativePainterFactory;
import org.jzy3d.maths.Coord2d; import org.jzy3d.maths.Coord2d;
import org.jzy3d.painters.IPainter;
import org.jzy3d.painters.NativeDesktopPainter; import org.jzy3d.painters.NativeDesktopPainter;
import org.jzy3d.plot3d.GPUInfo;
import org.jzy3d.plot3d.pipelines.NotImplementedException; import org.jzy3d.plot3d.pipelines.NotImplementedException;
import org.jzy3d.plot3d.rendering.scene.Scene; import org.jzy3d.plot3d.rendering.scene.Scene;
import org.jzy3d.plot3d.rendering.view.Renderer3d; import org.jzy3d.plot3d.rendering.view.Renderer3d;
import org.jzy3d.plot3d.rendering.view.View; import org.jzy3d.plot3d.rendering.view.View;
import com.jogamp.opengl.GL; import com.jogamp.opengl.GL;
import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLCapabilitiesImmutable;
import com.jogamp.opengl.GLDrawableFactory; import com.jogamp.opengl.GLDrawableFactory;
import com.jogamp.opengl.GLFBODrawable; import com.jogamp.opengl.GLFBODrawable;
import com.jogamp.opengl.GLOffscreenAutoDrawable; import com.jogamp.opengl.GLOffscreenAutoDrawable;
@ -184,16 +187,18 @@ public class OffscreenCanvas implements ICanvas, INativeCanvas {
@Override @Override
public String getDebugInfo() { public String getDebugInfo() {
GL gl = ((NativeDesktopPainter) getView().getPainter()).getCurrentGL(this); IPainter painter = getView().getPainter();
StringBuffer sb = new StringBuffer(); GLCapabilitiesImmutable caps = offscreenDrawable.getChosenGLCapabilities();
sb.append("Chosen GLCapabilities: " + offscreenDrawable.getChosenGLCapabilities() + "\n");
sb.append("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR) + "\n"); GL gl = (GL) painter.acquireGL();
sb.append("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\n"); GPUInfo info = GPUInfo.load(gl);
sb.append("GL_VERSION: " + gl.glGetString(GL.GL_VERSION) + "\n"); painter.releaseGL();
return sb.toString();
return "Capabilities : " + caps + "\n" + info.toString();
} }
@Override @Override
public void addMouseController(Object o) {} public void addMouseController(Object o) {}

View File

@ -17,7 +17,9 @@ import org.jzy3d.chart.NativeAnimator;
import org.jzy3d.chart.factories.IChartFactory; import org.jzy3d.chart.factories.IChartFactory;
import org.jzy3d.chart.factories.NativePainterFactory; import org.jzy3d.chart.factories.NativePainterFactory;
import org.jzy3d.maths.Coord2d; import org.jzy3d.maths.Coord2d;
import org.jzy3d.painters.IPainter;
import org.jzy3d.painters.NativeDesktopPainter; import org.jzy3d.painters.NativeDesktopPainter;
import org.jzy3d.plot3d.GPUInfo;
import org.jzy3d.plot3d.rendering.scene.Scene; import org.jzy3d.plot3d.rendering.scene.Scene;
import org.jzy3d.plot3d.rendering.view.Renderer3d; import org.jzy3d.plot3d.rendering.view.Renderer3d;
import org.jzy3d.plot3d.rendering.view.View; import org.jzy3d.plot3d.rendering.view.View;
@ -222,15 +224,15 @@ public class CanvasNewtAwt extends Panel implements IScreenCanvas, INativeCanvas
@Override @Override
public String getDebugInfo() { public String getDebugInfo() {
GL gl = ((NativeDesktopPainter) getView().getPainter()).getCurrentGL(this); IPainter painter = getView().getPainter();
StringBuffer sb = new StringBuffer(); GLCapabilitiesImmutable caps = window.getChosenGLCapabilities();
sb.append("Chosen GLCapabilities: " + window.getChosenGLCapabilities() + "\n");
sb.append("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR) + "\n"); GL gl = (GL) painter.acquireGL();
sb.append("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\n"); GPUInfo info = GPUInfo.load(gl);
sb.append("GL_VERSION: " + gl.glGetString(GL.GL_VERSION) + "\n"); painter.releaseGL();
// sb.append("INIT GL IS: " + gl.getClass().getName() + "\n");
return sb.toString(); return "Capabilities : " + caps + "\n" + info.toString();
} }
/** /**

View File

@ -16,7 +16,9 @@ import org.jzy3d.chart.IAnimator;
import org.jzy3d.chart.factories.IChartFactory; import org.jzy3d.chart.factories.IChartFactory;
import org.jzy3d.chart.factories.NativePainterFactory; import org.jzy3d.chart.factories.NativePainterFactory;
import org.jzy3d.maths.Coord2d; import org.jzy3d.maths.Coord2d;
import org.jzy3d.painters.IPainter;
import org.jzy3d.painters.NativeDesktopPainter; import org.jzy3d.painters.NativeDesktopPainter;
import org.jzy3d.plot3d.GPUInfo;
import org.jzy3d.plot3d.rendering.scene.Scene; import org.jzy3d.plot3d.rendering.scene.Scene;
import org.jzy3d.plot3d.rendering.view.Renderer3d; import org.jzy3d.plot3d.rendering.view.Renderer3d;
import org.jzy3d.plot3d.rendering.view.View; import org.jzy3d.plot3d.rendering.view.View;
@ -249,15 +251,15 @@ public class CanvasSwing extends GLJPanel implements IScreenCanvas, INativeCanva
@Override @Override
public String getDebugInfo() { public String getDebugInfo() {
GL gl = ((NativeDesktopPainter) getView().getPainter()).getCurrentGL(this); IPainter painter = getView().getPainter();
StringBuffer sb = new StringBuffer(); GLCapabilitiesImmutable caps = getChosenGLCapabilities();
sb.append("Chosen GLCapabilities: " + getChosenGLCapabilities() + "\n");
sb.append("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR) + "\n"); GL gl = (GL) painter.acquireGL();
sb.append("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\n"); GPUInfo info = GPUInfo.load(gl);
sb.append("GL_VERSION: " + gl.glGetString(GL.GL_VERSION) + "\n"); painter.releaseGL();
// sb.append("INIT GL IS: " + gl.getClass().getName() + "\n");
return sb.toString(); return "Capabilities : " + caps + "\n" + info.toString();
} }
@Override @Override

View File

@ -13,7 +13,9 @@ import org.eclipse.swt.widgets.Composite;
import org.jzy3d.awt.AWTHelper; import org.jzy3d.awt.AWTHelper;
import org.jzy3d.chart.IAnimator; import org.jzy3d.chart.IAnimator;
import org.jzy3d.maths.Coord2d; import org.jzy3d.maths.Coord2d;
import org.jzy3d.painters.IPainter;
import org.jzy3d.painters.NativeDesktopPainter; import org.jzy3d.painters.NativeDesktopPainter;
import org.jzy3d.plot3d.GPUInfo;
import org.jzy3d.plot3d.rendering.canvas.ICanvasListener; import org.jzy3d.plot3d.rendering.canvas.ICanvasListener;
import org.jzy3d.plot3d.rendering.canvas.INativeCanvas; import org.jzy3d.plot3d.rendering.canvas.INativeCanvas;
import org.jzy3d.plot3d.rendering.canvas.IScreenCanvas; import org.jzy3d.plot3d.rendering.canvas.IScreenCanvas;
@ -204,14 +206,15 @@ public class CanvasNewtSWT extends Composite implements IScreenCanvas, INativeCa
@Override @Override
public String getDebugInfo() { public String getDebugInfo() {
GL gl = ((NativeDesktopPainter) getView().getPainter()).getCurrentGL(this); IPainter painter = getView().getPainter();
StringBuilder sb = new StringBuilder(); GLCapabilitiesImmutable caps = window.getChosenGLCapabilities();
sb.append("Chosen GLCapabilities: " + window.getChosenGLCapabilities() + "\n");
sb.append("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR) + "\n"); GL gl = (GL) painter.acquireGL();
sb.append("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\n"); GPUInfo info = GPUInfo.load(gl);
sb.append("GL_VERSION: " + gl.glGetString(GL.GL_VERSION) + "\n"); painter.releaseGL();
return sb.toString();
return "Capabilities : " + caps + "\n" + info.toString();
} }
/** /**

View File

@ -8,7 +8,9 @@ import org.jzy3d.chart.AWTNativeChart;
import org.jzy3d.chart.Chart; import org.jzy3d.chart.Chart;
import org.jzy3d.chart.controllers.mouse.camera.AWTCameraMouseController; import org.jzy3d.chart.controllers.mouse.camera.AWTCameraMouseController;
import org.jzy3d.chart.factories.AWTChartFactory; import org.jzy3d.chart.factories.AWTChartFactory;
import org.jzy3d.os.OperatingSystem;
import org.jzy3d.painters.NativeDesktopPainter; import org.jzy3d.painters.NativeDesktopPainter;
import org.jzy3d.plot3d.GPUInfo;
import org.jzy3d.plot3d.primitives.Drawable; import org.jzy3d.plot3d.primitives.Drawable;
import org.jzy3d.plot3d.rendering.canvas.INativeCanvas; import org.jzy3d.plot3d.rendering.canvas.INativeCanvas;
import org.jzy3d.plot3d.rendering.canvas.Quality; 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; import com.jogamp.opengl.util.texture.TextureIO;
public class NativeChartTester extends ChartTester { public class NativeChartTester extends ChartTester {
protected BufferedImage getBufferedImage(Chart chart) throws IOException { protected BufferedImage getBufferedImage(Chart chart) throws IOException {
if (classicScreenshotGen) { if (classicScreenshotGen) {
// This screenshot generation is working well // This screenshot generation is working well

View File

@ -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(" ", "");
}
}

View File

@ -32,13 +32,29 @@ public class ChartTester {
protected String testCaseOutputFolder = ERROR_IMAGE_FOLDER_DEFAULT; protected String testCaseOutputFolder = ERROR_IMAGE_FOLDER_DEFAULT;
protected String testCaseInputFolder = EXPECTED_IMAGE_FOLDER; 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/"; public static final String ERROR_IMAGE_FOLDER_DEFAULT = "target/";
// int bufImgType = BufferedImage.TYPE_3BYTE_BGR;// ); // int bufImgType = BufferedImage.TYPE_3BYTE_BGR;// );
protected int WIDTH = 800; protected int WIDTH = 800;
protected int HEIGHT = 600; 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() { public boolean isTextInvisible() {
return textInvisible; return textInvisible;
} }
@ -48,7 +64,7 @@ public class ChartTester {
} }
public void assertSimilar(Chart chart, String testImage) { public void assertSimilar(Chart chart, String testImage) {
if(isTextInvisible()){ if (isTextInvisible()) {
chart.getAxisLayout().setXTickColor(chart.getView().getBackgroundColor()); chart.getAxisLayout().setXTickColor(chart.getView().getBackgroundColor());
chart.getAxisLayout().setYTickColor(chart.getView().getBackgroundColor()); chart.getAxisLayout().setYTickColor(chart.getView().getBackgroundColor());
chart.getAxisLayout().setZTickColor(chart.getView().getBackgroundColor()); chart.getAxisLayout().setZTickColor(chart.getView().getBackgroundColor());
@ -56,9 +72,9 @@ public class ChartTester {
chart.getAxisLayout().setYTickLabelDisplayed(false); chart.getAxisLayout().setYTickLabelDisplayed(false);
chart.getAxisLayout().setZTickLabelDisplayed(false); chart.getAxisLayout().setZTickLabelDisplayed(false);
chart.render(); 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"); logger.warn("Making assertions on a non offscreen chart");
} }
try { try {
@ -178,7 +194,7 @@ public class ChartTester {
logger.error(m); 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); highlightSize(diffImage, m);
} }
@ -207,7 +223,7 @@ public class ChartTester {
g.setColor(java.awt.Color.RED); g.setColor(java.awt.Color.RED);
g.setFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, fontSize)); 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(); g.dispose();
} }
@ -320,7 +336,8 @@ public class ChartTester {
} }
} else { } 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); throw new ChartTestFailed(m, actual, expected);
} }
} }

View File

@ -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(" ", "");
}
}

View File

@ -250,17 +250,14 @@ public class ITTest {
chart.render(); chart.render();
} }
// Verify
// EMULGL
if(chart.getFactory() instanceof EmulGLChartFactory) {
ChartTester tester = new ChartTester(); ChartTester tester = new ChartTester();
tester.assertSimilar(chart, ChartTester.EXPECTED_IMAGE_FOLDER + name + ".png");
} if(!(chart.getFactory() instanceof EmulGLChartFactory)) {
// NATIVE tester = new NativeChartTester();
else {
NativeChartTester tester = new NativeChartTester();
tester.assertSimilar(chart, ChartTester.EXPECTED_IMAGE_FOLDER + name + ".png");
} }
tester.assertSimilar(chart, tester.path(name));
} }
// ---------------------------------------------------------------------------------------------- // // ---------------------------------------------------------------------------------------------- //

View File

@ -5,7 +5,6 @@ import org.junit.Test;
import org.jzy3d.chart.Chart; import org.jzy3d.chart.Chart;
import org.jzy3d.chart.factories.AWTChartFactory; import org.jzy3d.chart.factories.AWTChartFactory;
import org.jzy3d.colors.Color; import org.jzy3d.colors.Color;
import org.jzy3d.junit.ChartTester;
import org.jzy3d.junit.NativeChartTester; import org.jzy3d.junit.NativeChartTester;
import org.jzy3d.maths.Coord3d; import org.jzy3d.maths.Coord3d;
import org.jzy3d.plot3d.primitives.Scatter; import org.jzy3d.plot3d.primitives.Scatter;
@ -24,8 +23,7 @@ public class ITTestNativeScatterChart {
// Then // Then
NativeChartTester tester = new NativeChartTester(); NativeChartTester tester = new NativeChartTester();
tester.assertSimilar(chart, tester.assertSimilar(chart, tester.path(this));
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
} }
private static Scatter scatter() { private static Scatter scatter() {

View File

@ -47,8 +47,7 @@ public class ITTestNativeSurfaceChart {
// Then // Then
ChartTester tester = new NativeChartTester(); ChartTester tester = new NativeChartTester();
tester.assertSimilar(chart, tester.assertSimilar(chart, tester.path(this));
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
} }

View File

@ -29,28 +29,27 @@ public class ITTestNativeSurfaceChart_Swing {
chart.add(surface()); chart.add(surface());
FrameSwing f = (FrameSwing)chart.open(800,600); FrameSwing f = (FrameSwing) chart.open(800, 600);
chart.render(); chart.render();
// We want to ensure that we won't start baseline image // 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. // and (2) having the good image size.
CanvasSwing canvas = (CanvasSwing)chart.getCanvas(); CanvasSwing canvas = (CanvasSwing) chart.getCanvas();
while(!f.isVisible() || !canvas.isRealized()) { while (!f.isVisible() || !canvas.isRealized()) {
int waitTimeMs = 1500; int waitTimeMs = 1500;
System.out.println("Waiting " + waitTimeMs); System.out.println("Waiting " + waitTimeMs);
chart.sleep(waitTimeMs); chart.sleep(waitTimeMs);
//canvas.forceRepaint(); // canvas.forceRepaint();
} }
// Then // Then
ChartTester tester = new NativeChartTester(); ChartTester tester = new NativeChartTester();
tester.assertSimilar(chart, tester.assertSimilar(chart, tester.path(this));
ChartTester.EXPECTED_IMAGE_FOLDER + this.getClass().getSimpleName() + ".png");
} }
@ -62,7 +61,8 @@ public class ITTestNativeSurfaceChart_Swing {
// Create the object to represent the function over the given range. // Create the object to represent the function over the given range.
final Shape surface = new SurfaceBuilder().orthonormal(new OrthonormalGrid(range, steps), func); 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.setFaceDisplayed(true);
surface.setWireframeDisplayed(true); surface.setWireframeDisplayed(true);
return surface; return surface;

16
pom.xml
View File

@ -1,6 +1,4 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.jzy3d</groupId> <groupId>org.jzy3d</groupId>
@ -61,12 +59,11 @@
<module>jzy3d-native-jogl-swing</module> <module>jzy3d-native-jogl-swing</module>
<module>jzy3d-native-jogl-swt</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-native-jogl-javafx</module> -->
<module>jzy3d-tester</module> <module>jzy3d-tester</module>
<module>jzy3d-tester-native</module> <module>jzy3d-tester-native</module>
@ -225,6 +222,13 @@
<version>${version.swt}</version> <version>${version.swt}</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.swt.gtk.linux.aarch64</artifactId>
<optional>true</optional>
<version>${version.swt}</version>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.platform</groupId> <groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.swt.win32.win32.x86_64</artifactId> <artifactId>org.eclipse.swt.win32.win32.x86_64</artifactId>
@ -479,7 +483,7 @@
<additionalparam>-Xdoclint:none</additionalparam> <additionalparam>-Xdoclint:none</additionalparam>
<doclint>none</doclint> <doclint>none</doclint>
<source>8</source> <source>8</source>
<quiet>true</quiet><!-- only show warnings/errors --> <quiet>true</quiet> <!-- only show warnings/errors -->
<failOnError>false</failOnError> <failOnError>false</failOnError>
<additionalJOption>--no-module-directories</additionalJOption> <additionalJOption>--no-module-directories</additionalJOption>
<configuration> <configuration>