Search in sources :

Example 21 with BooleanParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue in project constellation by constellation-app.

the class RotateCameraPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<FloatParameterValue> xaxisParam = FloatParameterType.build(X_PARAMETER_ID);
    xaxisParam.setName("xAxis");
    xaxisParam.setDescription("Rotation in degrees around the x axis");
    xaxisParam.setFloatValue(0F);
    parameters.addParameter(xaxisParam);
    final PluginParameter<FloatParameterValue> yaxisParam = FloatParameterType.build(Y_PARAMETER_ID);
    yaxisParam.setName("yAxis");
    yaxisParam.setDescription("Rotation in degrees around the y axis");
    yaxisParam.setFloatValue(0F);
    parameters.addParameter(yaxisParam);
    final PluginParameter<FloatParameterValue> zaxisParam = FloatParameterType.build(Z_PARAMETER_ID);
    zaxisParam.setName("zAxis");
    zaxisParam.setDescription("Rotation in degrees around the z axis");
    zaxisParam.setFloatValue(0F);
    parameters.addParameter(zaxisParam);
    final PluginParameter<BooleanParameterValue> animateParam = BooleanParameterType.build(ANIMATE_PARAMETER_ID);
    animateParam.setName("animate");
    animateParam.setDescription("Animate the rotation asynchronously");
    animateParam.setBooleanValue(false);
    parameters.addParameter(animateParam);
    return parameters;
}
Also used : FloatParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue) BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 22 with BooleanParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue in project constellation by constellation-app.

the class BooleanParameterTypeNGTest method testConstruction.

// Start of testing BooleanParameterValue
@Test
public void testConstruction() {
    BooleanParameterValue result = new BooleanParameterValue();
    assertNotNull(result);
    assertFalse(result.get());
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) Test(org.testng.annotations.Test)

Example 23 with BooleanParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue in project constellation by constellation-app.

the class BooleanParameterTypeNGTest method testGetSetObjectValue.

@Test
public void testGetSetObjectValue() {
    BooleanParameterValue instance = new BooleanParameterValue();
    // get current value as object and verify that it is correct.
    Object expected = instance.getObjectValue();
    assertEquals(instance.getObjectValue(), expected);
    // change object value
    expected = Boolean.TRUE;
    instance.setObjectValue(expected);
    assertEquals(instance.getObjectValue(), expected);
    // Return true when value is different
    expected = Boolean.FALSE;
    assertTrue(instance.setObjectValue(expected));
    assertEquals(instance.getObjectValue(), expected);
    // Return false when value is set the same
    expected = Boolean.FALSE;
    assertFalse(instance.setObjectValue(expected));
    assertEquals(instance.getObjectValue(), expected);
    // Return false when value is set the same
    expected = false;
    assertFalse(instance.setObjectValue(null));
    assertEquals(instance.getObjectValue(), expected);
    // Return false when value is set the same
    expected = Boolean.FALSE;
    assertFalse(instance.setObjectValue(expected));
    assertEquals(instance.getObjectValue(), expected);
    // Return true when value is set from a boolean primitive correctly
    expected = true;
    assertTrue(instance.setObjectValue(expected));
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) Test(org.testng.annotations.Test)

Example 24 with BooleanParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue in project constellation by constellation-app.

the class BooleanParameterTypeNGTest method testCreateCopy.

@Test
public void testCreateCopy() {
    // Ensure initial setup is correct
    BooleanParameterValue instance = new BooleanParameterValue();
    instance.set(true);
    assertTrue(instance.get());
    // Copy and verify correct value in copy
    BooleanParameterValue instanceCopy = instance.createCopy();
    assertTrue(instanceCopy.get());
    // Ensure deep copy and not shallow
    assertTrue(instance.set(false));
    assertTrue(instanceCopy.get());
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) Test(org.testng.annotations.Test)

Example 25 with BooleanParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue in project constellation by constellation-app.

the class BooleanParameterTypeNGTest method testBuild_String.

/**
 * Test of build method, of class BooleanParameterType.
 */
@Test
public void testBuild_String() {
    System.out.println("build_string");
    String id = "booleanParameter";
    PluginParameter result = BooleanParameterType.build(id);
    BooleanParameterValue expectedValue = new BooleanParameterValue();
    assertEquals(result.getId(), id);
    assertTrue(result.getType() instanceof BooleanParameterType);
    assertEquals(result.getParameterValue(), expectedValue);
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) Test(org.testng.annotations.Test)

Aggregations

BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)65 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)56 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)27 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)14 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)13 Test (org.testng.annotations.Test)11 FloatParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue)9 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)7 ArrayList (java.util.ArrayList)7 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)5 ObjectParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)5 ParameterChange (au.gov.asd.tac.constellation.plugins.parameters.ParameterChange)4 Map (java.util.Map)4 ColorParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue)3 FileParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.FileParameterType.FileParameterValue)3 Graph (au.gov.asd.tac.constellation.graph.Graph)2 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)2 ParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ParameterValue)2 ConstellationColor (au.gov.asd.tac.constellation.utilities.color.ConstellationColor)2 GraphAttribute (au.gov.asd.tac.constellation.graph.GraphAttribute)1