コード例 #1
0
ファイル: ColorSensorTest.java プロジェクト: dlech/robertalab
  @Test
  public void getPort() throws Exception {
    Jaxb2BlocklyProgramTransformer<Void> transformer =
        Helper.generateTransformer("/ast/sensors/sensor_setColor.xml");

    ColorSensor<Void> cs = (ColorSensor<Void>) transformer.getTree().get(0).get(1);
    ColorSensor<Void> cs1 = (ColorSensor<Void>) transformer.getTree().get(1).get(1);
    ColorSensor<Void> cs2 = (ColorSensor<Void>) transformer.getTree().get(2).get(1);
    ColorSensor<Void> cs3 = (ColorSensor<Void>) transformer.getTree().get(3).get(1);

    Assert.assertEquals(SensorPort.S3, cs.getPort());
    Assert.assertEquals(SensorPort.S1, cs1.getPort());
    Assert.assertEquals(SensorPort.S2, cs2.getPort());
    Assert.assertEquals(SensorPort.S4, cs3.getPort());
  }
コード例 #2
0
ファイル: ColorSensorTest.java プロジェクト: dlech/robertalab
  @Test
  public void getMode() throws Exception {
    Jaxb2BlocklyProgramTransformer<Void> transformer =
        Helper.generateTransformer("/ast/sensors/sensor_setColor.xml");

    ColorSensor<Void> cs = (ColorSensor<Void>) transformer.getTree().get(0).get(1);
    ColorSensor<Void> cs1 = (ColorSensor<Void>) transformer.getTree().get(1).get(1);
    ColorSensor<Void> cs2 = (ColorSensor<Void>) transformer.getTree().get(2).get(1);
    ColorSensor<Void> cs3 = (ColorSensor<Void>) transformer.getTree().get(3).get(1);

    Assert.assertEquals(ColorSensorMode.COLOUR, cs.getMode());
    Assert.assertEquals(ColorSensorMode.RED, cs1.getMode());
    Assert.assertEquals(ColorSensorMode.RGB, cs2.getMode());
    Assert.assertEquals(ColorSensorMode.AMBIENTLIGHT, cs3.getMode());
  }