blob: 9b41a2027807dd60d21608431f5c508b421b0a81 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) and others.
* All rights reserved. This program and the accompanying materials
* are 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:
* Lorenzo Bettini - Initial contribution and API
*******************************************************************************/
package org.eclipse.emf.parsley.tests
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(typeof(SWTBotJunit4ClassRunner))
public class EmfParsleyDialogTests extends EmfParsleyAbstractTests {
protected var editorName = EMF_TREE_EDITOR_OPEN_DIALOG
@Test
def void checkOpenDialogOnTreeElements() {
openEmfEditorOnTestFile(editorName,
MY_EXTLIBRARY)
libraryNode.assertDialog(LIBRARY_LABEL) [|
assertDialogControlsOfLibraryNode(true)
]
writerNode.assertDialog(WRITER_LABEL) [|
assertDialogControlsOfWriterNode(true)
]
}
@Test
def void checkDialogDatabinding() {
openEmfEditorOnTestFile(editorName,
MY_EXTLIBRARY)
libraryNode.assertDialogEdit(LIBRARY_LABEL) [|
modifyText(LIBRARY_NAME)
]
}
def protected assertDialog(SWTBotTreeItem item, String dialogTitle, ()=>void proc) {
item.doubleClick
bot.shell(dialogTitle).activate
proc.apply()
bot.button("OK").click()
}
def protected assertDialogEdit(SWTBotTreeItem item, String dialogTitle, ()=>void proc) {
assertDialog(item, dialogTitle, proc)
assertEditorDirty()
saveEditor()
}
def protected assertEditorDirty() {
editorName.assertEditorDirty
}
def protected saveEditor() {
getEditor(editorName).save
}
def protected getRootOfEditor() {
getRootOfTreeEditor(editorName, MY_EXT_LIBRARY_PLATFORM_URI)
}
def protected libraryNode() {
getLibraryNode(getRootOfEditor)
}
def protected libraryModifiedNode() {
getLibraryModifiedNode(getRootOfEditor)
}
def protected writerNode() {
getWriterNode(libraryNode)
}
}