diff options
| author | Pierre-Charles David | 2015-05-19 08:37:55 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2015-05-19 08:45:41 +0000 |
| commit | 5e61db13634ad4553de3d97db07fbadfebd813e4 (patch) | |
| tree | fed7135138557c7d8be2267d06756d306f95e690 | |
| parent | a80771547bb22733aa16bc25fa5a367b747f3005 (diff) | |
| download | org.eclipse.sirius-5e61db13634ad4553de3d97db07fbadfebd813e4.tar.gz org.eclipse.sirius-5e61db13634ad4553de3d97db07fbadfebd813e4.tar.xz org.eclipse.sirius-5e61db13634ad4553de3d97db07fbadfebd813e4.zip | |
[424422] Fix test APIs which relied on absolute buttons indices
AbstractSiriusSwtBotGefTestCase.getSectionButton() was too brittle as it
relied on the absolute position of buttons inside a group, which changed
with the addition of the new styles. Make the method more robust by
using SWTBot's buttonWithTooltipInGroup() API directly.
Bug: 424422
Change-Id: I062ea16042b6927bbee683f571229dce4d797035
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
3 files changed, 9 insertions, 24 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html index 180b9d1271..070ca74d20 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html @@ -748,8 +748,9 @@ <code>warnings</code> member variable in the same way as the existing <code>errors</code> member variable. </li> - </ul> - <ul> + <li>The method + <code>org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase.getSectionButton()</code> now only takes the button’s tooltip instead of a numerical position index and the tooltip. + </li> <li>The methods <code>org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusHelper.selectPropertyTabItem(String)</code> now returns a <code>boolean</code> that is true when the property tab item is found, false otherwise. @@ -2737,4 +2738,4 @@ void removeSelectedView(DView view); <li>The ability to print table representations has been disabled for the 0.9 release due to an external dependency issue (see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=422223" target="_blank">bug #422223</a>: for the details). It should be re-introduced in 1.0.</li> </ul> </body> -</html> +</html>
\ No newline at end of file diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile index 05693ebc91..64c9bac286 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile @@ -216,7 +216,7 @@ h4. Changes in @org.eclipse.sirius.tests.swtbot.support@ * The methods @org.eclipse.sirius.tests.swtbot.support.api.business.UIPerspective.deleteProject(UIProject)@ and @org.eclipse.sirius.tests.swtbot.support.api.business.UIPerspective.deleteProject(String)@ have been deprecated, @org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper.setReadOnlyStatus(boolean, IResource...)@ can be used instead. * The @warnings@ member variable has been added to @org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase@ to allow the recording of warning logs. Methods @doesAWarningOccurs()@, @setWarningCatchActive(boolean)@, @isWarningCatchActive()@ and @getWarningLoggersMessage()@ have also been added to manage the @warnings@ member variable in the same way as the existing @errors@ member variable. - +* The method @org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase.getSectionButton()@ now only takes the button's tooltip instead of a numerical position index and the tooltip. * The methods @org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusHelper.selectPropertyTabItem(String)@ now returns a @boolean@ that is true when the property tab item is found, false otherwise. h4. Changes in @org.eclipse.sirius.ext.swt@ diff --git a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/AbstractSiriusSwtBotGefTestCase.java b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/AbstractSiriusSwtBotGefTestCase.java index 255c05260c..13ea75269a 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/AbstractSiriusSwtBotGefTestCase.java +++ b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/AbstractSiriusSwtBotGefTestCase.java @@ -48,8 +48,6 @@ import org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants; import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.sirius.business.api.dialect.DialectManager; import org.eclipse.sirius.business.api.preferences.SiriusPreferencesKeys; import org.eclipse.sirius.business.api.session.Session; @@ -63,8 +61,6 @@ import org.eclipse.sirius.diagram.tools.api.preferences.SiriusDiagramCorePrefere import org.eclipse.sirius.diagram.tools.api.preferences.SiriusDiagramPreferencesKeys; import org.eclipse.sirius.diagram.tools.internal.preferences.SiriusDiagramInternalPreferencesKeys; import org.eclipse.sirius.diagram.ui.business.internal.dialect.DiagramDialectUIServices; -import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramEdgeEditPart; -import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramNameEditPart; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.tools.api.preferences.SiriusDiagramUiPreferencesKeys; import org.eclipse.sirius.diagram.ui.tools.internal.actions.style.ResetStylePropertiesToDefaultValuesAction; @@ -1241,7 +1237,7 @@ public abstract class AbstractSiriusSwtBotGefTestCase extends SWTBotGefTestCase } private SWTBotButton getSetStyleToWorkspaceImageButtonFromAppearanceTab() { - return getSectionButton(3, AbstractSiriusSwtBotGefTestCase.SET_STYLE_TO_WORKSPACE_IMAGE); + return getSectionButton(AbstractSiriusSwtBotGefTestCase.SET_STYLE_TO_WORKSPACE_IMAGE); } /** @@ -1267,19 +1263,9 @@ public abstract class AbstractSiriusSwtBotGefTestCase extends SWTBotGefTestCase */ protected SWTBotButton getResetStylePropertiesToDefaultValuesButtonFromAppearanceTab() { SWTBotButton resetStylePropertiesToDefaultValuesButtonFromAppearanceTab = null; - int buttonIndex = 4; editor.show(); editor.setFocus(); - ISelection selection = editor.getSelection(); - if (!selection.isEmpty() && selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - Object firstElement = structuredSelection.getFirstElement(); - - if (firstElement instanceof AbstractDiagramEdgeEditPart || firstElement instanceof AbstractDiagramNameEditPart) { - buttonIndex = 3; - } - } - resetStylePropertiesToDefaultValuesButtonFromAppearanceTab = getSectionButton(buttonIndex, ResetStylePropertiesToDefaultValuesAction.ACTION_NAME); + resetStylePropertiesToDefaultValuesButtonFromAppearanceTab = getSectionButton(ResetStylePropertiesToDefaultValuesAction.ACTION_NAME); return resetStylePropertiesToDefaultValuesButtonFromAppearanceTab; } @@ -1287,18 +1273,16 @@ public abstract class AbstractSiriusSwtBotGefTestCase extends SWTBotGefTestCase * Returns the button from the 'Appearance' section at the given index, that * should have the given tooltip. * - * @param index - * the index of the button to get from the 'Appearance' section * @param tooltip * the expected tooltip for this button * @return the button from the 'Appearance' section at the given index, that * should have the given tooltip */ - protected SWTBotButton getSectionButton(int index, String tooltip) { + protected SWTBotButton getSectionButton(String tooltip) { SWTBot propertiesBot = bot.viewByTitle("Properties").bot(); bot.viewByTitle("Properties").setFocus(); SWTBotSiriusHelper.selectPropertyTabItem("Appearance"); - SWTBotButton button = propertiesBot.buttonInGroup("Fonts and Colors:", index); + SWTBotButton button = propertiesBot.buttonWithTooltipInGroup(tooltip, "Fonts and Colors:"); TestCase.assertNotNull(button); // get button from index and check requested tool-tip allows to check |
