コード例 #1
0
 /** Tests that communications can be drawn in communications */
 public void testCommunicationInCommunication() {
   test_id = "1";
   String diagramName = "Communication in Communication";
   Package_c communication = getPackage(diagramName);
   CanvasUtilities.openCanvasEditor(communication);
   GraphicalEditor ce = CanvasTestUtilities.getCanvasEditor(diagramName);
   validateOrGenerateResults(ce, generateResults);
 }
コード例 #2
0
  /** Tests that a link can be formalized against a supertype subtype association */
  public void testFormalizeLinkWithSupertypeSubtype() {
    test_id = "2";
    String diagramName = "Communication in Communication";
    GraphicalEditor ce = CanvasTestUtilities.getCanvasEditor(diagramName);

    CommunicationLink_c testLink =
        CommunicationLink_c.CommunicationLinkInstance(
            modelRoot,
            new ClassQueryInterface_c() {

              public boolean evaluate(Object candidate) {
                CommunicationLink_c selected = (CommunicationLink_c) candidate;
                return selected.getStarttext().equals("superSub");
              }
            });
    assertNotNull(testLink);
    selection.clear();
    selection.addToSelection(testLink);
    IStructuredSelection sel = Selection.getInstance().getStructuredSelection();

    // create and initialize the wizard
    LinkFormalizeOnCOMM_LNKWizard wizard = new LinkFormalizeOnCOMM_LNKWizard();
    wizard.init(workbench, sel, null);
    WizardDialog dialog = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
    dialog.create();

    // Select the association in the wizard
    LinkFormalizeOnCOMM_LNKWizardPage2 page =
        (LinkFormalizeOnCOMM_LNKWizardPage2) wizard.getStartingPage();
    page.createControl(workbench.getActiveWorkbenchWindow().getShell());
    Combo associationCombo = page.AssociationCombo;
    selectItemInList("R1", associationCombo);
    assertTrue(
        "Supertype association: " + "R1, " + "was not selected in the wizard.",
        wizard.performFinish());

    validateOrGenerateResults(ce, generateResults);
  }
コード例 #3
0
  /** Tests the toggle switch for visibility */
  public void testToggleLinkVisibility() {
    test_id = "9";
    String diagramName = "Communication in Communication";
    GraphicalEditor ce = CanvasTestUtilities.getCanvasEditor(diagramName);

    CommunicationLink_c testLink =
        CommunicationLink_c.CommunicationLinkInstance(
            modelRoot,
            new ClassQueryInterface_c() {

              public boolean evaluate(Object candidate) {
                CommunicationLink_c selected = (CommunicationLink_c) candidate;
                return selected.getStarttext().equals("superSub");
              }
            });
    assertNotNull(testLink);
    selection.clear();
    selection.addToSelection(testLink);

    ToggleStartVisibilityOnCOMM_LNKAction toggleStartAction =
        new ToggleStartVisibilityOnCOMM_LNKAction();
    toggleStartAction.run(new Action() {});

    ToggleEndVisibilityOnCOMM_LNKAction toggleEndAction = new ToggleEndVisibilityOnCOMM_LNKAction();
    toggleEndAction.run(new Action() {});

    validateOrGenerateResults(ce, generateResults);

    test_id = "10";

    toggleStartAction.run(new Action() {});

    toggleEndAction.run(new Action() {});

    validateOrGenerateResults(ce, generateResults);
  }