예제 #1
0
  private static void createPlainQuestion(JPanelFixture panel, AnswerType type, boolean alterPair) {
    createQuestionTitleQuestionCitation(panel, alterPair);
    JComboBoxFixture answerType =
        new JComboBoxFixture(
            panel.robot,
            (JComboBox)
                panel
                    .robot
                    .finder()
                    .find(panel.component(), new NameMatcher("question_answer_type_menu")));
    answerType.selectItem(type.ordinal());

    if (!alterPair && type.equals(AnswerType.CATEGORICAL)) {
      panel.button(withText("Selections")).click();
      fillInCategoricalQuestions(panel.robot);
    } else if (alterPair) {
      panel.button(withText("Selections")).click();

      DialogFixture dialog =
          WindowFinder.findDialog("Category Options").withTimeout(10000).using(panel.robot);
      JComboBoxFixture cmbF = dialog.comboBox();
      cmbF.selectItem(2);

      dialog.list().selectItem(0);
      dialog.button(withText("Mark selected item adjacent")).click();

      dialog.button(withText("OK")).click();
    }
  }
예제 #2
0
  private static void createQuestionTitleQuestionCitation(JPanelFixture fix, boolean alterPair) {
    fix.button(withText("New")).click();

    NameMatcher titleFieldMatcher = new NameMatcher("question_title_field");
    NameMatcher questionFieldMatcher = new NameMatcher("question_question_field");
    NameMatcher citationFieldMatcher = new NameMatcher("question_citation_field");

    JTextComponentFixture titleText =
        new JTextComponentFixture(
            fix.robot, (JTextField) fix.robot.finder().find(fix.component(), titleFieldMatcher));
    titleText.enterText("Question about " + randomString());

    JTextComponentFixture questionText =
        new JTextComponentFixture(
            fix.robot, (JTextArea) fix.robot.finder().find(fix.component(), questionFieldMatcher));
    if (alterPair) questionText.enterText("question - does $$1 " + randomString() + " with $$2?");
    else questionText.enterText("question - does " + randomString() + "?");

    JTextComponentFixture citationText =
        new JTextComponentFixture(
            fix.robot, (JTextArea) fix.robot.finder().find(fix.component(), citationFieldMatcher));
    citationText.enterText(randomString(10));
  }