public void testShowPage() { // move to page 3 dialog.nextPressed(); dialog.nextPressed(); assertSame("Wizard.nextPressed() set wrong page", wizard.page3, dialog.getCurrentPage()); // showPage() back to page 1 dialog.showPage(wizard.page1); assertSame("Wizard.showPage() set wrong page", wizard.page1, dialog.getCurrentPage()); // TODO Next test fails due to bug #249369 // assertEquals("Back button should be disabled on first page", false, // dialog.getBackButton().getEnabled()); assertEquals( "Next button should be enabled on first page", true, dialog.getNextButton().getEnabled()); }
public void testPageChanging() { // initially on first page assertSame("Wizard started on wrong page", wizard.page1, dialog.getCurrentPage()); assertEquals( "Back button should be disabled on first page", false, dialog.getBackButton().getEnabled()); assertEquals( "Next button should be enabled on first page", true, dialog.getNextButton().getEnabled()); // move to middle page 2 dialog.nextPressed(); assertSame("Wizard.nextPressed() set wrong page", wizard.page2, dialog.getCurrentPage()); assertEquals( "Back button should be enabled on middle page", true, dialog.getBackButton().getEnabled()); assertEquals( "Next button should be enabled on middle page", true, dialog.getNextButton().getEnabled()); // test that can't complete by inserting bad value to be validated wizard.page2.textInputField.setText(TheTestWizardPage.BAD_TEXT_FIELD_CONTENTS); assertEquals( "Finish should be disabled when bad field value", false, dialog.getFinishedButton().getEnabled()); assertEquals("Cancel should always be enabled", true, dialog.getCancelButton().getEnabled()); // test that can complete by inserting good value to be validated wizard.page2.textInputField.setText(TheTestWizardPage.GOOD_TEXT_FIELD_CONTENTS); assertEquals( "Finish should be enabled when good field value", true, dialog.getFinishedButton().getEnabled()); // move to last page 3 dialog.nextPressed(); assertSame("Wizard.nextPressed() set wrong page", wizard.page3, dialog.getCurrentPage()); assertEquals( "Back button should be enabled on last page", true, dialog.getBackButton().getEnabled()); assertEquals( "Next button should be disenabled on last page", false, dialog.getNextButton().getEnabled()); // move back to page 2 dialog.backPressed(); assertSame("Wizard.backPressed() set wrong page", wizard.page2, dialog.getCurrentPage()); assertEquals( "Back button should be enabled on middle page", true, dialog.getBackButton().getEnabled()); assertEquals( "Next button should be enabled on middle page", true, dialog.getNextButton().getEnabled()); // move back to page 1 dialog.backPressed(); assertSame("Wizard.backPressed() set wrong page", wizard.page1, dialog.getCurrentPage()); assertEquals( "Back button should be disabled on first page", false, dialog.getBackButton().getEnabled()); assertEquals( "Next button should be enabled on first page", true, dialog.getNextButton().getEnabled()); // move Next to page 2 dialog.buttonPressed(IDialogConstants.NEXT_ID); assertSame("Wizard.backPressed() set wrong page", wizard.page2, dialog.getCurrentPage()); // move Back to page 1 dialog.buttonPressed(IDialogConstants.BACK_ID); assertSame("Wizard.backPressed() set wrong page", wizard.page1, dialog.getCurrentPage()); }