Search in sources :

Example 91 with Survey

use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.

the class SurveyUpdaterTest method testEditStationWorks.

@Test
public void testEditStationWorks() {
    Leg leg = new Leg(5, 0, 0);
    Survey survey = new Survey("Test Survey");
    SurveyUpdater.update(survey, leg);
    Leg newEdit = new Leg(6, 0, 0);
    SurveyUpdater.editLeg(survey, leg, newEdit);
    Assert.assertEquals(survey.getAllLegs().size(), 1);
    Assert.assertEquals(survey.getAllLegs().get(0).getDistance(), 6, ALLOWED_DOUBLE_DELTA);
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 92 with Survey

use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.

the class SurveyUpdaterTest method testUpdateWithThreeSimilarLegsLeadsToNewStation.

@Test
public void testUpdateWithThreeSimilarLegsLeadsToNewStation() {
    Leg leg = new Leg(5, 0, 0);
    Leg similarLeg = new Leg(5, 0.001f, 0);
    Leg anotherSimilarLeg = new Leg(5, 0, 0.001f);
    Survey survey = new Survey("Test Survey");
    SurveyUpdater.update(survey, leg);
    SurveyUpdater.update(survey, similarLeg);
    SurveyUpdater.update(survey, anotherSimilarLeg);
    Assert.assertEquals(survey.getAllStations().size(), 2);
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 93 with Survey

use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.

the class SurveyUpdaterTest method testMoveLegWorks.

@Test
public void testMoveLegWorks() {
    Survey survey = BasicTestSurveyCreator.createStraightNorth();
    Leg toMove = survey.getStationByName("2").getOnwardLegs().get(0);
    Station originatingStation = survey.getOriginatingStation(toMove);
    Station destinationStation = survey.getStationByName("1");
    Assert.assertNotEquals(originatingStation, destinationStation);
    SurveyUpdater.moveLeg(survey, toMove, destinationStation);
    Assert.assertTrue(destinationStation.getOnwardLegs().contains(toMove));
    Assert.assertFalse(originatingStation.getOnwardLegs().contains(toMove));
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Survey(org.hwyl.sexytopo.model.survey.Survey) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 94 with Survey

use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.

the class StationNamerTest method testNameAdvancesNumberOnPotentialBranch.

@Test
public void testNameAdvancesNumberOnPotentialBranch() {
    Survey testSurvey = BasicTestSurveyCreator.createStraightNorth();
    String newName = StationNamer.generateNextStationName(testSurvey, testSurvey.getStationByName("1"));
    int numberOfStations = testSurvey.getAllStations().size();
    Assert.assertEquals(Integer.toString(numberOfStations + 1), newName);
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Test(org.junit.Test)

Example 95 with Survey

use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.

the class StationNamerTest method testNameAdvancesNumberOnEstablishedBranch.

@Test
public void testNameAdvancesNumberOnEstablishedBranch() {
    Survey testSurvey = BasicTestSurveyCreator.createStraightNorthWith1EBranch();
    String newName = StationNamer.generateNextStationName(testSurvey, testSurvey.getStationByName("5"));
    int numberOfStations = testSurvey.getAllStations().size();
    Assert.assertEquals(Integer.toString(numberOfStations + 1), newName);
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Test(org.junit.Test)

Aggregations

Survey (org.hwyl.sexytopo.model.survey.Survey)101 Test (org.junit.Test)56 Station (org.hwyl.sexytopo.model.survey.Station)31 Leg (org.hwyl.sexytopo.model.survey.Leg)24 AlertDialog (android.app.AlertDialog)10 SuppressLint (android.annotation.SuppressLint)9 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)9 ArrayAdapter (android.widget.ArrayAdapter)8 File (java.io.File)6 HashMap (java.util.HashMap)6 View (android.view.View)5 EditText (android.widget.EditText)5 ArrayList (java.util.ArrayList)5 Set (java.util.Set)5 Context (android.content.Context)4 SharedPreferences (android.content.SharedPreferences)4 Editable (android.text.Editable)4 List (java.util.List)4 Map (java.util.Map)4 R (org.hwyl.sexytopo.R)4