Package classes

Examples of classes.Gesture


import classes.PointR;

public class GestureTest {
  @Test
  public void testRawPoints() {
    Gesture g = new Gesture();
    ArrayList<PointR> a = new ArrayList<PointR>();
    a.add(new PointR(1, 1, 0));

    g.setRawPoints(a);

    assertEquals(a, g.getRawPoints());

  }
View Full Code Here


  }

  @Test
  public void testCtorForNameMemberInit() {
    Gesture g = new Gesture();
    if (g.getName() != "") {
      fail("Gesture not initialized properly");
    }
  }
View Full Code Here

    }
  }

  @Test
  public void testCtorForNameAndRawPointsInit() {
    Gesture g = new Gesture("new_gesture", new ArrayList<PointR>());
    if (!g.getName().equals("new_gesture") || g.getRawPoints() == null) {
      fail("Gesture not initialized properly");
    }
    // to be further implemented once GeometricRecognizer is implemented
  }
View Full Code Here

    // to be implemented once GeometricRecognizer is implemented
  }

  @Test
  public void testCompareTo() {
    Gesture g1 = new Gesture("gest1", new ArrayList<PointR>());
    Gesture g2 = new Gesture("gest2", new ArrayList<PointR>());
    try {
      if (g1.compareTo(g2) == 0)
        fail("Gesture compareTo not working properly");
    }
    catch (Exception e) {
View Full Code Here

    PointR p2 = new PointR(354, 236, 329062);
    PointR p3 = new PointR(353, 236, 329062);
    points.add(p1);
    points.add(p2);
    points.add(p3);
    Gesture p = new Gesture("xmltest", points);
    if (geo.loadGesture(filename)) {
      assertTrue(p.getPoints().get(0)
          .equals(geo.getGestures().get(0).getPoints().get(0)));
      assertTrue(p.getPoints().get(1)
          .equals(geo.getGestures().get(0).getPoints().get(1)));
      assertTrue(p.getPoints().get(2)
          .equals(geo.getGestures().get(0).getPoints().get(2)));
    } else {
      fail("Error in loadGesture");
    }
  }
View Full Code Here

 
  @Test
  public void testCtorForNameGestureMember() {
    Category c = null;
    try {
      c = new Category("circle", new Gesture("circle1",
          new ArrayList<PointR>()));
    }
    catch (Exception e) {
      fail("Category constructor Name value incorrect, Exception Details: "
          + e.getMessage());
View Full Code Here

 
  @Test
  public void getGestureWithPrototypes() {
    ArrayList<Gesture> prototypes = new ArrayList<Gesture>();
    for (int i = 0; i < 5; i++) {
      Gesture g = new Gesture("test" + i, new ArrayList<PointR>());
      prototypes.add(g);
    }
    Category c = null;
    try {
      c = new Category("test", prototypes);
View Full Code Here

 
  @Test
  public void testAddExample() {
    Category c = new Category("test");
    try {
      c.addExample(new Gesture("testKIKI", null));
    }
    catch (Exception e) {
      if (e.getMessage().indexOf("Prototype name") != -1) {
        return;
      }
View Full Code Here

 
  @Test
  public void testAddExampleWithExisitngprototypes() {
    ArrayList<Gesture> prototypes = new ArrayList<Gesture>();
    for (int i = 0; i < 5; i++) {
      Gesture g = new Gesture("test" + i, new ArrayList<PointR>());
      prototypes.add(g);
    }
    Category c = null;
    try {
      c = new Category("test", prototypes);
    }
    catch (Exception e1) {
      fail("exception in initialising a category with prototypes");
    }
    try {
      c.addExample(new Gesture("test5", null));
    }
    catch (Exception e) {
      if (e.getMessage().indexOf("Prototype name") != -1) {
        return;
      }
      else
        fail("error in adding examples." + e.getMessage());
    }
    if (c.getExamples() != 6) {
      fail("error in adding examples");
    }
    try {
      c.addExample(new Gesture("test5", null));
    }
    catch (Exception e) {
      if (e.getMessage().indexOf("Prototype name") != -1) {
        return;
      }
View Full Code Here

 
  @Test
  public void testCtorForNameAndObjectMembersInit() {
    Category c = null;
    try {
      Gesture g = new Gesture("c1", null);
      c = new Category("c1", g);
    }
    catch (Exception e) {
      if (e.getMessage().toLowerCase().indexOf("prototype name") != -1) {
        return;// it is a valid system generated exception for not
View Full Code Here

TOP

Related Classes of classes.Gesture

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.