diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/graphic_objects/tests | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'modules/graphic_objects/tests')
19 files changed, 2029 insertions, 0 deletions
diff --git a/modules/graphic_objects/tests/java/org/scilab/tests/modules/graphic_objects/testAxes.java b/modules/graphic_objects/tests/java/org/scilab/tests/modules/graphic_objects/testAxes.java new file mode 100755 index 000000000..fe221e880 --- /dev/null +++ b/modules/graphic_objects/tests/java/org/scilab/tests/modules/graphic_objects/testAxes.java @@ -0,0 +1,1183 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - DIGITEO - Manuel JULIACHS + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.tests.modules.graphic_objects; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.rmi.server.UID; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Random; + +import org.scilab.modules.graphic_objects.axes.Axes; +import org.scilab.modules.graphic_objects.axes.Axes.GridPosition; +import org.scilab.modules.graphic_objects.axes.AxisProperty.AxisLocation; +import org.scilab.modules.graphic_objects.axes.Box.BoxType; +import org.scilab.modules.graphic_objects.axes.Camera.ViewType; +import org.scilab.modules.graphic_objects.graphicController.GraphicController; +import org.scilab.modules.graphic_objects.graphicObject.GraphicObject; +import org.scilab.modules.graphic_objects.graphicObject.GraphicObject.Type; +import org.scilab.modules.graphic_objects.label.Label; +import org.scilab.modules.graphic_objects.textObject.FormattedText; +import org.scilab.modules.graphic_objects.textObject.Font; + +import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.*; + +import org.junit.*; + +/** + * Axes test class + * @author Manuel JULIACHS + */ +public class testAxes { + + /** The default number of ticks */ + public static final int DEFAULT_NUMBER_OF_TICKS = 11; + + /** Figure identifier */ + private Integer figureID; + + /** The Axes identifier */ + private Integer axesID; + + /** X-Axis label identifier */ + private Integer xlabelID; + + /** Y-Axis label identifier */ + private Integer ylabelID; + + /** Z-Axis label identifier */ + private Integer zlabelID; + + /** Title label identifier */ + private Integer titleID; + + /** Graphic controller */ + private GraphicController controller; + + /** X-Axis label */ + private Label xlabel; + + /** Y-Axis label */ + private Label ylabel; + + /** Z-Axis label */ + private Label zlabel; + + /** title label */ + private Label title; + + /** Axes object used for data initialization */ + private Axes initAxes; + + /** + * Creates the Axes graphic object. + * Called only once. + */ + @Before + public void createAxes() { + + controller = GraphicController.getController(); + assert controller != null; + + axesID = controller.askObject(Type.AXES); + GraphicObject axes = (GraphicObject) controller.getObjectFromId(axesID); + assert axes != null; + + /* Allocate an empty figure and link the axes and figure */ + final Integer figureID = controller.askObject(Type.FIGURE); + axes.setParent(figureID); + } + + /** + * Utility method which creates the graphic objects used by the Axes object and + * initializes data relevant to the Axes properties. + * Must be called prior to any set/get calls, once per group of tests (see below). + * Most properties are randomly chosen (for example the axes properties such as visible, + * reverse, data bounds values are offset by a random value, etc.). Only a few are not + * (such as each axis' location or the box type). + * The point of random initialization is to ensure that set and get work correctly, by comparing + * the initial random values which are then assigned by set calls to the results obtained by get calls + * (the former and the latter should of course be equal). + */ + @Before + public void initializeData() { + this.createAxes(); + figureID = controller.askObject(Type.FIGURE); + GraphicObject parentFigure = (GraphicObject) controller.getObjectFromId(figureID); + assert parentFigure != null; + + xlabelID = controller.askObject(Type.LABEL); + xlabel = (Label) controller.getObjectFromId(xlabelID); + assert xlabel != null; + + ylabelID = controller.askObject(Type.LABEL); + ylabel = (Label) controller.getObjectFromId(ylabelID); + assert ylabel != null; + + zlabelID = controller.askObject(Type.LABEL); + zlabel = (Label) controller.getObjectFromId(zlabelID); + assert zlabel != null; + + titleID = controller.askObject(Type.LABEL); + title = (Label) controller.getObjectFromId(titleID); + assert title != null; + + Random randomGen = new Random(); + + initAxes = new Axes(); + assert initAxes != null; + + /* Allocate an empty figure and link the axes and figure */ + final Integer figureInitID = controller.askObject(Type.FIGURE); + initAxes.setParent(figureInitID); + + /* GraphicObjects properties */ + initAxes.setVisible(randomGen.nextBoolean()); + + /* Axes properties */ + Integer axisLocation = randomGen.nextInt(6); + initAxes.setXAxisVisible(randomGen.nextBoolean()); + initAxes.setXAxisReverse(randomGen.nextBoolean()); + initAxes.setXAxisGridColor(randomGen.nextInt()); + initAxes.setXAxisLocationAsEnum(AxisLocation.intToEnum(axisLocation)); + initAxes.setXAxisLogFlag(randomGen.nextBoolean()); + initAxes.setXAxisAutoTicks(randomGen.nextBoolean()); + initAxes.setXAxisSubticks(randomGen.nextInt()); + + axisLocation = randomGen.nextInt(6); + initAxes.setYAxisVisible(randomGen.nextBoolean()); + initAxes.setYAxisReverse(randomGen.nextBoolean()); + initAxes.setYAxisGridColor(randomGen.nextInt()); + initAxes.setYAxisLocationAsEnum(AxisLocation.intToEnum(axisLocation)); + initAxes.setYAxisLogFlag(randomGen.nextBoolean()); + initAxes.setYAxisAutoTicks(randomGen.nextBoolean()); + initAxes.setYAxisSubticks(randomGen.nextInt()); + + axisLocation = randomGen.nextInt(6); + initAxes.setZAxisVisible(randomGen.nextBoolean()); + initAxes.setZAxisReverse(randomGen.nextBoolean()); + initAxes.setZAxisGridColor(randomGen.nextInt()); + initAxes.setZAxisLocationAsEnum(AxisLocation.intToEnum(axisLocation)); + initAxes.setZAxisLogFlag(randomGen.nextBoolean()); + initAxes.setZAxisAutoTicks(randomGen.nextBoolean()); + initAxes.setZAxisSubticks(randomGen.nextInt()); + + /* ticks locations */ + + Double dataXShift = randomGen.nextDouble() % 0.1; + Double dataYShift = randomGen.nextDouble() % 0.1; + Double dataZShift = randomGen.nextDouble() % 0.1; + + Double xMin = dataXShift; + Double yMin = dataXShift; + Double zMin = -1.0 + dataXShift; + + Double[] dataBounds = new Double[] {dataXShift, dataYShift, -1.0 + dataZShift, + 1.0 + dataXShift, 1.0 + dataYShift, 1.0 + dataZShift + }; + Double[] realDataBounds = new Double[] {dataXShift, dataYShift, -1.0 + dataZShift, + 1.0 + dataXShift, 1.0 + dataYShift, 1.0 + dataZShift + }; + + Double[] xlocs = new Double[DEFAULT_NUMBER_OF_TICKS]; + Double[] ylocs = new Double[DEFAULT_NUMBER_OF_TICKS]; + Double[] zlocs = new Double[DEFAULT_NUMBER_OF_TICKS]; + + for (int i = 0; i < DEFAULT_NUMBER_OF_TICKS; i++) { + double posRatio = (double) i / (double) DEFAULT_NUMBER_OF_TICKS; + xlocs[i] = posRatio * (dataBounds[3] - dataBounds[0]) + dataBounds[0]; + ylocs[i] = posRatio * (dataBounds[4] - dataBounds[1]) + dataBounds[1]; + zlocs[i] = posRatio * (dataBounds[5] - dataBounds[2]) + dataBounds[2]; + } + + ArrayList <FormattedText> xlabels = new ArrayList(DEFAULT_NUMBER_OF_TICKS); + ArrayList <FormattedText> ylabels = new ArrayList(DEFAULT_NUMBER_OF_TICKS); + ArrayList <FormattedText> zlabels = new ArrayList(DEFAULT_NUMBER_OF_TICKS); + + Font xFont = new Font(); + xFont.setColor(randomGen.nextInt()); + xFont.setSize(1.0); + Font yFont = new Font(); + yFont.setColor(randomGen.nextInt()); + yFont.setSize(2.0); + Font zFont = new Font(); + zFont.setColor(randomGen.nextInt()); + zFont.setSize(3.0); + + for (int i = 0; i < DEFAULT_NUMBER_OF_TICKS; i++) { + FormattedText newtext = new FormattedText(); + Integer ind = new Integer(i); + newtext.setText("Xtext" + ind.toString()); + newtext.setFont(xFont); + xlabels.add(newtext); + newtext = new FormattedText(); + newtext.setText("Ytext" + ind.toString()); + newtext.setFont(yFont); + ylabels.add(newtext); + newtext = new FormattedText(); + newtext.setText("Ztext" + ind.toString()); + newtext.setFont(zFont); + zlabels.add(newtext); + } + + initAxes.setXAxisTicksLocations(xlocs); + initAxes.setXAxisTicksLabelsAsArrayList(xlabels); + initAxes.setYAxisTicksLocations(ylocs); + initAxes.setYAxisTicksLabelsAsArrayList(ylabels); + initAxes.setZAxisTicksLocations(zlocs); + initAxes.setZAxisTicksLabelsAsArrayList(zlabels); + + initAxes.setAutoSubticks(randomGen.nextBoolean()); + + /* Miscellaneous Axes properties */ + Double marginXShift = randomGen.nextDouble() % 0.1; + Double marginYShift = randomGen.nextDouble() % 0.1; + Double[] margins = new Double[] {0.15 + marginXShift, 0.15 + marginXShift, 0.15 + marginYShift, 0.15 + marginYShift}; + Double axesBoundsXShift = randomGen.nextDouble() % 0.1; + Double axesBoundsYShift = randomGen.nextDouble() % 0.1; + Double[] axesBounds = new Double[] {axesBoundsXShift, axesBoundsYShift, 1.0 - axesBoundsXShift, 1.0 - axesBoundsYShift}; + + initAxes.setGridPositionAsEnum(GridPosition.BACKGROUND); + initAxes.setAutoClear(randomGen.nextBoolean()); + initAxes.setFilled(randomGen.nextBoolean()); + initAxes.setBackground(randomGen.nextInt()); + initAxes.setMargins(margins); + initAxes.setAxesBounds(axesBounds); + + /* Properties applied to child objects */ + initAxes.setHiddenColor(randomGen.nextInt()); + initAxes.setLineMode(randomGen.nextBoolean()); + initAxes.setLineStyle(randomGen.nextInt(7)); + initAxes.setLineThickness(randomGen.nextDouble()); + initAxes.setLineColor(randomGen.nextInt()); + + initAxes.setMarkMode(randomGen.nextBoolean()); + initAxes.setMarkStyle(randomGen.nextInt()); + initAxes.setMarkSize(randomGen.nextInt()); + initAxes.setMarkSizeUnit(randomGen.nextInt(2)); + initAxes.setMarkForeground(randomGen.nextInt()); + initAxes.setMarkBackground(randomGen.nextInt()); + + initAxes.setClipState(randomGen.nextInt(3)); + + Double xShift = randomGen.nextDouble() % 0.2; + Double yShift = randomGen.nextDouble() % 0.2; + Double xDim = 0.8 + randomGen.nextDouble() % 1.0; + Double yDim = 0.8 + randomGen.nextDouble() % 1.0; + Double[] clipBox = new Double[] {1.0 - xShift, 1.0 - yShift, xDim, yDim}; + + initAxes.setClipBox(clipBox); + + initAxes.setArcDrawingMethod(randomGen.nextInt(2)); + + /* Camera properties */ + Double[] rotationAngles = new Double[] {randomGen.nextDouble() * 90.0, randomGen.nextDouble() * 360.0}; + + initAxes.setViewAsEnum(ViewType.VIEW_3D); + initAxes.setCubeScaling(randomGen.nextBoolean()); + initAxes.setIsoview(randomGen.nextBoolean()); + initAxes.setRotationAngles(rotationAngles); + + /* Box properties */ + Double zoomXShift = randomGen.nextDouble() % 0.1; + Double zoomYShift = randomGen.nextDouble() % 0.1; + Double zoomZShift = randomGen.nextDouble() % 0.1; + Double[] zoomBox = new Double[] {zoomXShift, zoomYShift, -1.0 + zoomZShift, 1.0 - zoomXShift, 1.0 - zoomYShift, 1.0 - zoomZShift}; + + Integer boxType = randomGen.nextInt(4); + initAxes.setBoxTypeAsEnum(BoxType.intToEnum(boxType)); + + initAxes.setHiddenAxisColor(randomGen.nextInt()); + initAxes.setTightLimits(randomGen.nextBoolean()); + initAxes.setDataBounds(dataBounds); + initAxes.setRealDataBounds(realDataBounds); + initAxes.setZoomEnabled(randomGen.nextBoolean()); + initAxes.setZoomBox(zoomBox); + initAxes.setAutoScale(randomGen.nextBoolean()); + initAxes.setFirstPlot(randomGen.nextBoolean()); + } + + /* Reflection-based set/get methods tests */ + /* GraphicObject properties */ + @Test + public void testReflectSetGetAxesVisible() { + controller.setProperty(axesID, __GO_VISIBLE__, initAxes.getVisible()); + Boolean axesVisible = (Boolean) controller.getProperty(axesID, __GO_VISIBLE__); + assert axesVisible.equals(initAxes.getVisible()); + } + + /* X-Axis properties */ + @Test + public void testReflectSetGetXAxisVisible() { + controller.setProperty(axesID, __GO_X_AXIS_VISIBLE__, initAxes.getXAxisVisible()); + Boolean retAxisVisible = (Boolean) controller.getProperty(axesID, __GO_X_AXIS_VISIBLE__); + assert (retAxisVisible.equals(initAxes.getXAxisVisible())); + } + @Test + public void testReflectSetGetXAxisReverse() { + controller.setProperty(axesID, __GO_X_AXIS_REVERSE__, initAxes.getXAxisReverse()); + Boolean retAxisReverse = (Boolean) controller.getProperty(axesID, __GO_X_AXIS_REVERSE__); + assert (retAxisReverse.equals(initAxes.getXAxisReverse())); + } + @Test + public void testReflectSetGetXAxisGridColor() { + controller.setProperty(axesID, __GO_X_AXIS_GRID_COLOR__, initAxes.getXAxisGridColor()); + Integer retGridColor = (Integer) controller.getProperty(axesID, __GO_X_AXIS_GRID_COLOR__); + assert retGridColor.equals(initAxes.getXAxisGridColor()); + } + @Test + public void testReflectSetGetXAxisLabel() { + controller.setProperty(axesID, __GO_X_AXIS_LABEL__, xlabelID); + Integer retXlabel = (Integer) controller.getProperty(axesID, __GO_X_AXIS_LABEL__); + assert retXlabel.equals(xlabelID); + } + @Test + public void testReflectSetGetXAxisLocation() { + controller.setProperty(axesID, __GO_X_AXIS_LOCATION__, initAxes.getXAxisLocation()); + Integer retAxisLocation = (Integer) controller.getProperty(axesID, __GO_X_AXIS_LOCATION__); + assert retAxisLocation.equals(initAxes.getXAxisLocation()); + } + @Test + public void testReflectSetGetXAxisLogFlag() { + controller.setProperty(axesID, __GO_X_AXIS_LOG_FLAG__, initAxes.getXAxisLogFlag()); + Boolean retLogFlag = (Boolean) controller.getProperty(axesID, __GO_X_AXIS_LOG_FLAG__); + assert retLogFlag.equals(initAxes.getXAxisLogFlag()); + } + @Test + public void testReflectSetGetXAxisAutoTicks() { + controller.setProperty(axesID, __GO_X_AXIS_AUTO_TICKS__, initAxes.getXAxisAutoTicks()); + Boolean retAutoTicks = (Boolean) controller.getProperty(axesID, __GO_X_AXIS_AUTO_TICKS__); + assert retAutoTicks.equals(initAxes.getXAxisAutoTicks()); + } + @Test + public void testReflectSetGetXAxisSubTicks() { + controller.setProperty(axesID, __GO_X_AXIS_SUBTICKS__, initAxes.getXAxisSubticks()); + Integer retSubTicks = (Integer) controller.getProperty(axesID, __GO_X_AXIS_SUBTICKS__); + assert retSubTicks.equals(initAxes.getXAxisSubticks()); + } + @Test + public void testReflectSetGetXAxisTicksLocations() { + controller.setProperty(axesID, __GO_X_AXIS_TICKS_LOCATIONS__, initAxes.getXAxisTicksLocations()); + Double[] retTicksLocations = (Double[]) controller.getProperty(axesID, __GO_X_AXIS_TICKS_LOCATIONS__); + assert Arrays.equals(retTicksLocations, initAxes.getXAxisTicksLocations()); + } + @Test + public void testReflectSetGetXAxisTicksLabels() { + controller.setProperty(axesID, __GO_X_AXIS_TICKS_LABELS__, initAxes.getXAxisTicksLabels()); + String[] retTicksLabels = (String[]) controller.getProperty(axesID, __GO_X_AXIS_TICKS_LABELS__); + + assert Arrays.equals(retTicksLabels, initAxes.getXAxisTicksLabels()); + } + + /* Y-Axis properties */ + @Test + public void testReflectSetGetYAxisVisible() { + controller.setProperty(axesID, __GO_Y_AXIS_VISIBLE__, initAxes.getYAxisVisible()); + Boolean retAxisVisible = (Boolean) controller.getProperty(axesID, __GO_Y_AXIS_VISIBLE__); + assert (retAxisVisible.equals(initAxes.getYAxisVisible())); + } + @Test + public void testReflectSetGetYAxisReverse() { + controller.setProperty(axesID, __GO_Y_AXIS_REVERSE__, initAxes.getYAxisReverse()); + Boolean retAxisReverse = (Boolean) controller.getProperty(axesID, __GO_Y_AXIS_REVERSE__); + assert (retAxisReverse.equals(initAxes.getYAxisReverse())); + } + @Test + public void testReflectSetGetYAxisGridColor() { + controller.setProperty(axesID, __GO_Y_AXIS_GRID_COLOR__, initAxes.getYAxisGridColor()); + Integer retGridColor = (Integer) controller.getProperty(axesID, __GO_Y_AXIS_GRID_COLOR__); + assert retGridColor.equals(initAxes.getYAxisGridColor()); + } + @Test + public void testReflectSetGetYAxisLabel() { + controller.setProperty(axesID, __GO_Y_AXIS_LABEL__, ylabelID); + Integer retlabel = (Integer) controller.getProperty(axesID, __GO_Y_AXIS_LABEL__); + assert retlabel.equals(ylabelID); + } + @Test + public void testReflectSetGetYAxisLocation() { + controller.setProperty(axesID, __GO_Y_AXIS_LOCATION__, initAxes.getYAxisLocation()); + Integer retAxisLocation = (Integer) controller.getProperty(axesID, __GO_Y_AXIS_LOCATION__); + assert retAxisLocation.equals(initAxes.getYAxisLocation()); + } + @Test + public void testReflectSetGetYAxisLogFlag() { + controller.setProperty(axesID, __GO_Y_AXIS_LOG_FLAG__, initAxes.getYAxisLogFlag()); + Boolean retLogFlag = (Boolean) controller.getProperty(axesID, __GO_Y_AXIS_LOG_FLAG__); + assert retLogFlag.equals(initAxes.getYAxisLogFlag()); + } + @Test + public void testReflectSetGetYAxisAutoTicks() { + controller.setProperty(axesID, __GO_Y_AXIS_AUTO_TICKS__, initAxes.getYAxisAutoTicks()); + Boolean retAutoTicks = (Boolean) controller.getProperty(axesID, __GO_Y_AXIS_AUTO_TICKS__); + assert retAutoTicks.equals(initAxes.getYAxisAutoTicks()); + } + @Test + public void testReflectSetGetYAxisSubTicks() { + controller.setProperty(axesID, __GO_Y_AXIS_SUBTICKS__, initAxes.getYAxisSubticks()); + Integer retSubTicks = (Integer) controller.getProperty(axesID, __GO_Y_AXIS_SUBTICKS__); + assert retSubTicks.equals(initAxes.getYAxisSubticks()); + } + @Test + public void testReflectSetGetYAxisTicksLocations() { + controller.setProperty(axesID, __GO_Y_AXIS_TICKS_LOCATIONS__, initAxes.getYAxisTicksLocations()); + Double[] retTicksLocations = (Double[]) controller.getProperty(axesID, __GO_Y_AXIS_TICKS_LOCATIONS__); + assert Arrays.equals(retTicksLocations, initAxes.getYAxisTicksLocations()); + } + @Test + public void testReflectSetGetYAxisTicksLabels() { + controller.setProperty(axesID, __GO_Y_AXIS_TICKS_LABELS__, initAxes.getYAxisTicksLabels()); + String[] retTicksLabels = (String[]) controller.getProperty(axesID, __GO_Y_AXIS_TICKS_LABELS__); + + assert Arrays.equals(retTicksLabels, initAxes.getYAxisTicksLabels()); + } + + /* Z-Axis properties */ + @Test + public void testReflectSetGetZAxisVisible() { + controller.setProperty(axesID, __GO_Z_AXIS_VISIBLE__, initAxes.getZAxisVisible()); + Boolean retAxisVisible = (Boolean) controller.getProperty(axesID, __GO_Z_AXIS_VISIBLE__); + assert (retAxisVisible.equals(initAxes.getZAxisVisible())); + } + @Test + public void testReflectSetGetZAxisReverse() { + controller.setProperty(axesID, __GO_Z_AXIS_REVERSE__, initAxes.getZAxisReverse()); + Boolean retAxisReverse = (Boolean) controller.getProperty(axesID, __GO_Z_AXIS_REVERSE__); + assert (retAxisReverse.equals(initAxes.getZAxisReverse())); + } + @Test + public void testReflectSetGetZAxisGridColor() { + controller.setProperty(axesID, __GO_Z_AXIS_GRID_COLOR__, initAxes.getZAxisGridColor()); + Integer retGridColor = (Integer) controller.getProperty(axesID, __GO_Z_AXIS_GRID_COLOR__); + assert retGridColor.equals(initAxes.getZAxisGridColor()); + } + @Test + public void testReflectSetGetZAxisLabel() { + controller.setProperty(axesID, __GO_Z_AXIS_LABEL__, zlabelID); + Integer retlabel = (Integer) controller.getProperty(axesID, __GO_Z_AXIS_LABEL__); + assert retlabel.equals(zlabelID); + } + @Test + public void testReflectSetGetZAxisLocation() { + controller.setProperty(axesID, __GO_Z_AXIS_LOCATION__, initAxes.getZAxisLocation()); + Integer retAxisLocation = (Integer) controller.getProperty(axesID, __GO_Z_AXIS_LOCATION__); + assert retAxisLocation.equals(initAxes.getZAxisLocation()); + } + @Test + public void testReflectSetGetZAxisLogFlag() { + controller.setProperty(axesID, __GO_Z_AXIS_LOG_FLAG__, initAxes.getZAxisLogFlag()); + Boolean retLogFlag = (Boolean) controller.getProperty(axesID, __GO_Z_AXIS_LOG_FLAG__); + assert retLogFlag.equals(initAxes.getZAxisLogFlag()); + } + @Test + public void testReflectSetGetZAxisAutoTicks() { + controller.setProperty(axesID, __GO_Z_AXIS_AUTO_TICKS__, initAxes.getZAxisAutoTicks()); + Boolean retAutoTicks = (Boolean) controller.getProperty(axesID, __GO_Z_AXIS_AUTO_TICKS__); + assert retAutoTicks.equals(initAxes.getZAxisAutoTicks()); + } + @Test + public void testReflectSetGetZAxisSubTicks() { + controller.setProperty(axesID, __GO_Z_AXIS_SUBTICKS__, initAxes.getZAxisSubticks()); + Integer retSubTicks = (Integer) controller.getProperty(axesID, __GO_Z_AXIS_SUBTICKS__); + assert retSubTicks.equals(initAxes.getZAxisSubticks()); + } + @Test + public void testReflectSetGetZAxisTicksLocations() { + controller.setProperty(axesID, __GO_Z_AXIS_TICKS_LOCATIONS__, initAxes.getZAxisTicksLocations()); + Double[] retTicksLocations = (Double[]) controller.getProperty(axesID, __GO_Z_AXIS_TICKS_LOCATIONS__); + assert Arrays.equals(retTicksLocations, initAxes.getZAxisTicksLocations()); + } + @Test + public void testReflectSetGetZAxisTicksLabels() { + controller.setProperty(axesID, __GO_Z_AXIS_TICKS_LABELS__, initAxes.getZAxisTicksLabels()); + String[] retTicksLabels = (String[]) controller.getProperty(axesID, __GO_Z_AXIS_TICKS_LABELS__); + + assert Arrays.equals(retTicksLabels, initAxes.getZAxisTicksLabels()); + } + + /* Ticks property shared by the three axes */ + @Test + public void testReflectSetGetAutoSubticks() { + controller.setProperty(axesID, __GO_AUTO_SUBTICKS__, initAxes.getAutoSubticks()); + Boolean retAutoSubticks = (Boolean) controller.getProperty(axesID, __GO_AUTO_SUBTICKS__); + assert retAutoSubticks.equals(initAxes.getAutoSubticks()); + } + + /* Miscellaneous Axes properties */ + @Test + public void testReflectSetGetGridPosition() { + controller.setProperty(axesID, __GO_GRID_POSITION__, initAxes.getGridPosition()); + Integer retGridPos = (Integer) controller.getProperty(axesID, __GO_GRID_POSITION__); + assert retGridPos.equals(initAxes.getGridPosition()); + } + @Test + public void testReflectSetGetTitle() { + controller.setProperty(axesID, __GO_TITLE__, titleID); + Integer retTitle = (Integer) controller.getProperty(axesID, __GO_TITLE__); + assert retTitle.equals(titleID); + } + @Test + public void testReflectSetGetAutoClear() { + controller.setProperty(axesID, __GO_AUTO_CLEAR__, initAxes.getAutoClear()); + Boolean retAutoClear = (Boolean) controller.getProperty(axesID, __GO_AUTO_CLEAR__); + assert retAutoClear.equals(initAxes.getAutoClear()); + } + @Test + public void testReflectSetGetFilled() { + controller.setProperty(axesID, __GO_FILLED__, initAxes.getFilled()); + Boolean retFilled = (Boolean) controller.getProperty(axesID, __GO_FILLED__); + assert retFilled.equals(initAxes.getFilled()); + } + @Test + public void testReflectSetGetBackground() { + controller.setProperty(axesID, __GO_BACKGROUND__, initAxes.getBackground()); + Integer retBackground = (Integer) controller.getProperty(axesID, __GO_BACKGROUND__); + assert retBackground.equals(initAxes.getBackground()); + } + @Test + public void testReflectSetGetMargins() { + controller.setProperty(axesID, __GO_MARGINS__, initAxes.getMargins()); + Double[] retMargins = (Double[]) controller.getProperty(axesID, __GO_MARGINS__); + assert Arrays.equals(retMargins, initAxes.getMargins()); + } + @Test + public void testReflectSetGetAxesBounds() { + controller.setProperty(axesID, __GO_AXES_BOUNDS__, initAxes.getAxesBounds()); + Double[] retAxesBounds = (Double[]) controller.getProperty(axesID, __GO_AXES_BOUNDS__); + assert Arrays.equals(retAxesBounds, initAxes.getAxesBounds()); + } + + /* Camera properties */ + @Test + public void testReflectSetGetView() { + controller.setProperty(axesID, __GO_VIEW__, initAxes.getView()); + Integer retView = (Integer) controller.getProperty(axesID, __GO_VIEW__); + assert retView.equals(initAxes.getView()); + } + @Test + public void testReflectSetGetIsoview() { + controller.setProperty(axesID, __GO_ISOVIEW__, initAxes.getIsoview()); + Boolean retIsoview = (Boolean) controller.getProperty(axesID, __GO_ISOVIEW__); + assert retIsoview.equals(initAxes.getIsoview()); + } + @Test + public void testReflectSetGetCubeScaling() { + controller.setProperty(axesID, __GO_CUBE_SCALING__, initAxes.getCubeScaling()); + Boolean retCubeScaling = (Boolean) controller.getProperty(axesID, __GO_CUBE_SCALING__); + assert retCubeScaling.equals(initAxes.getCubeScaling()); + } + @Test + public void testReflectSetGetRotationAngles() { + controller.setProperty(axesID, __GO_ROTATION_ANGLES__, initAxes.getRotationAngles()); + Double[] retRotationAngles = (Double[]) controller.getProperty(axesID, __GO_ROTATION_ANGLES__); + assert (Arrays.equals(retRotationAngles, initAxes.getRotationAngles()) && retRotationAngles.length == 2); + } + + /* Box properties */ + @Test + public void testReflectSetGetBoxType() { + controller.setProperty(axesID, __GO_BOX_TYPE__, initAxes.getBoxType()); + Integer retBoxType = (Integer) controller.getProperty(axesID, __GO_BOX_TYPE__); + assert retBoxType.equals(initAxes.getBoxType()); + } + @Test + public void testReflectSetGetHiddenAxisColor() { + controller.setProperty(axesID, __GO_HIDDEN_AXIS_COLOR__, initAxes.getHiddenAxisColor()); + Integer retHiddenAxisColor = (Integer) controller.getProperty(axesID, __GO_HIDDEN_AXIS_COLOR__); + assert retHiddenAxisColor.equals(initAxes.getHiddenAxisColor()); + } + @Test + public void testReflectSetGetTightLimits() { + controller.setProperty(axesID, __GO_TIGHT_LIMITS__, initAxes.getTightLimits()); + Boolean retTightLimits = (Boolean) controller.getProperty(axesID, __GO_TIGHT_LIMITS__); + assert retTightLimits.equals(initAxes.getTightLimits()); + } + @Test + public void testReflectSetGetDataBounds() { + controller.setProperty(axesID, __GO_DATA_BOUNDS__, initAxes.getDataBounds()); + Double[] retDataBounds = (Double[]) controller.getProperty(axesID, __GO_DATA_BOUNDS__); + assert Arrays.equals(retDataBounds, initAxes.getDataBounds()); + } + @Test + public void testReflectSetGetRealDataBounds() { + controller.setProperty(axesID, __GO_REAL_DATA_BOUNDS__, initAxes.getRealDataBounds()); + Double[] retRealDataBounds = (Double[]) controller.getProperty(axesID, __GO_REAL_DATA_BOUNDS__); + assert Arrays.equals(retRealDataBounds, initAxes.getRealDataBounds()); + } + @Test + public void testReflectSetGetZoomEnabled() { + controller.setProperty(axesID, __GO_ZOOM_ENABLED__, initAxes.getZoomEnabled()); + Boolean retZoomEnabled = (Boolean) controller.getProperty(axesID, __GO_ZOOM_ENABLED__); + assert retZoomEnabled.equals(initAxes.getZoomEnabled()); + } + @Test + public void testReflectSetGetZoomBox() { + controller.setProperty(axesID, __GO_ZOOM_BOX__, initAxes.getZoomBox()); + Double[] retZoomBox = (Double[]) controller.getProperty(axesID, __GO_ZOOM_BOX__); + assert Arrays.equals(retZoomBox, initAxes.getZoomBox()); + } + @Test + public void testReflectSetGetAutoScale() { + controller.setProperty(axesID, __GO_AUTO_SCALE__, initAxes.getAutoScale()); + Boolean retAutoScale = (Boolean) controller.getProperty(axesID, __GO_AUTO_SCALE__); + assert retAutoScale.equals(initAxes.getAutoScale()); + } + @Test + public void testReflectSetGetFirstPlot() { + controller.setProperty(axesID, __GO_FIRST_PLOT__, initAxes.getFirstPlot()); + Boolean retFirstPlot = (Boolean) controller.getProperty(axesID, __GO_FIRST_PLOT__); + assert retFirstPlot.equals(initAxes.getFirstPlot()); + } + + /* Default properties */ + @Test + public void testReflectSetGetHiddenColor() { + controller.setProperty(axesID, __GO_HIDDEN_COLOR__, initAxes.getHiddenColor()); + Integer retHiddenColor = (Integer) controller.getProperty(axesID, __GO_HIDDEN_COLOR__); + assert retHiddenColor.equals(initAxes.getHiddenColor()); + } + @Test + public void testReflectSetGetLineMode() { + controller.setProperty(axesID, __GO_LINE_MODE__, initAxes.getLineMode()); + Boolean retLineMode = (Boolean) controller.getProperty(axesID, __GO_LINE_MODE__); + assert retLineMode.equals(initAxes.getLineMode()); + } + @Test + public void testReflectSetGetLineStyle() { + controller.setProperty(axesID, __GO_LINE_STYLE__, initAxes.getLineStyle()); + Integer retLineStyle = (Integer) controller.getProperty(axesID, __GO_LINE_STYLE__); + assert retLineStyle.equals(initAxes.getLineStyle()); + } + @Test + public void testReflectSetGetLineThickness() { + controller.setProperty(axesID, __GO_LINE_THICKNESS__, initAxes.getLineThickness()); + Double retLineThickness = (Double) controller.getProperty(axesID, __GO_LINE_THICKNESS__); + assert retLineThickness.equals(initAxes.getLineThickness()); + } + @Test + public void testReflectSetGetLineColor() { + controller.setProperty(axesID, __GO_LINE_COLOR__, initAxes.getLineColor()); + Integer retLineColor = (Integer) controller.getProperty(axesID, __GO_LINE_COLOR__); + assert retLineColor.equals(initAxes.getLineColor()); + } + @Test + public void testReflectSetGetMarkMode() { + controller.setProperty(axesID, __GO_MARK_MODE__, initAxes.getMarkMode()); + Boolean retMarkMode = (Boolean) controller.getProperty(axesID, __GO_MARK_MODE__); + assert retMarkMode.equals(initAxes.getMarkMode()); + } + @Test + public void testReflectSetGetMarkStyle() { + controller.setProperty(axesID, __GO_MARK_STYLE__, initAxes.getMarkStyle()); + Integer retMarkStyle = (Integer) controller.getProperty(axesID, __GO_MARK_STYLE__); + assert retMarkStyle.equals(initAxes.getMarkStyle()); + } + @Test + public void testReflectSetGetMarkSize() { + controller.setProperty(axesID, __GO_MARK_SIZE__, initAxes.getMarkSize()); + Integer retMarkSize = (Integer) controller.getProperty(axesID, __GO_MARK_SIZE__); + assert retMarkSize.equals(initAxes.getMarkSize()); + } + @Test + public void testReflectSetGetMarkSizeUnit() { + controller.setProperty(axesID, __GO_MARK_SIZE_UNIT__, initAxes.getMarkSizeUnit()); + Integer retMarkSizeUnit = (Integer) controller.getProperty(axesID, __GO_MARK_SIZE_UNIT__); + assert retMarkSizeUnit.equals(initAxes.getMarkSizeUnit()); + } + @Test + public void testReflectSetGetMarkForeground() { + controller.setProperty(axesID, __GO_MARK_FOREGROUND__, initAxes.getMarkForeground()); + Integer retMarkForeground = (Integer) controller.getProperty(axesID, __GO_MARK_FOREGROUND__); + assert retMarkForeground.equals(initAxes.getMarkForeground()); + } + @Test + public void testReflectSetGetMarkBackground() { + controller.setProperty(axesID, __GO_MARK_BACKGROUND__, initAxes.getMarkBackground()); + Integer retMarkBackground = (Integer) controller.getProperty(axesID, __GO_MARK_BACKGROUND__); + assert retMarkBackground.equals(initAxes.getMarkBackground()); + } + @Test + public void testReflectSetGetClipState() { + controller.setProperty(axesID, __GO_CLIP_STATE__, initAxes.getClipState()); + Integer retClipState = (Integer) controller.getProperty(axesID, __GO_CLIP_STATE__); + assert retClipState.equals(initAxes.getClipState()); + } + @Test + public void testReflectSetGetClipBox() { + controller.setProperty(axesID, __GO_CLIP_BOX__, initAxes.getClipBox()); + Double[] retClipBox = (Double[]) controller.getProperty(axesID, __GO_CLIP_BOX__); + assert Arrays.equals(retClipBox, initAxes.getClipBox()); + } + @Test + public void testReflectSetGetArcDrawingMethod() { + controller.setProperty(axesID, __GO_ARC_DRAWING_METHOD__, initAxes.getArcDrawingMethod()); + Integer retArcDrawingMethod = (Integer) controller.getProperty(axesID, __GO_ARC_DRAWING_METHOD__); + assert retArcDrawingMethod.equals(initAxes.getArcDrawingMethod()); + } + + /* Fast set/get methods tests */ + /* GraphicObject properties */ + + @Test + public void testFastSetGetParent() { + controller.setProperty(axesID, __GO_PARENT__, figureID); + Integer retParent = (Integer) controller.getProperty(axesID, __GO_PARENT__); + assert retParent.equals(figureID); + } + @Test + public void testFastSetGetAxesVisible() { + controller.setProperty(axesID, __GO_VISIBLE__, initAxes.getVisible()); + Boolean axesVisible = (Boolean) controller.getProperty(axesID, __GO_VISIBLE__); + assert axesVisible.equals(initAxes.getVisible()); + } + + + /* X-Axis properties */ + @Test + public void testFastSetGetXAxisVisible() { + controller.setProperty(axesID, __GO_X_AXIS_VISIBLE__, initAxes.getXAxisVisible()); + Boolean retAxisVisible = (Boolean) controller.getProperty(axesID, __GO_X_AXIS_VISIBLE__); + assert (retAxisVisible.equals(initAxes.getXAxisVisible())); + } + @Test + public void testFastSetGetXAxisReverse() { + controller.setProperty(axesID, __GO_X_AXIS_REVERSE__, initAxes.getXAxisReverse()); + Boolean retAxisReverse = (Boolean) controller.getProperty(axesID, __GO_X_AXIS_REVERSE__); + assert (retAxisReverse.equals(initAxes.getXAxisReverse())); + } + @Test + public void testFastSetGetXAxisGridColor() { + controller.setProperty(axesID, __GO_X_AXIS_GRID_COLOR__, initAxes.getXAxisGridColor()); + Integer retGridColor = (Integer) controller.getProperty(axesID, __GO_X_AXIS_GRID_COLOR__); + assert retGridColor.equals(initAxes.getXAxisGridColor()); + } + @Test + public void testFastSetGetXAxisLabel() { + controller.setProperty(axesID, __GO_X_AXIS_LABEL__, xlabelID); + Integer retXlabel = (Integer) controller.getProperty(axesID, __GO_X_AXIS_LABEL__); + assert retXlabel.equals(xlabelID); + } + @Test + public void testFastSetGetXAxisLocation() { + controller.setProperty(axesID, __GO_X_AXIS_LOCATION__, initAxes.getXAxisLocation()); + Integer retAxisLocation = (Integer) controller.getProperty(axesID, __GO_X_AXIS_LOCATION__); + assert retAxisLocation.equals(initAxes.getXAxisLocation()); + } + @Test + public void testFastSetGetXAxisLogFlag() { + controller.setProperty(axesID, __GO_X_AXIS_LOG_FLAG__, initAxes.getXAxisLogFlag()); + Boolean retLogFlag = (Boolean) controller.getProperty(axesID, __GO_X_AXIS_LOG_FLAG__); + assert retLogFlag.equals(initAxes.getXAxisLogFlag()); + } + @Test + public void testFastSetGetXAxisAutoTicks() { + controller.setProperty(axesID, __GO_X_AXIS_AUTO_TICKS__, initAxes.getXAxisAutoTicks()); + Boolean retAutoTicks = (Boolean) controller.getProperty(axesID, __GO_X_AXIS_AUTO_TICKS__); + assert retAutoTicks.equals(initAxes.getXAxisAutoTicks()); + } + @Test + public void testFastSetGetXAxisSubTicks() { + controller.setProperty(axesID, __GO_X_AXIS_SUBTICKS__, initAxes.getXAxisSubticks()); + Integer retSubTicks = (Integer) controller.getProperty(axesID, __GO_X_AXIS_SUBTICKS__); + assert retSubTicks.equals(initAxes.getXAxisSubticks()); + } + @Test + public void testFastSetGetXAxisTicksLocations() { + controller.setProperty(axesID, __GO_X_AXIS_TICKS_LOCATIONS__, initAxes.getXAxisTicksLocations()); + Double[] retTicksLocations = (Double[]) controller.getProperty(axesID, __GO_X_AXIS_TICKS_LOCATIONS__); + assert Arrays.equals(retTicksLocations, initAxes.getXAxisTicksLocations()); + } + @Test + public void testFastSetGetXAxisTicksLabels() { + controller.setProperty(axesID, __GO_X_AXIS_TICKS_LABELS__, initAxes.getXAxisTicksLabels()); + String[] retTicksLabels = (String[]) controller.getProperty(axesID, __GO_X_AXIS_TICKS_LABELS__); + assert Arrays.equals(retTicksLabels, initAxes.getXAxisTicksLabels()); + } + + /* Y-Axis properties */ + @Test + public void testFastSetGetYAxisVisible() { + controller.setProperty(axesID, __GO_Y_AXIS_VISIBLE__, initAxes.getYAxisVisible()); + Boolean retAxisVisible = (Boolean) controller.getProperty(axesID, __GO_Y_AXIS_VISIBLE__); + assert (retAxisVisible.equals(initAxes.getYAxisVisible())); + } + @Test + public void testFastSetGetYAxisReverse() { + controller.setProperty(axesID, __GO_Y_AXIS_REVERSE__, initAxes.getYAxisReverse()); + Boolean retAxisReverse = (Boolean) controller.getProperty(axesID, __GO_Y_AXIS_REVERSE__); + assert (retAxisReverse.equals(initAxes.getYAxisReverse())); + } + @Test + public void testFastSetGetYAxisGridColor() { + controller.setProperty(axesID, __GO_Y_AXIS_GRID_COLOR__, initAxes.getYAxisGridColor()); + Integer retGridColor = (Integer) controller.getProperty(axesID, __GO_Y_AXIS_GRID_COLOR__); + assert retGridColor.equals(initAxes.getYAxisGridColor()); + } + @Test + public void testFastSetGetYAxisLabel() { + controller.setProperty(axesID, __GO_Y_AXIS_LABEL__, ylabelID); + Integer retlabel = (Integer) controller.getProperty(axesID, __GO_Y_AXIS_LABEL__); + assert retlabel.equals(ylabelID); + } + @Test + public void testFastSetGetYAxisLocation() { + controller.setProperty(axesID, __GO_Y_AXIS_LOCATION__, initAxes.getYAxisLocation()); + Integer retAxisLocation = (Integer) controller.getProperty(axesID, __GO_Y_AXIS_LOCATION__); + assert retAxisLocation.equals(initAxes.getYAxisLocation()); + } + @Test + public void testFastSetGetYAxisLogFlag() { + controller.setProperty(axesID, __GO_Y_AXIS_LOG_FLAG__, initAxes.getYAxisLogFlag()); + Boolean retLogFlag = (Boolean) controller.getProperty(axesID, __GO_Y_AXIS_LOG_FLAG__); + assert retLogFlag.equals(initAxes.getYAxisLogFlag()); + } + @Test + public void testFastSetGetYAxisAutoTicks() { + controller.setProperty(axesID, __GO_Y_AXIS_AUTO_TICKS__, initAxes.getYAxisAutoTicks()); + Boolean retAutoTicks = (Boolean) controller.getProperty(axesID, __GO_Y_AXIS_AUTO_TICKS__); + assert retAutoTicks.equals(initAxes.getYAxisAutoTicks()); + } + @Test + public void testFastSetGetYAxisSubTicks() { + controller.setProperty(axesID, __GO_Y_AXIS_SUBTICKS__, initAxes.getYAxisSubticks()); + Integer retSubTicks = (Integer) controller.getProperty(axesID, __GO_Y_AXIS_SUBTICKS__); + assert retSubTicks.equals(initAxes.getYAxisSubticks()); + } + @Test + public void testFastSetGetYAxisTicksLocations() { + controller.setProperty(axesID, __GO_Y_AXIS_TICKS_LOCATIONS__, initAxes.getYAxisTicksLocations()); + Double[] retTicksLocations = (Double[]) controller.getProperty(axesID, __GO_Y_AXIS_TICKS_LOCATIONS__); + assert Arrays.equals(retTicksLocations, initAxes.getYAxisTicksLocations()); + } + @Test + public void testFastSetGetYAxisTicksLabels() { + controller.setProperty(axesID, __GO_Y_AXIS_TICKS_LABELS__, initAxes.getYAxisTicksLabels()); + String[] retTicksLabels = (String[]) controller.getProperty(axesID, __GO_Y_AXIS_TICKS_LABELS__); + assert Arrays.equals(retTicksLabels, initAxes.getYAxisTicksLabels()); + } + + /* Z-Axis properties */ + @Test + public void testFastSetGetZAxisVisible() { + controller.setProperty(axesID, __GO_Z_AXIS_VISIBLE__, initAxes.getZAxisVisible()); + Boolean retAxisVisible = (Boolean) controller.getProperty(axesID, __GO_Z_AXIS_VISIBLE__); + assert (retAxisVisible.equals(initAxes.getZAxisVisible())); + } + @Test + public void testFastSetGetZAxisReverse() { + controller.setProperty(axesID, __GO_Z_AXIS_REVERSE__, initAxes.getZAxisReverse()); + Boolean retAxisReverse = (Boolean) controller.getProperty(axesID, __GO_Z_AXIS_REVERSE__); + assert (retAxisReverse.equals(initAxes.getZAxisReverse())); + } + @Test + public void testFastSetGetZAxisGridColor() { + controller.setProperty(axesID, __GO_Z_AXIS_GRID_COLOR__, initAxes.getZAxisGridColor()); + Integer retGridColor = (Integer) controller.getProperty(axesID, __GO_Z_AXIS_GRID_COLOR__); + assert retGridColor.equals(initAxes.getZAxisGridColor()); + } + @Test + public void testFastSetGetZAxisLabel() { + controller.setProperty(axesID, __GO_Z_AXIS_LABEL__, zlabelID); + Integer retlabel = (Integer) controller.getProperty(axesID, __GO_Z_AXIS_LABEL__); + assert retlabel.equals(zlabelID); + } + @Test + public void testFastSetGetZAxisLocation() { + controller.setProperty(axesID, __GO_Z_AXIS_LOCATION__, initAxes.getZAxisLocation()); + Integer retAxisLocation = (Integer) controller.getProperty(axesID, __GO_Z_AXIS_LOCATION__); + assert retAxisLocation.equals(initAxes.getZAxisLocation()); + } + @Test + public void testFastSetGetZAxisLogFlag() { + controller.setProperty(axesID, __GO_Z_AXIS_LOG_FLAG__, initAxes.getZAxisLogFlag()); + Boolean retLogFlag = (Boolean) controller.getProperty(axesID, __GO_Z_AXIS_LOG_FLAG__); + assert retLogFlag.equals(initAxes.getZAxisLogFlag()); + } + @Test + public void testFastSetGetZAxisAutoTicks() { + controller.setProperty(axesID, __GO_Z_AXIS_AUTO_TICKS__, initAxes.getZAxisAutoTicks()); + Boolean retAutoTicks = (Boolean) controller.getProperty(axesID, __GO_Z_AXIS_AUTO_TICKS__); + assert retAutoTicks.equals(initAxes.getZAxisAutoTicks()); + } + @Test + public void testFastSetGetZAxisSubTicks() { + controller.setProperty(axesID, __GO_Z_AXIS_SUBTICKS__, initAxes.getZAxisSubticks()); + Integer retSubTicks = (Integer) controller.getProperty(axesID, __GO_Z_AXIS_SUBTICKS__); + assert retSubTicks.equals(initAxes.getZAxisSubticks()); + } + @Test + public void testFastSetGetZAxisTicksLocations() { + controller.setProperty(axesID, __GO_Z_AXIS_TICKS_LOCATIONS__, initAxes.getZAxisTicksLocations()); + Double[] retTicksLocations = (Double[]) controller.getProperty(axesID, __GO_Z_AXIS_TICKS_LOCATIONS__); + assert Arrays.equals(retTicksLocations, initAxes.getZAxisTicksLocations()); + } + @Test + public void testFastSetGetZAxisTicksLabels() { + controller.setProperty(axesID, __GO_Z_AXIS_TICKS_LABELS__, initAxes.getZAxisTicksLabels()); + String[] retTicksLabels = (String[]) controller.getProperty(axesID, __GO_Z_AXIS_TICKS_LABELS__); + assert Arrays.equals(retTicksLabels, initAxes.getZAxisTicksLabels()); + } + + /* Ticks property shared by the three axes */ + @Test + public void testFastSetGetAutoSubticks() { + controller.setProperty(axesID, __GO_AUTO_SUBTICKS__, initAxes.getAutoSubticks()); + Boolean retAutoSubticks = (Boolean) controller.getProperty(axesID, __GO_AUTO_SUBTICKS__); + assert retAutoSubticks.equals(initAxes.getAutoSubticks()); + } + + /* Miscellaneous Axes properties */ + @Test + public void testFastSetGetGridPosition() { + controller.setProperty(axesID, __GO_GRID_POSITION__, initAxes.getGridPosition()); + Integer retGridPos = (Integer) controller.getProperty(axesID, __GO_GRID_POSITION__); + assert retGridPos.equals(initAxes.getGridPosition()); + } + @Test + public void testFastSetGetTitle() { + controller.setProperty(axesID, __GO_TITLE__, titleID); + Integer retTitle = (Integer) controller.getProperty(axesID, __GO_TITLE__); + assert retTitle.equals(titleID); + } + @Test + public void testFastSetGetAutoClear() { + controller.setProperty(axesID, __GO_AUTO_CLEAR__, initAxes.getAutoClear()); + Boolean retAutoClear = (Boolean) controller.getProperty(axesID, __GO_AUTO_CLEAR__); + assert retAutoClear.equals(initAxes.getAutoClear()); + } + @Test + public void testFastSetGetFilled() { + controller.setProperty(axesID, __GO_FILLED__, initAxes.getFilled()); + Boolean retFilled = (Boolean) controller.getProperty(axesID, __GO_FILLED__); + assert retFilled.equals(initAxes.getFilled()); + } + @Test + public void testFastSetGetBackground() { + controller.setProperty(axesID, __GO_BACKGROUND__, initAxes.getBackground()); + Integer retBackground = (Integer) controller.getProperty(axesID, __GO_BACKGROUND__); + assert retBackground.equals(initAxes.getBackground()); + } + @Test + public void testFastSetGetMargins() { + controller.setProperty(axesID, __GO_MARGINS__, initAxes.getMargins()); + Double[] retMargins = (Double[]) controller.getProperty(axesID, __GO_MARGINS__); + assert Arrays.equals(retMargins, initAxes.getMargins()); + } + @Test + public void testFastSetGetAxesBounds() { + controller.setProperty(axesID, __GO_AXES_BOUNDS__, initAxes.getAxesBounds()); + Double[] retAxesBounds = (Double[]) controller.getProperty(axesID, __GO_AXES_BOUNDS__); + assert Arrays.equals(retAxesBounds, initAxes.getAxesBounds()); + } + + /* Camera properties */ + @Test + public void testFastSetGetView() { + controller.setProperty(axesID, __GO_VIEW__, initAxes.getView()); + Integer retView = (Integer) controller.getProperty(axesID, __GO_VIEW__); + assert retView.equals(initAxes.getView()); + } + @Test + public void testFastSetGetIsoview() { + controller.setProperty(axesID, __GO_ISOVIEW__, initAxes.getIsoview()); + Boolean retIsoview = (Boolean) controller.getProperty(axesID, __GO_ISOVIEW__); + assert retIsoview.equals(initAxes.getIsoview()); + } + @Test + public void testFastSetGetCubeScaling() { + controller.setProperty(axesID, __GO_CUBE_SCALING__, initAxes.getCubeScaling()); + Boolean retCubeScaling = (Boolean) controller.getProperty(axesID, __GO_CUBE_SCALING__); + assert retCubeScaling.equals(initAxes.getCubeScaling()); + } + @Test + public void testFastSetGetRotationAngles() { + controller.setProperty(axesID, __GO_ROTATION_ANGLES__, initAxes.getRotationAngles()); + Double[] retRotationAngles = (Double[]) controller.getProperty(axesID, __GO_ROTATION_ANGLES__); + assert (Arrays.equals(retRotationAngles, initAxes.getRotationAngles()) && retRotationAngles.length == 2); + } + + /* Box properties */ + @Test + public void testFastSetGetBoxType() { + controller.setProperty(axesID, __GO_BOX_TYPE__, initAxes.getBoxType()); + Integer retBoxType = (Integer) controller.getProperty(axesID, __GO_BOX_TYPE__); + assert retBoxType.equals(initAxes.getBoxType()); + } + @Test + public void testFastSetGetHiddenAxisColor() { + controller.setProperty(axesID, __GO_HIDDEN_AXIS_COLOR__, initAxes.getHiddenAxisColor()); + Integer retHiddenAxisColor = (Integer) controller.getProperty(axesID, __GO_HIDDEN_AXIS_COLOR__); + assert retHiddenAxisColor.equals(initAxes.getHiddenAxisColor()); + } + @Test + public void testFastSetGetTightLimits() { + controller.setProperty(axesID, __GO_TIGHT_LIMITS__, initAxes.getTightLimits()); + Boolean retTightLimits = (Boolean) controller.getProperty(axesID, __GO_TIGHT_LIMITS__); + assert retTightLimits.equals(initAxes.getTightLimits()); + } + @Test + public void testFastSetGetDataBounds() { + controller.setProperty(axesID, __GO_DATA_BOUNDS__, initAxes.getDataBounds()); + Double[] retDataBounds = (Double[]) controller.getProperty(axesID, __GO_DATA_BOUNDS__); + assert Arrays.equals(retDataBounds, initAxes.getDataBounds()); + } + @Test + public void testFastSetGetRealDataBounds() { + controller.setProperty(axesID, __GO_REAL_DATA_BOUNDS__, initAxes.getRealDataBounds()); + Double[] retRealDataBounds = (Double[]) controller.getProperty(axesID, __GO_REAL_DATA_BOUNDS__); + assert Arrays.equals(retRealDataBounds, initAxes.getRealDataBounds()); + } + @Test + public void testFastSetGetZoomEnabled() { + controller.setProperty(axesID, __GO_ZOOM_ENABLED__, initAxes.getZoomEnabled()); + Boolean retZoomEnabled = (Boolean) controller.getProperty(axesID, __GO_ZOOM_ENABLED__); + assert retZoomEnabled.equals(initAxes.getZoomEnabled()); + } + @Test + public void testFastSetGetZoomBox() { + controller.setProperty(axesID, __GO_ZOOM_BOX__, initAxes.getZoomBox()); + Double[] retZoomBox = (Double[]) controller.getProperty(axesID, __GO_ZOOM_BOX__); + assert Arrays.equals(retZoomBox, initAxes.getZoomBox()); + } + @Test + public void testFastSetGetAutoScale() { + controller.setProperty(axesID, __GO_AUTO_SCALE__, initAxes.getAutoScale()); + Boolean retAutoScale = (Boolean) controller.getProperty(axesID, __GO_AUTO_SCALE__); + assert retAutoScale.equals(initAxes.getAutoScale()); + } + @Test + public void testFastSetGetFirstPlot() { + controller.setProperty(axesID, __GO_FIRST_PLOT__, initAxes.getFirstPlot()); + Boolean retFirstPlot = (Boolean) controller.getProperty(axesID, __GO_FIRST_PLOT__); + assert retFirstPlot.equals(initAxes.getFirstPlot()); + } + + /* Default properties */ + @Test + public void testFastSetGetHiddenColor() { + controller.setProperty(axesID, __GO_HIDDEN_COLOR__, initAxes.getHiddenColor()); + Integer retHiddenColor = (Integer) controller.getProperty(axesID, __GO_HIDDEN_COLOR__); + assert retHiddenColor.equals(initAxes.getHiddenColor()); + } + @Test + public void testFastSetGetLineMode() { + controller.setProperty(axesID, __GO_LINE_MODE__, initAxes.getLineMode()); + Boolean retLineMode = (Boolean) controller.getProperty(axesID, __GO_LINE_MODE__); + assert retLineMode.equals(initAxes.getLineMode()); + } + @Test + public void testFastSetGetLineStyle() { + controller.setProperty(axesID, __GO_LINE_STYLE__, initAxes.getLineStyle()); + Integer retLineStyle = (Integer) controller.getProperty(axesID, __GO_LINE_STYLE__); + assert retLineStyle.equals(initAxes.getLineStyle()); + } + @Test + public void testFastSetGetLineThickness() { + controller.setProperty(axesID, __GO_LINE_THICKNESS__, initAxes.getLineThickness()); + Double retLineThickness = (Double) controller.getProperty(axesID, __GO_LINE_THICKNESS__); + assert retLineThickness.equals(initAxes.getLineThickness()); + } + @Test + public void testFastSetGetLineColor() { + controller.setProperty(axesID, __GO_LINE_COLOR__, initAxes.getLineColor()); + Integer retLineColor = (Integer) controller.getProperty(axesID, __GO_LINE_COLOR__); + assert retLineColor.equals(initAxes.getLineColor()); + } + @Test + public void testFastSetGetMarkMode() { + controller.setProperty(axesID, __GO_MARK_MODE__, initAxes.getMarkMode()); + Boolean retMarkMode = (Boolean) controller.getProperty(axesID, __GO_MARK_MODE__); + assert retMarkMode.equals(initAxes.getMarkMode()); + } + @Test + public void testFastSetGetMarkStyle() { + controller.setProperty(axesID, __GO_MARK_STYLE__, initAxes.getMarkStyle()); + Integer retMarkStyle = (Integer) controller.getProperty(axesID, __GO_MARK_STYLE__); + assert retMarkStyle.equals(initAxes.getMarkStyle()); + } + @Test + public void testFastSetGetMarkSize() { + controller.setProperty(axesID, __GO_MARK_SIZE__, initAxes.getMarkSize()); + Integer retMarkSize = (Integer) controller.getProperty(axesID, __GO_MARK_SIZE__); + assert retMarkSize.equals(initAxes.getMarkSize()); + } + @Test + public void testFastSetGetMarkSizeUnit() { + controller.setProperty(axesID, __GO_MARK_SIZE_UNIT__, initAxes.getMarkSizeUnit()); + Integer retMarkSizeUnit = (Integer) controller.getProperty(axesID, __GO_MARK_SIZE_UNIT__); + assert retMarkSizeUnit.equals(initAxes.getMarkSizeUnit()); + } + @Test + public void testFastSetGetMarkForeground() { + controller.setProperty(axesID, __GO_MARK_FOREGROUND__, initAxes.getMarkForeground()); + Integer retMarkForeground = (Integer) controller.getProperty(axesID, __GO_MARK_FOREGROUND__); + assert retMarkForeground.equals(initAxes.getMarkForeground()); + } + @Test + public void testFastSetGetMarkBackground() { + controller.setProperty(axesID, __GO_MARK_BACKGROUND__, initAxes.getMarkBackground()); + Integer retMarkBackground = (Integer) controller.getProperty(axesID, __GO_MARK_BACKGROUND__); + assert retMarkBackground.equals(initAxes.getMarkBackground()); + } + @Test + public void testFastSetGetClipState() { + controller.setProperty(axesID, __GO_CLIP_STATE__, initAxes.getClipState()); + Integer retClipState = (Integer) controller.getProperty(axesID, __GO_CLIP_STATE__); + assert retClipState.equals(initAxes.getClipState()); + } + @Test + public void testFastSetGetClipBox() { + controller.setProperty(axesID, __GO_CLIP_BOX__, initAxes.getClipBox()); + Double[] retClipBox = (Double[]) controller.getProperty(axesID, __GO_CLIP_BOX__); + assert Arrays.equals(retClipBox, initAxes.getClipBox()); + } + @Test + public void testFastSetGetArcDrawingMethod() { + controller.setProperty(axesID, __GO_ARC_DRAWING_METHOD__, initAxes.getArcDrawingMethod()); + Integer retArcDrawingMethod = (Integer) controller.getProperty(axesID, __GO_ARC_DRAWING_METHOD__); + assert retArcDrawingMethod.equals(initAxes.getArcDrawingMethod()); + } + + /** + * A simple utility method which compares two FormattedText ArrayLists + * @param list1 the first list + * @param list2 the second list + * @return true if the two lists are equal, else false + */ + public boolean compareFormattedTextLists(ArrayList <FormattedText> list1, ArrayList <FormattedText> list2) { + + if (list1.size() != list2.size()) { + return false; + } + + for (int i = 0; i < list1.size(); i++) { + String s1 = new String(((FormattedText) list1.get(i)).getText()); + String s2 = new String(((FormattedText) list2.get(i)).getText()); + + if (!s1.equals(s2)) { + return false; + } + + Font f1 = list1.get(i).getFont(); + Font f2 = list2.get(i).getFont(); + + if (!f1.equals(f2)) { + return false; + } + } + + return true; + } +} diff --git a/modules/graphic_objects/tests/java/org/scilab/tests/modules/graphic_objects/testGraphicObject.java b/modules/graphic_objects/tests/java/org/scilab/tests/modules/graphic_objects/testGraphicObject.java new file mode 100755 index 000000000..2c469836d --- /dev/null +++ b/modules/graphic_objects/tests/java/org/scilab/tests/modules/graphic_objects/testGraphicObject.java @@ -0,0 +1,342 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - DIGITEO - Manuel JULIACHS + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.tests.modules.graphic_objects; + +import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.*; + +import org.scilab.modules.graphic_objects.arc.Arc; +import org.scilab.modules.graphic_objects.axes.Axes; +import org.scilab.modules.graphic_objects.axis.Axis; +import org.scilab.modules.graphic_objects.compound.Compound; +import org.scilab.modules.graphic_objects.fec.Fec; +import org.scilab.modules.graphic_objects.figure.Figure; +import org.scilab.modules.graphic_objects.graphicController.GraphicController; +import org.scilab.modules.graphic_objects.graphicObject.GraphicObject; +import org.scilab.modules.graphic_objects.graphicObject.GraphicObject.Type; +import org.scilab.modules.graphic_objects.imageplot.Grayplot; +import org.scilab.modules.graphic_objects.imageplot.Matplot; +import org.scilab.modules.graphic_objects.label.Label; +import org.scilab.modules.graphic_objects.legend.Legend; +import org.scilab.modules.graphic_objects.polyline.Polyline; +import org.scilab.modules.graphic_objects.rectangle.Rectangle; +import org.scilab.modules.graphic_objects.surface.Fac3d; +import org.scilab.modules.graphic_objects.surface.Plot3d; +import org.scilab.modules.graphic_objects.textObject.Text; +import org.scilab.modules.graphic_objects.vectfield.Champ; +import org.scilab.modules.graphic_objects.vectfield.Segs; +import org.junit.*; + + +/** + * GraphicObject test class + * @author Manuel JULIACHS + */ +public class testGraphicObject { + + public static final int NONEXISTING_PROP = Integer.MAX_VALUE; + + @Test + public void simpleTest() throws NullPointerException { + GraphicController controller = GraphicController.getController(); + + Integer axesID = controller.askObject(Type.AXES); + GraphicObject axes = (GraphicObject) controller.getObjectFromId(axesID); + + assert(axes != null); + + Integer arcID = controller.askObject(Type.ARC); + GraphicObject arc = (GraphicObject) controller.getObjectFromId(arcID); + + assert(arc != null); + + Integer axesIDret = axes.getIdentifier(); + Integer arcIDret = arc.getIdentifier(); + + assert axesID.equals(axesIDret); + assert arcID.equals(arcIDret); + + Boolean arcVisible = new Boolean(true); + + controller.setProperty(arcID, __GO_VISIBLE__, arcVisible); + Boolean arcVisibleRet = (Boolean) controller.getProperty(arcID, __GO_VISIBLE__); + + assert (arcVisibleRet != null); + + assert arcVisible.equals(arcVisibleRet); + + Object nonExistingProp = (Object) controller.getProperty(arcID, NONEXISTING_PROP); + + assert nonExistingProp == null; + + controller.setProperty(arcID, __GO_PARENT__, axes.getIdentifier()); + + Integer arcParentId = (Integer) controller.getProperty(arcID, __GO_PARENT__); + GraphicObject arcParent = (GraphicObject) controller.getObjectFromId(arcParentId); + + assert(arcParent != null); + + assert arcParent.equals(axes); + + } + + @Test + public void arcCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_ARC__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Arc); + } + + @Test + public void arcCloneTest() { + GraphicController controller = GraphicController.getController(); + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_ARC__)); + Integer cloneId = null; + cloneId = controller.cloneObject(objectId); + + assert(cloneId != null); + Object graphicObject = controller.getObjectFromId(cloneId); + assert(graphicObject != null); + assert(graphicObject instanceof Arc); + } + + @Test + public void axesCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_AXES__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Axes); + } + + @Test + public void axesCloneTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_AXES__)); + Integer cloneId = null; + cloneId = controller.cloneObject(objectId); + + assert(cloneId != null); + Object graphicObject = controller.getObjectFromId(cloneId); + assert(graphicObject != null); + assert(graphicObject instanceof Axes); + } + + @Test + public void axisCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_AXIS__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Axis); + } + + @Test + public void champCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_CHAMP__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Champ); + } + + @Test + public void compoundCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_COMPOUND__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Compound); + } + + @Test + public void fac3dCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_FAC3D__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Fac3d); + } + + @Test + public void fecCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_FEC__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Fec); + } + + @Test + public void figureCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_FIGURE__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Figure); + } + + @Test + public void grayplotCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_GRAYPLOT__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Grayplot); + } + + @Test + public void labelCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_LABEL__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Label); + } + + @Test + public void legendCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_LEGEND__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Legend); + } + + @Test + public void matplotCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_MATPLOT__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Matplot); + } + + @Test + public void plot3dCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_PLOT3D__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Plot3d); + } + + @Test + public void polylineCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_POLYLINE__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Polyline); + } + + @Test + public void retangleCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_RECTANGLE__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Rectangle); + } + + @Test + public void segsCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_SEGS__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Segs); + } + + @Test + public void textCreationTest() { + GraphicController controller = GraphicController.getController(); + + Integer objectId = null; + objectId = controller.askObject(GraphicObject.getTypeFromName(__GO_TEXT__)); + assert(objectId != null); + + Object graphicObject = controller.getObjectFromId(objectId); + assert(graphicObject != null); + assert(graphicObject instanceof Text); + } + +} diff --git a/modules/graphic_objects/tests/nonreg_tests/bug_11472.dia.ref b/modules/graphic_objects/tests/nonreg_tests/bug_11472.dia.ref new file mode 100755 index 000000000..466af1b13 --- /dev/null +++ b/modules/graphic_objects/tests/nonreg_tests/bug_11472.dia.ref @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- TEST WITH GRAPHIC --> +// <-- Non-regression test for bug 11472 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=11472 +// +// <-- Short Description --> +// sdf() changes figures menubar +S = get(0); +S.ShowHiddenHandles = "on"; +f = gcf(); +Nbrchild = length(f.children); +close(f); +sdf(); +f = gcf(); +assert_checkequal(length(f.children), Nbrchild); +close(f); diff --git a/modules/graphic_objects/tests/nonreg_tests/bug_11472.tst b/modules/graphic_objects/tests/nonreg_tests/bug_11472.tst new file mode 100755 index 000000000..d33377d16 --- /dev/null +++ b/modules/graphic_objects/tests/nonreg_tests/bug_11472.tst @@ -0,0 +1,28 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- TEST WITH GRAPHIC --> + +// <-- Non-regression test for bug 11472 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=11472 +// +// <-- Short Description --> +// sdf() changes figures menubar + +S = get(0); +S.ShowHiddenHandles = "on"; + +f = gcf(); +Nbrchild = length(f.children); +close(f); + +sdf(); +f = gcf(); +assert_checkequal(length(f.children), Nbrchild); +close(f); diff --git a/modules/graphic_objects/tests/nonreg_tests/bug_12234.dia.ref b/modules/graphic_objects/tests/nonreg_tests/bug_12234.dia.ref new file mode 100755 index 000000000..253563228 --- /dev/null +++ b/modules/graphic_objects/tests/nonreg_tests/bug_12234.dia.ref @@ -0,0 +1,17 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- TEST WITH GRAPHIC --> +// <-- Non-regression test for bug 12234 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/12234 +// +// <-- Short Description --> +// Crash with invalid property +refMsg = msprintf(_("''%s'' property does not exist for this handle.\n"), "data"); +e=gce(); +assert_checkerror("set(e, ''interp_color_vector'', 1:4)", refMsg); diff --git a/modules/graphic_objects/tests/nonreg_tests/bug_12234.tst b/modules/graphic_objects/tests/nonreg_tests/bug_12234.tst new file mode 100755 index 000000000..9fbc361b7 --- /dev/null +++ b/modules/graphic_objects/tests/nonreg_tests/bug_12234.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- TEST WITH GRAPHIC --> + +// <-- Non-regression test for bug 12234 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/12234 +// +// <-- Short Description --> +// Crash with invalid property + +refMsg = msprintf(_("''%s'' property does not exist for this handle.\n"), "data"); +e=gce(); +assert_checkerror("set(e, ''interp_color_vector'', 1:4)", refMsg); diff --git a/modules/graphic_objects/tests/nonreg_tests/bug_13510.dia.ref b/modules/graphic_objects/tests/nonreg_tests/bug_13510.dia.ref new file mode 100755 index 000000000..e4288fed4 --- /dev/null +++ b/modules/graphic_objects/tests/nonreg_tests/bug_13510.dia.ref @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- TEST WITH GRAPHIC --> +// <-- Non-regression test for bug 13510 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13510 +// +// <-- Short Description --> +// Datatip callback cleared 'd' +clear("pl", "ax", "h", "s", "d", "d1"); +s = poly(0,"s"); +h = syslin("c", 1 / (s + 1)); +nyquist(h); +d = 123; +ax = gca(); +pl = ax.children(1).children(2); +d1 = datatipCreate(pl, 200); +assert_checkequal(d, 123); diff --git a/modules/graphic_objects/tests/nonreg_tests/bug_13510.tst b/modules/graphic_objects/tests/nonreg_tests/bug_13510.tst new file mode 100755 index 000000000..9da575f6a --- /dev/null +++ b/modules/graphic_objects/tests/nonreg_tests/bug_13510.tst @@ -0,0 +1,28 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- TEST WITH GRAPHIC --> + +// <-- Non-regression test for bug 13510 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13510 +// +// <-- Short Description --> +// Datatip callback cleared 'd' + +clear("pl", "ax", "h", "s", "d", "d1"); +s = poly(0,"s"); +h = syslin("c", 1 / (s + 1)); +nyquist(h); + +d = 123; +ax = gca(); +pl = ax.children(1).children(2); +d1 = datatipCreate(pl, 200); + +assert_checkequal(d, 123);
\ No newline at end of file diff --git a/modules/graphic_objects/tests/nonreg_tests/bug_13725.tst b/modules/graphic_objects/tests/nonreg_tests/bug_13725.tst new file mode 100755 index 000000000..f1e64f0df --- /dev/null +++ b/modules/graphic_objects/tests/nonreg_tests/bug_13725.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2015 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- TEST WITH GRAPHIC --> +// +// // <-- INTERACTIVE TEST --> +// <-- Non-regression test for bug 13725 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13725 +// +// <-- Short Description --> +// Polyline is not correctly filled with big values + +y = [0, -4, 2, -3, -1, -1, 7, 0] +x = [0, 1, 3, 6, 16, 7, 3, 0] +scf(); +xfpoly(x*1e18, y, 3) + +// check that the polyline is correctly filled diff --git a/modules/graphic_objects/tests/unit_tests/delete.dia.ref b/modules/graphic_objects/tests/unit_tests/delete.dia.ref new file mode 100755 index 000000000..cd1037386 --- /dev/null +++ b/modules/graphic_objects/tests/unit_tests/delete.dia.ref @@ -0,0 +1,10 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +scf(); +scf(); +delete(gcf()); +plot2d(1:10); diff --git a/modules/graphic_objects/tests/unit_tests/delete.tst b/modules/graphic_objects/tests/unit_tests/delete.tst new file mode 100755 index 000000000..288be8bbe --- /dev/null +++ b/modules/graphic_objects/tests/unit_tests/delete.tst @@ -0,0 +1,11 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Antoine ELIAS +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +scf(); +scf(); +delete(gcf()); +plot2d(1:10);
\ No newline at end of file diff --git a/modules/graphic_objects/tests/unit_tests/hiddenhandles.dia.ref b/modules/graphic_objects/tests/unit_tests/hiddenhandles.dia.ref new file mode 100755 index 000000000..6b55cc35d --- /dev/null +++ b/modules/graphic_objects/tests/unit_tests/hiddenhandles.dia.ref @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Vincent COUVERT +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Simple test hidden handles using the MVC implementation --> +c = get(0); // Get console handle +assert_checkequal(c.type, "Console"); +assert_checkequal(c.showhiddenhandles, "off"); // Hidden handles are not shown by default +// Create a figure with two menus (one with hidden handle) +f = gcf(); +notHiddenMenu = uimenu("Parent", f, "Label", "Not hidden", "Handle_Visible", "on"); +hiddenMenu = uimenu("Parent", f, "Label", "Hidden", "Handle_Visible", "off"); +// Check the figure has two children (axes + menu) +assert_checkequal(size(f.children), [2 1]); +assert_checkequal(f.children(1).label, "Not hidden"); +// Now we show hidden handles +c.showhiddenhandles = "on"; +assert_checkequal(c.showhiddenhandles, "on"); +// Check the figure has seven children (axes + menu + menu + 4 default menus) +assert_checkequal(size(f.children), [7 1]); +assert_checkequal(f.children(1).label, "Hidden"); +assert_checkequal(f.children(2).label, "Not hidden"); diff --git a/modules/graphic_objects/tests/unit_tests/hiddenhandles.tst b/modules/graphic_objects/tests/unit_tests/hiddenhandles.tst new file mode 100755 index 000000000..4b8a30e51 --- /dev/null +++ b/modules/graphic_objects/tests/unit_tests/hiddenhandles.tst @@ -0,0 +1,30 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - DIGITEO - Vincent COUVERT +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Simple test hidden handles using the MVC implementation --> + +c = get(0); // Get console handle +assert_checkequal(c.type, "Console"); +assert_checkequal(c.showhiddenhandles, "off"); // Hidden handles are not shown by default + +// Create a figure with two menus (one with hidden handle) +f = gcf(); +notHiddenMenu = uimenu("Parent", f, "Label", "Not hidden", "Handle_Visible", "on"); +hiddenMenu = uimenu("Parent", f, "Label", "Hidden", "Handle_Visible", "off"); + +// Check the figure has two children (axes + menu) +assert_checkequal(size(f.children), [2 1]); +assert_checkequal(f.children(1).label, "Not hidden"); + +// Now we show hidden handles +c.showhiddenhandles = "on"; +assert_checkequal(c.showhiddenhandles, "on"); + +// Check the figure has seven children (axes + menu + menu + 4 default menus) +assert_checkequal(size(f.children), [7 1]); +assert_checkequal(f.children(1).label, "Hidden"); +assert_checkequal(f.children(2).label, "Not hidden"); diff --git a/modules/graphic_objects/tests/unit_tests/path.dia.ref b/modules/graphic_objects/tests/unit_tests/path.dia.ref new file mode 100755 index 000000000..631ba181d --- /dev/null +++ b/modules/graphic_objects/tests/unit_tests/path.dia.ref @@ -0,0 +1,59 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Bruno JOFRET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +f = figure("tag", "mainFigure", "visible", "off"); + f1 = uicontrol(f, "style", "frame", "tag", "f1"); + f11 = uicontrol(f1, "style", "frame", "tag", "f11"); + f12 = uicontrol(f1, "style", "frame", "tag", "f12"); + f13 = uicontrol(f1, "style", "frame", "tag", "f13"); + f14 = uicontrol(f1, "style", "frame", "tag", "leaf"); + f141 = uicontrol(f14, "style", "frame", "tag", "leaf1"); + f142 = uicontrol(f14, "style", "frame", "tag", "leaf2"); + f143 = uicontrol(f14, "style", "frame", "tag", "f143"); + f2 = uicontrol(f, "style", "frame", "tag", "f2"); + f21 = uicontrol(f2, "style", "frame", "tag", "f21"); + f22 = uicontrol(f2, "style", "frame", "tag", "f22"); + f23 = uicontrol(f2, "style", "frame", "tag", "f23"); + f24 = uicontrol(f2, "style", "frame", "tag", "leaf"); + f241 = uicontrol(f24, "style", "frame", "tag", "leaf1"); + f242 = uicontrol(f24, "style", "frame", "tag", "leaf2"); + f243 = uicontrol(f24, "style", "frame", "tag", "f243"); +res = get("mainFigure"); +assert_checkequal(f.UID, res.UID); +res = get("mainFigure/f1"); +assert_checkequal(f1.UID, res.UID); +res = get("mainFigure/f2"); +assert_checkequal(f2.UID, res.UID); +res = get("mainFigure/f1/f12"); +assert_checkequal(f12.UID, res.UID); +res = get("mainFigure/f2/f22"); +assert_checkequal(f22.UID, res.UID); +res = get("f1"); +assert_checkequal(f1.UID, res.UID); +res = get("f13"); +assert_checkequal(f13.UID, res.UID); +res = get("f5"); +assert_checkequal([], res); +res = get("*/f2"); +assert_checkequal(f2.UID, res.UID); +res = get("*/*/leaf"); +assert_checktrue(or(res.UID == [f14.UID, f24.UID])); +res = get("*/leaf"); +assert_checktrue(or(res.UID == [f14.UID, f24.UID])); +res = get("*/*/toto"); +assert_checkequal([], res); +res = get("*/toto"); +assert_checkequal([], res); +res = get("mainFigure/*/f23"); +assert_checkequal(f23.UID, res.UID); +res = get("mainFigure/*/toto"); +assert_checkequal([], res); +res = get("mainFigure/*/leaf/f143"); +assert_checkequal(f143.UID, res.UID); +res = get("mainFigure/*/leaf/leaf1"); +assert_checktrue(or(res.UID == [f141.UID, f241.UID])); +res = get("mainFigure/*/leaf/leaf2"); +assert_checktrue(or(res.UID == [f142.UID, f242.UID])); diff --git a/modules/graphic_objects/tests/unit_tests/path.tst b/modules/graphic_objects/tests/unit_tests/path.tst new file mode 100755 index 000000000..e46f09b20 --- /dev/null +++ b/modules/graphic_objects/tests/unit_tests/path.tst @@ -0,0 +1,77 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Bruno JOFRET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +f = figure("tag", "mainFigure", "visible", "off"); + f1 = uicontrol(f, "style", "frame", "tag", "f1"); + f11 = uicontrol(f1, "style", "frame", "tag", "f11"); + f12 = uicontrol(f1, "style", "frame", "tag", "f12"); + f13 = uicontrol(f1, "style", "frame", "tag", "f13"); + f14 = uicontrol(f1, "style", "frame", "tag", "leaf"); + f141 = uicontrol(f14, "style", "frame", "tag", "leaf1"); + f142 = uicontrol(f14, "style", "frame", "tag", "leaf2"); + f143 = uicontrol(f14, "style", "frame", "tag", "f143"); + f2 = uicontrol(f, "style", "frame", "tag", "f2"); + f21 = uicontrol(f2, "style", "frame", "tag", "f21"); + f22 = uicontrol(f2, "style", "frame", "tag", "f22"); + f23 = uicontrol(f2, "style", "frame", "tag", "f23"); + f24 = uicontrol(f2, "style", "frame", "tag", "leaf"); + f241 = uicontrol(f24, "style", "frame", "tag", "leaf1"); + f242 = uicontrol(f24, "style", "frame", "tag", "leaf2"); + f243 = uicontrol(f24, "style", "frame", "tag", "f243"); + +res = get("mainFigure"); +assert_checkequal(f.UID, res.UID); + +res = get("mainFigure/f1"); +assert_checkequal(f1.UID, res.UID); + +res = get("mainFigure/f2"); +assert_checkequal(f2.UID, res.UID); + +res = get("mainFigure/f1/f12"); +assert_checkequal(f12.UID, res.UID); + +res = get("mainFigure/f2/f22"); +assert_checkequal(f22.UID, res.UID); + +res = get("f1"); +assert_checkequal(f1.UID, res.UID); +res = get("f13"); +assert_checkequal(f13.UID, res.UID); + +res = get("f5"); +assert_checkequal([], res); + +res = get("*/f2"); +assert_checkequal(f2.UID, res.UID); + +res = get("*/*/leaf"); +assert_checktrue(or(res.UID == [f14.UID, f24.UID])); + +res = get("*/leaf"); +assert_checktrue(or(res.UID == [f14.UID, f24.UID])); + +res = get("*/*/toto"); +assert_checkequal([], res); + +res = get("*/toto"); +assert_checkequal([], res); + +res = get("mainFigure/*/f23"); +assert_checkequal(f23.UID, res.UID); + +res = get("mainFigure/*/toto"); +assert_checkequal([], res); + +res = get("mainFigure/*/leaf/f143"); +assert_checkequal(f143.UID, res.UID); + +res = get("mainFigure/*/leaf/leaf1"); +assert_checktrue(or(res.UID == [f141.UID, f241.UID])); + +res = get("mainFigure/*/leaf/leaf2"); +assert_checktrue(or(res.UID == [f142.UID, f242.UID])); diff --git a/modules/graphic_objects/tests/unit_tests/sdf.dia.ref b/modules/graphic_objects/tests/unit_tests/sdf.dia.ref new file mode 100755 index 000000000..ee6fc10b0 --- /dev/null +++ b/modules/graphic_objects/tests/unit_tests/sdf.dia.ref @@ -0,0 +1,9 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Sylvestre Ledru +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- TEST WITH GRAPHIC --> +aze=sdf(); +assert_checkequal(typeof(aze),"handle"); diff --git a/modules/graphic_objects/tests/unit_tests/sdf.tst b/modules/graphic_objects/tests/unit_tests/sdf.tst new file mode 100755 index 000000000..419a93f22 --- /dev/null +++ b/modules/graphic_objects/tests/unit_tests/sdf.tst @@ -0,0 +1,11 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Sylvestre Ledru +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- TEST WITH GRAPHIC --> + +aze=sdf(); +assert_checkequal(typeof(aze),"handle"); diff --git a/modules/graphic_objects/tests/unit_tests/xpoly.dia.ref b/modules/graphic_objects/tests/unit_tests/xpoly.dia.ref new file mode 100755 index 000000000..f0231de58 --- /dev/null +++ b/modules/graphic_objects/tests/unit_tests/xpoly.dia.ref @@ -0,0 +1,44 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Manuel Juliachs +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Simple test for xpoly using the MVC implementation --> +// +// <-- Short Description --> +// Tests the Polyline MVC object via the xpoly function: +// -whether properties corresponding to the function parameters are correctly initialized +// -whether the coordinates array is correctly initialized and can be resized +// +x = sin(2*%pi*(0:4)/5); +y = cos(2*%pi*(0:4)/5); +xpoly(x,y,"lines",1); +e = gce(); +if (e.line_mode <> "on") then bugmes();quit;end; +if (e.closed <> "on") then bugmes();quit;end; +if (e.mark_mode <> "off") then bugmes();quit;end; +s = size(e.data); +if (s(1) <> size(x, '*')) then bugmes();quit;end; +if (s(1) <> size(y, '*')) then bugmes();quit;end; +// 2 columns expected [x, y] +if (s(2) <> 2) then bugmes();quit;end; +// Coordinates array resized +x = sin(2*%pi*(0:1999)/2000); +y = sin(2*%pi*(0:1999)/2000); +e.data = [x', y']; +s = size(e.data); +if (s(1) <> size(x, '*')) then bugmes();quit;end; +if (s(1) <> size(y, '*')) then bugmes();quit;end; +// Z coordinates added +z = linspace(0, 1, 2000); +e.data = [x', y', z']; +s = size(e.data); +// 3 columns expected [x, y, z] +if (s(2) <> 3) then bugmes();quit;end; +if (s(1) <> size(x, '*')) then bugmes();quit;end; +if (s(1) <> size(y, '*')) then bugmes();quit;end; +if (s(1) <> size(z, '*')) then bugmes();quit;end; +// Deletes the data +e.data = []; +if (e.data <> []) then bugmes();quit;end; diff --git a/modules/graphic_objects/tests/unit_tests/xpoly.tst b/modules/graphic_objects/tests/unit_tests/xpoly.tst new file mode 100755 index 000000000..9270b08a2 --- /dev/null +++ b/modules/graphic_objects/tests/unit_tests/xpoly.tst @@ -0,0 +1,66 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Manuel Juliachs +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Simple test for xpoly using the MVC implementation --> +// +// <-- Short Description --> +// Tests the Polyline MVC object via the xpoly function: +// -whether properties corresponding to the function parameters are correctly initialized +// -whether the coordinates array is correctly initialized and can be resized +// + +x = sin(2*%pi*(0:4)/5); +y = cos(2*%pi*(0:4)/5); + +xpoly(x,y,"lines",1); + +e = gce(); + +if (e.line_mode <> "on") then pause, end; +if (e.closed <> "on") then pause, end; +if (e.mark_mode <> "off") then pause, end; + +s = size(e.data); + +if (s(1) <> size(x, '*')) then pause, end; +if (s(1) <> size(y, '*')) then pause, end; + +// 2 columns expected [x, y] +if (s(2) <> 2) then pause, end; + + +// Coordinates array resized + +x = sin(2*%pi*(0:1999)/2000); +y = sin(2*%pi*(0:1999)/2000); + +e.data = [x', y']; + +s = size(e.data); + +if (s(1) <> size(x, '*')) then pause, end; +if (s(1) <> size(y, '*')) then pause, end; + +// Z coordinates added +z = linspace(0, 1, 2000); + +e.data = [x', y', z']; + +s = size(e.data); + +// 3 columns expected [x, y, z] +if (s(2) <> 3) then pause, end; + +if (s(1) <> size(x, '*')) then pause, end; +if (s(1) <> size(y, '*')) then pause, end; +if (s(1) <> size(z, '*')) then pause, end; + +// Deletes the data +e.data = []; + +if (e.data <> []) then pause, end; + |