mirror of https://github.com/rusefi/jzy3d-api.git
Adding manual test scenarios
This commit is contained in:
parent
72eba19fe0
commit
02e173e2cd
10
README.md
10
README.md
|
@ -196,7 +196,7 @@ This will run all test named `**/Test*.java` or `**/*Test.java`.
|
||||||
mvn clean install
|
mvn clean install
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Run unit tests and integration tests
|
#### Run unit tests and automated integration tests
|
||||||
|
|
||||||
Integration tests compare charts to baseline images pixel wise. They are important in te toolbelt but have the drawback of being less portable accross computers
|
Integration tests compare charts to baseline images pixel wise. They are important in te toolbelt but have the drawback of being less portable accross computers
|
||||||
* Different OS have different frame insets (changing actual rendering area size) leading to chart screenshots of different size accross OS.
|
* Different OS have different frame insets (changing actual rendering area size) leading to chart screenshots of different size accross OS.
|
||||||
|
@ -210,15 +210,17 @@ This will run all test named `**/ITTest*.java` and unit tests.
|
||||||
mvn clean install -Pintegration-tests
|
mvn clean install -Pintegration-tests
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Skip automated tests
|
||||||
|
|
||||||
#### Skip tests
|
|
||||||
|
|
||||||
This will skip all tests (unit and integration)
|
This will skip all tests (unit and integration)
|
||||||
```
|
```
|
||||||
mvn clean install -DskipTests
|
mvn clean install -DskipTests
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Manual tests
|
||||||
|
|
||||||
|
Some [test require a manual verification](jzy3d-tests-java9/src/test/java/org/jzy3d/tests/manual).
|
||||||
|
|
||||||
### Deploy source & javadocs
|
### Deploy source & javadocs
|
||||||
```
|
```
|
||||||
mvn clean source:jar javadoc:jar deploy
|
mvn clean source:jar javadoc:jar deploy
|
||||||
|
|
|
@ -47,11 +47,13 @@ public class FrameAWT extends java.awt.Frame implements IFrame {
|
||||||
this.addWindowListener(new WindowAdapter() {
|
this.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent e) {
|
public void windowClosing(WindowEvent e) {
|
||||||
FrameAWT.this.remove((java.awt.Component) FrameAWT.this.chart.getCanvas());
|
if(FrameAWT.this.chart!=null) {
|
||||||
FrameAWT.this.chart.stopAllThreads();
|
FrameAWT.this.remove((java.awt.Component) FrameAWT.this.chart.getCanvas());
|
||||||
FrameAWT.this.chart.dispose();
|
FrameAWT.this.chart.stopAllThreads();
|
||||||
FrameAWT.this.chart = null;
|
FrameAWT.this.chart.dispose();
|
||||||
FrameAWT.this.dispose();
|
FrameAWT.this.chart = null;
|
||||||
|
FrameAWT.this.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,3 +6,13 @@ This project holds a collection of integration tests and let them run them on Ja
|
||||||
|
|
||||||
See [the generated readme file](README_GENERATED.md) to easily watch all baseline
|
See [the generated readme file](README_GENERATED.md) to easily watch all baseline
|
||||||
images used for tests.
|
images used for tests.
|
||||||
|
|
||||||
|
## Automated tests
|
||||||
|
|
||||||
|
Most of the [integration tests](src/test/java/org/jzy3d/tests/integration) are automated and run while building this project.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Manual tests
|
||||||
|
|
||||||
|
Some [test require a manual verification](src/test/java/org/jzy3d/tests/manual).
|
|
@ -0,0 +1,23 @@
|
||||||
|
This tests allows verifying that the layout of the chart remains unchanged while using multiple monitors (screens) with different HiDPI capabilities.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
- Primary screen : HiDPI enabled
|
||||||
|
- Secondary screen : no HiDPI
|
||||||
|
|
||||||
|
## Contexts
|
||||||
|
- [ ] OS in {macOS 10, Windows 10, Ubuntu 20}
|
||||||
|
- [ ] Chip in {GPU (Native), CPU (EmulGL)}
|
||||||
|
|
||||||
|
## Instructions
|
||||||
|
- Run `MTest_Layout_Native` which will open on the main screen. (Use `--add-exports java.base/java.lang=ALL-UNNAMED --add-exports java.desktop/sun.awt=ALL-UNNAMED --add-exports java.desktop/sun.java2d=ALL-UNNAMED` VM optionsà
|
||||||
|
- Drag the chart window in the secondary screen.
|
||||||
|
|
||||||
|
### To be verified
|
||||||
|
When moving chart windows from primary to secondary monitor (screen).
|
||||||
|
- [ ] Axis text labels have the same size.
|
||||||
|
- [ ] Legend text labels have the same size.
|
||||||
|
- [ ] Colorbar text labels have the same size.
|
||||||
|
- [ ] Colorbar position remains the same.
|
||||||
|
|
||||||
|
### To indicate
|
||||||
|
- Context (OS, Chip)
|
|
@ -0,0 +1,149 @@
|
||||||
|
package org.jzy3d.tests.manual.layout;
|
||||||
|
|
||||||
|
import org.jzy3d.analysis.AWTAbstractAnalysis;
|
||||||
|
import org.jzy3d.chart.EmulGLSkin;
|
||||||
|
import org.jzy3d.chart.controllers.RateLimiterAdaptsToRenderTime;
|
||||||
|
import org.jzy3d.chart.controllers.mouse.camera.AdaptiveRenderingPolicy;
|
||||||
|
import org.jzy3d.chart.factories.EmulGLChartFactory;
|
||||||
|
import org.jzy3d.colors.Color;
|
||||||
|
import org.jzy3d.colors.ColorMapper;
|
||||||
|
import org.jzy3d.colors.colormaps.ColorMapRainbow;
|
||||||
|
import org.jzy3d.maths.Range;
|
||||||
|
import org.jzy3d.painters.Font;
|
||||||
|
import org.jzy3d.plot3d.builder.Func3D;
|
||||||
|
import org.jzy3d.plot3d.builder.SurfaceBuilder;
|
||||||
|
import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid;
|
||||||
|
import org.jzy3d.plot3d.primitives.Shape;
|
||||||
|
import org.jzy3d.plot3d.primitives.axis.layout.IAxisLayout;
|
||||||
|
import org.jzy3d.plot3d.primitives.axis.layout.LabelOrientation;
|
||||||
|
import org.jzy3d.plot3d.primitives.axis.layout.ZAxisSide;
|
||||||
|
import org.jzy3d.plot3d.primitives.axis.layout.fonts.HiDPIProportionalFontSizePolicy;
|
||||||
|
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
||||||
|
import org.jzy3d.plot3d.rendering.legends.colorbars.AWTColorbarLegend;
|
||||||
|
import org.jzy3d.plot3d.rendering.view.AWTView;
|
||||||
|
import org.jzy3d.plot3d.rendering.view.View;
|
||||||
|
import org.jzy3d.plot3d.rendering.view.layout.ViewAndColorbarsLayout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QTP
|
||||||
|
* valider avec / sans HiDPI :
|
||||||
|
* - le layout du texte est le même
|
||||||
|
* - les marges / offset sont appliquées correctement
|
||||||
|
* - marche côté gauche / côté droit
|
||||||
|
* - avec vertical / oblique / etc
|
||||||
|
*
|
||||||
|
* - Le calcul d'offset de label ne prend pas en compte la rotation du texte dans la place qu'il prend
|
||||||
|
*
|
||||||
|
* @author martin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MTest_Layout_EmulGL extends AWTAbstractAnalysis{
|
||||||
|
|
||||||
|
static final float ALPHA_FACTOR = 0.55f;// .61f;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
MTest_Layout_EmulGL d = new MTest_Layout_EmulGL();
|
||||||
|
d.init();
|
||||||
|
|
||||||
|
d.getChart().open(1264, 812);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MTest_Layout_EmulGL() {
|
||||||
|
factory = new EmulGLChartFactory();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
|
||||||
|
Quality q = Quality.Advanced();
|
||||||
|
q.setAnimated(false);
|
||||||
|
q.setHiDPIEnabled(true);
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// Configure chart content
|
||||||
|
|
||||||
|
Shape surface = surface();
|
||||||
|
|
||||||
|
chart = factory.newChart(q);
|
||||||
|
|
||||||
|
IAxisLayout layout = chart.getAxisLayout();
|
||||||
|
//layout.setFont(new Font("Apple Chancery", 20));
|
||||||
|
layout.setFont(new Font("Helvetica", 20));
|
||||||
|
layout.setFontSizePolicy(new HiDPIProportionalFontSizePolicy(chart.getView()));
|
||||||
|
|
||||||
|
layout.setXAxisLabel("My X axis label is a little long to draw");
|
||||||
|
layout.setYAxisLabel("My Y axis label is a little long to draw");
|
||||||
|
layout.setZAxisLabel("My Z axis label is a little long to draw");
|
||||||
|
|
||||||
|
layout.setZAxisSide(ZAxisSide.LEFT);
|
||||||
|
layout.setZAxisLabelOrientation(LabelOrientation.VERTICAL);
|
||||||
|
layout.setYAxisLabelOrientation(LabelOrientation.PARALLEL_TO_AXIS);
|
||||||
|
layout.setXAxisLabelOrientation(LabelOrientation.PARALLEL_TO_AXIS);
|
||||||
|
|
||||||
|
layout.setAxisLabelOffsetAuto(true);
|
||||||
|
layout.setAxisLabelOffsetMargin(20);
|
||||||
|
|
||||||
|
layout.setXTickColor(Color.RED);
|
||||||
|
layout.setYTickColor(Color.GREEN);
|
||||||
|
layout.setZTickColor(Color.BLUE);
|
||||||
|
|
||||||
|
View view = chart.getView();
|
||||||
|
//view.setDisplayAxisWholeBounds(true);
|
||||||
|
//view.setMaintainAllObjectsInView(true);
|
||||||
|
view.setCameraRenderingSphereRadiusFactor(1.1f);
|
||||||
|
|
||||||
|
AWTColorbarLegend colorbar = new AWTColorbarLegend(surface, chart.getView().getAxis().getLayout());
|
||||||
|
surface.setLegend(colorbar);
|
||||||
|
chart.add(surface);
|
||||||
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// Open and enable controllers
|
||||||
|
|
||||||
|
|
||||||
|
chart.getKeyboard();
|
||||||
|
chart.getMouse();
|
||||||
|
|
||||||
|
if (factory instanceof EmulGLChartFactory) {
|
||||||
|
EmulGLSkin skin = EmulGLSkin.on(chart);
|
||||||
|
|
||||||
|
skin.getCanvas().setProfileDisplayMethod(true);
|
||||||
|
skin.getCanvas().setDebugEvents(true);
|
||||||
|
|
||||||
|
skin.getLayout().setShrinkColorbar(true);
|
||||||
|
|
||||||
|
AdaptiveRenderingPolicy policy = new AdaptiveRenderingPolicy();
|
||||||
|
policy.renderingRateLimiter = new RateLimiterAdaptsToRenderTime();
|
||||||
|
policy.optimizeForRenderingTimeLargerThan = 130;// ms
|
||||||
|
policy.optimizeByDroppingFaceAndKeepingWireframeWithColor = true;
|
||||||
|
|
||||||
|
skin.getMouse().setPolicy(policy);
|
||||||
|
|
||||||
|
skin.getThread().setSpeed(15);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
((ViewAndColorbarsLayout)((AWTView)view).getLayout()).setShrinkColorbar(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static Shape surface() {
|
||||||
|
Func3D func = new Func3D((x,y)->x * Math.sin(x * y));
|
||||||
|
Range range = new Range(-3, 3);
|
||||||
|
int steps = 50;
|
||||||
|
|
||||||
|
Shape surface = new SurfaceBuilder().orthonormal(new OrthonormalGrid(range, steps), func);
|
||||||
|
|
||||||
|
ColorMapper colorMapper =
|
||||||
|
new ColorMapper(new ColorMapRainbow(), surface, new Color(1, 1, 1, ALPHA_FACTOR));// 0.65f));
|
||||||
|
surface.setColorMapper(colorMapper);
|
||||||
|
surface.setFaceDisplayed(true);
|
||||||
|
surface.setWireframeDisplayed(true);
|
||||||
|
surface.setWireframeColor(Color.BLACK);
|
||||||
|
surface.setWireframeWidth(1);
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package org.jzy3d.tests.manual.layout;
|
||||||
|
|
||||||
|
import org.jzy3d.chart.factories.AWTChartFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QTP
|
||||||
|
* valider avec / sans HiDPI :
|
||||||
|
* - le layout du texte est le même
|
||||||
|
* - les marges / offset sont appliquées correctement
|
||||||
|
* - marche côté gauche / côté droit
|
||||||
|
* - avec vertical / oblique / etc
|
||||||
|
*
|
||||||
|
* - Le calcul d'offset de label ne prend pas en compte la rotation du texte dans la place qu'il prend
|
||||||
|
*
|
||||||
|
* @author martin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MTest_Layout_Native {
|
||||||
|
|
||||||
|
static final float ALPHA_FACTOR = 0.55f;// .61f;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
MTest_Layout_EmulGL d = new MTest_Layout_EmulGL();
|
||||||
|
d.setFactory(new AWTChartFactory());
|
||||||
|
d.init();
|
||||||
|
|
||||||
|
d.getChart().open(1264, 812);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue