Search in sources :

Example 21 with OpeningHours

use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.

the class OpeningTimeValueParserTest method parseDays2.

@Test
public void parseDays2() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours = new OpeningHours();
    openingHours.setAllDaysActivated(false);
    openingMonth.addOpeningHours(openingHours);
    openingTime.addOpeningMonth(openingMonth);
    openingHours.setDayActivated(5, true);
    Assert.assertEquals(parser.toValue(openingTime), "Sa 08:00-18:00");
}
Also used : OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) OpeningTime(io.jawg.osmcontributor.model.utils.OpeningTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Example 22 with OpeningHours

use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.

the class OpeningTimeValueParserTest method parseMonthAndDays1.

@Test
public void parseMonthAndDays1() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours = new OpeningHours();
    openingHours.setAllDaysActivated(false);
    openingMonth.addOpeningHours(openingHours);
    openingMonth.setMonthActivated(0, true);
    openingMonth.setMonthActivated(2, true);
    openingMonth.setMonthActivated(4, true);
    openingMonth.setMonthActivated(5, true);
    openingMonth.setMonthActivated(6, true);
    openingMonth.setMonthActivated(7, true);
    openingMonth.setMonthActivated(8, true);
    openingMonth.setMonthActivated(10, true);
    openingMonth.setMonthActivated(11, true);
    openingHours.setDayActivated(0, true);
    openingHours.setDayActivated(1, true);
    openingHours.setDayActivated(6, true);
    openingTime.addOpeningMonth(openingMonth);
    Assert.assertEquals(parser.toValue(openingTime), "Jan,Mar,May-Sep,Nov-Dec: Mo-Tu,Su 08:00-18:00");
}
Also used : OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) OpeningTime(io.jawg.osmcontributor.model.utils.OpeningTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Example 23 with OpeningHours

use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.

the class OpeningTimeValueParserTest method parseOpeningHours2.

@Test
public void parseOpeningHours2() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours1 = new OpeningHours();
    OpeningHours openingHours2 = new OpeningHours();
    OpeningHours openingHours3 = new OpeningHours();
    openingMonth.addOpeningHours(openingHours1);
    openingMonth.addOpeningHours(openingHours2);
    openingMonth.addOpeningHours(openingHours3);
    openingMonth.setMonthActivated(2, true);
    openingMonth.setMonthActivated(3, true);
    openingMonth.setMonthActivated(5, true);
    openingMonth.setMonthActivated(6, true);
    openingMonth.setMonthActivated(10, true);
    openingHours1.setAllDaysActivated(false);
    openingHours1.setDayActivated(2, true);
    openingHours1.setDayActivated(4, true);
    openingHours1.setDayActivated(5, true);
    openingHours1.setFromTime(new LocalTime(10, 45));
    openingHours1.setToTime(new LocalTime(19, 15));
    openingHours2.setAllDaysActivated(false);
    openingHours2.setDayActivated(5, true);
    openingHours2.setDayActivated(6, true);
    openingHours2.setDayActivated(1, true);
    openingHours2.setFromTime(new LocalTime(5, 30));
    openingHours2.setToTime(new LocalTime(17, 30));
    openingHours3.setAllDaysActivated(false);
    openingHours3.setDayActivated(2, true);
    openingTime.addOpeningMonth(openingMonth);
    Assert.assertEquals(parser.toValue(openingTime), "Mar-Apr,Jun-Jul,Nov: We,Fr-Sa 10:45-19:15, Tu,Sa-Su 05:30-17:30, We 08:00-18:00");
}
Also used : LocalTime(org.joda.time.LocalTime) OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) OpeningTime(io.jawg.osmcontributor.model.utils.OpeningTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Example 24 with OpeningHours

use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.

the class OpeningTimeValueParserTest method parseDays1.

@Test
public void parseDays1() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours = new OpeningHours();
    openingHours.setAllDaysActivated(false);
    openingHours.setDayActivated(0, true);
    openingHours.setDayActivated(1, true);
    openingHours.setDayActivated(6, true);
    openingMonth.addOpeningHours(openingHours);
    openingTime.addOpeningMonth(openingMonth);
    Assert.assertEquals(parser.toValue(openingTime), "Mo-Tu,Su 08:00-18:00");
}
Also used : OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) OpeningTime(io.jawg.osmcontributor.model.utils.OpeningTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Example 25 with OpeningHours

use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.

the class OpeningTimeValueParserTest method parseMonthAndDays2.

@Test
public void parseMonthAndDays2() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours = new OpeningHours();
    openingHours.setAllDaysActivated(false);
    openingMonth.addOpeningHours(openingHours);
    openingMonth.setMonthActivated(2, true);
    openingHours.setDayActivated(2, true);
    openingTime.addOpeningMonth(openingMonth);
    Assert.assertEquals(parser.toValue(openingTime), "Mar: We 08:00-18:00");
}
Also used : OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) OpeningTime(io.jawg.osmcontributor.model.utils.OpeningTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Aggregations

OpeningHours (io.jawg.osmcontributor.model.utils.OpeningHours)26 Test (org.junit.Test)21 LocalTime (org.joda.time.LocalTime)17 OpeningMonth (io.jawg.osmcontributor.model.utils.OpeningMonth)12 OpeningTime (io.jawg.osmcontributor.model.utils.OpeningTime)9 View (android.view.View)2 EditText (android.widget.EditText)2 EditDaysDialogFragment (io.jawg.osmcontributor.ui.dialogs.EditDaysDialogFragment)2 PleaseApplyOpeningTimeChange (io.jawg.osmcontributor.ui.events.edition.PleaseApplyOpeningTimeChange)2