diff options
Diffstat (limited to 'tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteCellsOverwriteFailRows_H1_H1_H1_MultiColumns_Test.java')
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteCellsOverwriteFailRows_H1_H1_H1_MultiColumns_Test.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteCellsOverwriteFailRows_H1_H1_H1_MultiColumns_Test.java new file mode 100644 index 00000000000..9c405915a7b --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/paste/overwrite/PasteCellsOverwriteFailRows_H1_H1_H1_MultiColumns_Test.java @@ -0,0 +1,60 @@ +/***************************************************************************** + * Copyright (c) 2015 CEA LIST 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; +import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager; +import org.eclipse.papyrus.infra.nattable.messages.Messages; +import org.junit.Assert; + +/** + * Test pastes overwrite when the number of rows to paste is not equals to the number of rows selected. + */ +public class PasteCellsOverwriteFailRows_H1_H1_H1_MultiColumns_Test extends AbstractPasteCellsOverwriteTest { + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#removeClassName(java.lang.String) + */ + @Override + public String removeClassName(final String className) throws Exception { + return className.replaceFirst("PasteCellsOverwriteFailRows_", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Manage the selection with the shift key. + * {@inheritDoc} + * + * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#manageSelection(org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager) + */ + @Override + public void manageSelection(final NattableModelManager manager) throws Exception { + super.manageSelection(manager); + manager.getBodyLayerStack().getSelectionLayer().doCommand(new SelectCellCommand(manager.getBodyLayerStack().getSelectionLayer(), 3, 2, true, false)); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.uml.nattable.clazz.config.tests.paste.overwrite.AbstractPasteOverwriteTest#checkReturned_Status(org.eclipse.core.runtime.IStatus) + */ + @Override + protected void checkReturned_Status(final IStatus status) { + Assert.assertEquals("Error must be caught", IStatus.ERROR, status.getSeverity()); //$NON-NLS-1$ + Assert.assertEquals("Error message is not the expected message", Messages.AbstractPasteInSelectionNattableCommandProvider_readrowsexceedsexistingrows, status.getMessage()); //$NON-NLS-1$ + } + +} |