Search in sources :

Example 81 with PluginParameter

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameter in project constellation by constellation-app.

the class StringParameterTypeNGTest method testIsLabel.

/**
 * Test of isLabel method, of class StringParameterType.
 */
@Test
public void testIsLabel() {
    System.out.println("isLabel");
    PluginParameter instance = StringParameterType.build("stringParameter");
    // check if when set to true it reamains true
    boolean expResult = true;
    instance.setProperty(StringParameterType.IS_LABEL, expResult);
    boolean result = StringParameterType.isLabel(instance);
    assertEquals(result, expResult);
    // check if when set to false it reamains false
    expResult = false;
    instance.setProperty(StringParameterType.IS_LABEL, expResult);
    result = StringParameterType.isLabel(instance);
    assertEquals(result, expResult);
    // check if when set to false it doesn't think its true
    expResult = true;
    instance.setProperty(StringParameterType.IS_LABEL, false);
    result = StringParameterType.isLabel(instance);
    assertFalse(result);
    assertNotEquals(result, expResult);
    // check if when set to true it doesn't think its false
    expResult = false;
    instance.setProperty(StringParameterType.IS_LABEL, true);
    result = StringParameterType.isLabel(instance);
    assertTrue(result);
    assertNotEquals(result, expResult);
}
Also used : PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) Test(org.testng.annotations.Test)

Example 82 with PluginParameter

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameter in project constellation by constellation-app.

the class FloatParameterTypeNGTest method testBuild_String.

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

Example 83 with PluginParameter

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameter in project constellation by constellation-app.

the class IntegerParameterTypeNGTest method testSetStep.

/**
 * Test of setStep method, of class IntegerParameterType.
 */
@Test
public void testSetStep() {
    System.out.println("setStep");
    // Step shouldnt be allowed to be 0
    // unsure if it could be negative and go backwards?
    // step shouldn't be able to be greater than maximum value
    String id = "Step";
    PluginParameter<IntegerParameterType.IntegerParameterValue> parameter = new PluginParameter<>(new IntegerParameterValue(), INSTANCE, id);
    // step shouldn't be allowed to be 0
    int step = 0;
    IntegerParameterType.setStep(parameter, step);
    assertEquals(parameter.getParameterValue().getStepValue(), step);
    // step should be allowed to be positive
    step = 6;
    IntegerParameterType.setStep(parameter, step);
    assertEquals(parameter.getParameterValue().getStepValue(), step);
    // step shouldn't be allowed to be negative
    step = -4;
    IntegerParameterType.setStep(parameter, step);
    assertEquals(parameter.getParameterValue().getStepValue(), step);
}
Also used : IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) Test(org.testng.annotations.Test)

Example 84 with PluginParameter

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameter in project constellation by constellation-app.

the class IntegerParameterTypeNGTest method testSetMinimum.

/**
 * Test of setMinimum method, of class IntegerParameterType.
 */
@Test
public void testSetMinimum() {
    System.out.println("setMinimum");
    String id = "Minimum";
    PluginParameter<IntegerParameterType.IntegerParameterValue> parameter = new PluginParameter<>(new IntegerParameterValue(), INSTANCE, id);
    int min = 0;
    IntegerParameterType.setMinimum(parameter, min);
    assertEquals(parameter.getParameterValue().getMinimumValue(), min);
    min = -5;
    IntegerParameterType.setMinimum(parameter, min);
    assertEquals(parameter.getParameterValue().getMinimumValue(), min);
    min = 64;
    IntegerParameterType.setMinimum(parameter, min);
    assertEquals(parameter.getParameterValue().getMinimumValue(), min);
}
Also used : IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) Test(org.testng.annotations.Test)

Example 85 with PluginParameter

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameter in project constellation by constellation-app.

the class IntegerParameterTypeNGTest method testBuild_String.

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

Aggregations

PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)93 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)53 Test (org.testng.annotations.Test)52 ArrayList (java.util.ArrayList)36 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)25 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)21 Map (java.util.Map)16 PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)15 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)13 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)12 SchemaTransactionType (au.gov.asd.tac.constellation.graph.schema.type.SchemaTransactionType)11 ParameterChange (au.gov.asd.tac.constellation.plugins.parameters.ParameterChange)11 Graph (au.gov.asd.tac.constellation.graph.Graph)10 Plugin (au.gov.asd.tac.constellation.plugins.Plugin)10 BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)10 HashMap (java.util.HashMap)10 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)9 List (java.util.List)9 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)8 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)8