コード例 #1
0
 public void testGetSchedule() throws Exception {
   TimeScheduleEditor editor = new TimeScheduleEditor(shell);
   editor.getInput().add(new MarketTimeElement(getTime(9, 0), getTime(16, 0)));
   editor.getInput().get(0).setDescription("Description");
   MarketTime[] schedule = editor.getSchedule();
   assertEquals(1, schedule.length);
 }
コード例 #2
0
 public void testSetSchedule() throws Exception {
   TimeScheduleEditor editor = new TimeScheduleEditor(shell);
   editor.setSchedule(
       new MarketTime[] {
         new MarketTime(getTime(9, 0), getTime(16, 0)),
       });
   assertEquals(1, editor.getViewer().getTable().getItemCount());
 }
コード例 #3
0
 public void testEditDescription() throws Exception {
   TimeScheduleEditor editor = new TimeScheduleEditor(shell);
   editor.setSchedule(
       new MarketTime[] {
         new MarketTime(getTime(9, 0), getTime(16, 0)),
       });
   MarketTimeElement element =
       (MarketTimeElement) editor.getViewer().getTable().getItem(0).getData();
   ICellModifier cellModifier = editor.getViewer().getCellModifier();
   assertTrue(cellModifier.canModify(element, "2"));
   assertEquals("", cellModifier.getValue(element, "2"));
   cellModifier.modify(element, "2", "New Description");
   assertEquals("New Description", element.getDescription());
 }
コード例 #4
0
 public void testSetScheduleInProperOrder() throws Exception {
   TimeScheduleEditor editor = new TimeScheduleEditor(shell);
   MarketTime[] schedule =
       new MarketTime[] {
         new MarketTime(getTime(18, 0), getTime(20, 0)),
         new MarketTime(getTime(9, 0), getTime(16, 0)),
       };
   editor.setSchedule(schedule);
   assertEquals(
       schedule[1].getOpenTime(),
       ((MarketTimeElement) editor.getViewer().getTable().getItem(0).getData()).getOpenTime());
   assertEquals(
       schedule[0].getOpenTime(),
       ((MarketTimeElement) editor.getViewer().getTable().getItem(1).getData()).getOpenTime());
 }
コード例 #5
0
 public void testCreateEmpty() throws Exception {
   TimeScheduleEditor editor = new TimeScheduleEditor(shell);
   assertEquals(0, editor.getViewer().getTable().getItemCount());
   assertEquals(0, editor.getSchedule().length);
 }