use of de.westnordost.streetcomplete.data.osm.ElementGeometry in project StreetComplete by westnordost.
the class OsmQuestDaoTest method testGetAllByMultipleQuestTypes.
public void testGetAllByMultipleQuestTypes() {
ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
OsmQuest quest1 = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
OsmQuest quest2 = createNewQuest(new TestQuestType2(), 2, Element.Type.NODE, geom);
addToDaos(quest1, quest2);
List<OsmQuest> only1 = dao.getAll(null, null, Collections.singletonList(TestQuestType.class.getSimpleName()));
assertEquals(1, only1.size());
List<OsmQuest> both = dao.getAll(null, null, Arrays.asList(TestQuestType.class.getSimpleName(), TestQuestType2.class.getSimpleName()));
assertEquals(2, both.size());
}
use of de.westnordost.streetcomplete.data.osm.ElementGeometry in project StreetComplete by westnordost.
the class OsmQuestDaoTest method testGetNextNewAt.
public void testGetNextNewAt() {
ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
OsmQuest quest = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
quest.setStatus(QuestStatus.ANSWERED);
addToDaos(quest, createNewQuest(new TestQuestType2(), 1, Element.Type.NODE, geom), createNewQuest(new TestQuestType3(), 1, Element.Type.NODE, geom), createNewQuest(new TestQuestType4(), 1, Element.Type.NODE, geom), createNewQuest(new TestQuestType5(), 1, Element.Type.NODE, geom));
OsmQuest nextQuest = dao.getNextNewAt(1, Arrays.asList("TestQuestType4", "TestQuestType3", "TestQuestType5"));
assertEquals(nextQuest.getType().getClass().getSimpleName(), "TestQuestType4");
}
use of de.westnordost.streetcomplete.data.osm.ElementGeometry in project StreetComplete by westnordost.
the class OsmQuestDaoTest method testGetNoFittingNextNewAt.
public void testGetNoFittingNextNewAt() {
ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
OsmQuest quest = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
quest.setStatus(QuestStatus.ANSWERED);
addToDaos(quest, createNewQuest(new TestQuestType2(), 2, Element.Type.NODE, geom));
assertNull(dao.getNextNewAt(1, Arrays.asList("TestQuestType")));
}
use of de.westnordost.streetcomplete.data.osm.ElementGeometry in project StreetComplete by westnordost.
the class ElementCreatorTestGeometry method testCreateForPolylineRelation.
public void testCreateForPolylineRelation() {
ElementGeometry geom = createCreator().create(R1);
assertNotNull(geom.polylines);
assertEquals(3, geom.polylines.size());
}
use of de.westnordost.streetcomplete.data.osm.ElementGeometry in project StreetComplete by westnordost.
the class ElementCreatorTestGeometry method testCreateForSimpleAreaWay.
public void testCreateForSimpleAreaWay() {
ElementGeometry geom = createCreator().create(W2);
assertNotNull(geom.polygons);
assertEquals(1, geom.polygons.size());
List<LatLon> polygon = geom.polygons.get(0);
for (int i = 0; i < W2.getNodeIds().size(); ++i) {
LatLon shouldBe = nodes.get(W2.getNodeIds().get(i).intValue()).getPosition();
assertEquals(shouldBe, polygon.get(i));
}
}
Aggregations