コード例 #1
0
  @Test
  public void testOnDecisionTableSelectedEventWithMultipleRowsSelected() {
    model
        .getData()
        .add(
            new ArrayList<DTCellValue52>() {
              {
                add(new DTCellValue52(1));
                add(new DTCellValue52("descr"));
                add(new DTCellValue52("md"));
              }
            });
    model
        .getData()
        .add(
            new ArrayList<DTCellValue52>() {
              {
                add(new DTCellValue52(1));
                add(new DTCellValue52("descr"));
                add(new DTCellValue52("md"));
              }
            });

    uiModel.selectCells(0, 2, 1, 2);

    menu.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));

    verify(view, times(1)).enableCutMenuItem(eq(true));
    verify(view, times(1)).enableCopyMenuItem(eq(true));
    verify(view, times(1)).enablePasteMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowAboveMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowBelowMenuItem(eq(false));
    verify(view, times(1)).enableDeleteRowMenuItem(eq(true));
  }
コード例 #2
0
  @Test
  public void testOnDecisionTableSelectedEventWithSelectionsWithClipboardPopulated() {
    model.getMetadataCols().add(new MetadataCol52());
    model
        .getData()
        .add(
            new ArrayList<DTCellValue52>() {
              {
                add(new DTCellValue52(1));
                add(new DTCellValue52("descr"));
                add(new DTCellValue52("md"));
              }
            });

    uiModel.selectCell(0, 2);
    clipboard.setData(
        new HashSet<Clipboard.ClipboardData>() {
          {
            add(new DefaultClipboard.ClipboardDataImpl(0, 2, model.getData().get(0).get(2)));
          }
        });

    menu.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));

    verify(view, times(1)).enableCutMenuItem(eq(true));
    verify(view, times(1)).enableCopyMenuItem(eq(true));
    verify(view, times(1)).enablePasteMenuItem(eq(true));
    verify(view, times(1)).enableInsertRowAboveMenuItem(eq(true));
    verify(view, times(1)).enableInsertRowBelowMenuItem(eq(true));
    verify(view, times(1)).enableDeleteRowMenuItem(eq(true));
  }
コード例 #3
0
  @Test
  public void testOnDecisionTableSelectedEventWithNoSelections() {
    menu.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));

    verify(view, times(1)).enableCutMenuItem(eq(false));
    verify(view, times(1)).enableCopyMenuItem(eq(false));
    verify(view, times(1)).enablePasteMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowAboveMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowBelowMenuItem(eq(false));
    verify(view, times(1)).enableDeleteRowMenuItem(eq(false));
  }
コード例 #4
0
  @Test
  public void testOnDecisionTableSelectedEventReadOnly() {
    dtPresenter.getAccess().setReadOnly(true);
    menu.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));

    verify(view, times(1)).enableCutMenuItem(eq(false));
    verify(view, times(1)).enableCopyMenuItem(eq(false));
    verify(view, times(1)).enablePasteMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowAboveMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowBelowMenuItem(eq(false));
    verify(view, times(1)).enableDeleteRowMenuItem(eq(false));
  }