Author: dgolovin
Date: 2009-02-26 19:17:13 -0500 (Thu, 26 Feb 2009)
New Revision: 13854
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/common/model/ui/test/preferences/ModelUiPreferencesPageTest.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/PreferencePageTest.java
Removed:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiPreferencesPageTest.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesPage.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/MainPreferencePage.java
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java
Log:
increase tests coverage and adjust tests structure for common.model.ui
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesPage.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesPage.java 2009-02-27
00:07:28 UTC (rev 13853)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesPage.java 2009-02-27
00:17:13 UTC (rev 13854)
@@ -23,6 +23,9 @@
* @author Viacheslav Kabanovich
*/
public class DecoratorPreferencesPage extends PreferencePage implements
IWorkbenchPreferencePage {
+
+ public static final String ID = "org.jboss.tools.common.model.ui.decorator";
+
DecoratorGeneralPreferencesPage general = new DecoratorGeneralPreferencesPage();
DecoratorTextPreferencesPage text = new DecoratorTextPreferencesPage();
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/MainPreferencePage.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/MainPreferencePage.java 2009-02-27
00:07:28 UTC (rev 13853)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/MainPreferencePage.java 2009-02-27
00:17:13 UTC (rev 13854)
@@ -39,6 +39,9 @@
public class MainPreferencePage extends PreferencePage implements
IWorkbenchPreferencePage {
+
+ public static final String ID =
"org.jboss.tools.common.model.ui.MainPreferencePage";
+
private Image image;
/** Default constructor */
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/common/model/ui/test/preferences/ModelUiPreferencesPageTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/common/model/ui/test/preferences/ModelUiPreferencesPageTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/common/model/ui/test/preferences/ModelUiPreferencesPageTest.java 2009-02-27
00:17:13 UTC (rev 13854)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.common.model.ui.test.preferences;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferencePage;
+import org.jboss.tools.common.model.ui.preferences.CompanyPreferencesPage;
+import org.jboss.tools.common.model.ui.preferences.DecoratorPreferencesPage;
+import org.jboss.tools.common.model.ui.preferences.MainPreferencePage;
+import
org.jboss.tools.common.model.ui.templates.preferences.GlobalTemplatePreferencePage;
+import org.jboss.tools.common.model.ui.texteditors.preferences.EditorsPreferencesPage;
+import org.jboss.tools.test.util.WorkbenchUtils;
+import org.jboss.tools.tests.PreferencePageTest;
+
+/**
+ * @author eskimo
+ *
+ */
+public class ModelUiPreferencesPageTest extends PreferencePageTest {
+
+ public void testDecoratorPreferencesPage() {
+ doDefaultTest(DecoratorPreferencesPage.ID, DecoratorPreferencesPage.class);
+ }
+
+ public void testMainPreferencesPage() {
+ doDefaultTest(MainPreferencePage.ID, MainPreferencePage.class);
+ }
+
+ public void testCompanyPreferencesPage() {
+ doDefaultTest(CompanyPreferencesPage.WEB_PREFERENCES_ID,CompanyPreferencesPage.class);
+ }
+
+ public void testGlobalTemplatesPreferencesPage() {
+ doDefaultTest(GlobalTemplatePreferencePage.GLOBAL_TEMPLATES_PREFERENCES_ID,GlobalTemplatePreferencePage.class);
+ }
+
+ public void testEditorsPreferencesPage() {
+ doDefaultTest(EditorsPreferencesPage.EDITOR_PREFERENCES_ID,
EditorsPreferencesPage.class);
+ }
+
+}
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/common/model/ui/test/preferences/ModelUiPreferencesPageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java 2009-02-27
00:07:28 UTC (rev 13853)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java 2009-02-27
00:17:13 UTC (rev 13854)
@@ -13,9 +13,11 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.common.model.ui.test.preferences.ModelUiPreferencesPageTest;
import org.jboss.tools.common.core.jdt.test.FavoritesClassControllerTest;
import org.jboss.tools.common.model.ui.dialog.test.ErrorDialogTest;
import org.jboss.tools.common.model.ui.dialog.test.MessageAndCheckboxDialogTest;
+import org.jboss.tools.common.model.ui.preferences.DecoratorPreferencesPage;
import org.jboss.tools.common.model.ui.reporting.ReportProblemWizardTest;
/**
@@ -28,6 +30,7 @@
public static Test suite() {
TestSuite suite = new TestSuite();
suite.setName("All tests for " + PLUGIN_ID);
+ suite.addTestSuite(DecoratorPreferencesPage.class);
suite.addTestSuite(ModelUiPreferencesPageTest.class);
suite.addTestSuite(ObjectDecoratorTest.class);
suite.addTestSuite(FavoritesClassControllerTest.class);
Deleted:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiPreferencesPageTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiPreferencesPageTest.java 2009-02-27
00:07:28 UTC (rev 13853)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiPreferencesPageTest.java 2009-02-27
00:17:13 UTC (rev 13854)
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.common.model.ui.test;
-
-import junit.framework.TestCase;
-
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.jboss.tools.common.model.ui.preferences.CompanyPreferencesPage;
-import
org.jboss.tools.common.model.ui.templates.preferences.GlobalTemplatePreferencePage;
-import org.jboss.tools.common.model.ui.texteditors.preferences.EditorsPreferencesPage;
-import org.jboss.tools.test.util.WorkbenchUtils;
-
-/**
- * @author eskimo
- *
- */
-public class ModelUiPreferencesPageTest extends TestCase {
-
- public void testWebPreferencesPage() {
- PreferenceDialog prefDialog =
- WorkbenchUtils.createPreferenceDialog(
- CompanyPreferencesPage.WEB_PREFERENCES_ID);
-
- try {
- prefDialog.setBlockOnOpen(false);
- prefDialog.open();
-
- Object selectedPage = prefDialog.getSelectedPage();
- assertTrue("Selected page is not an instance of CompanyPreferencesPage",
selectedPage instanceof CompanyPreferencesPage);
- } finally {
- prefDialog.close();
- }
- }
-
- public void testEditorsPreferencesPage() {
- PreferenceDialog prefDialog =
- WorkbenchUtils.createPreferenceDialog(
- EditorsPreferencesPage.EDITOR_PREFERENCES_ID);
-
- try {
- prefDialog.setBlockOnOpen(false);
- prefDialog.open();
-
- Object selectedPage = prefDialog.getSelectedPage();
- assertTrue("Selected page is not an instance of EditorsPreferencesPage",
selectedPage instanceof EditorsPreferencesPage);
- } finally {
- prefDialog.close();
- }
- }
-
- public void testGlobalTemplatesPreferencesPage() {
- PreferenceDialog prefDialog =
- WorkbenchUtils.createPreferenceDialog(
- GlobalTemplatePreferencePage.GLOBAL_TEMPLATES_PREFERENCES_ID);
-
- try {
- prefDialog.setBlockOnOpen(false);
- prefDialog.open();
-
- Object selectedPage = prefDialog.getSelectedPage();
- assertTrue("Selected page is not an instance of
GlobalTemplatePreferencePage", selectedPage instanceof
GlobalTemplatePreferencePage);
- } finally {
- prefDialog.close();
- }
- }
-}
Added:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/PreferencePageTest.java
===================================================================
---
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/PreferencePageTest.java
(rev 0)
+++
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/PreferencePageTest.java 2009-02-27
00:17:13 UTC (rev 13854)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferencePage;
+import org.jboss.tools.test.util.WorkbenchUtils;
+
+/**
+ * @author eskimo
+ *
+ */
+public class PreferencePageTest extends TestCase {
+
+ private String prefPageId;
+ Class<?extends PreferencePage> instanceOf;
+
+ public PreferencePageTest() {
+ super();
+ }
+
+ public PreferencePageTest(String prefPageId, Class<?extends PreferencePage>
instanceOf) {
+ this.prefPageId = prefPageId;
+ this.instanceOf = instanceOf;
+ }
+ /**
+ * This method performs simple test for provided preference page. It
+ * opens preference dialog with page loaded by a provided prefPageId
+ * and verifies that it is an instance of provided class
+ */
+ public void doDefaultTest(String id, Class<?extends PreferencePage> instanceOf) {
+ PreferenceDialog prefDialog =
+ WorkbenchUtils.createPreferenceDialog(
+ id);
+
+ try {
+ prefDialog.setBlockOnOpen(false);
+ prefDialog.open();
+
+ Object selectedPage = prefDialog.getSelectedPage();
+ assertTrue("Selected page is not an instance of SeamPreferencePage",
instanceOf.isInstance(selectedPage));
+ } finally {
+ prefDialog.close();
+ }
+ }
+
+ public void doDefaultTest() {
+ doDefaultTest(prefPageId,instanceOf);
+ }
+}
Property changes on:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/PreferencePageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain