-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#114 getText shall not return \n on Requirement Text
Change-Id: I5a6a3ae8fcdc0cd03f2e1c0686d35664e69d1429 Signed-off-by: Philippe DUL <philippe.dul@thalesgroup.com>
- Loading branch information
1 parent
9c8d04c
commit df1f1f5
Showing
3 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...irements.ju/src/org/polarsys/capella/vp/requirements/ju/testcases/HtmlToTextTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 THALES GLOBAL SERVICES. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Thales - initial API and implementation | ||
*******************************************************************************/ | ||
package org.polarsys.capella.vp.requirements.ju.testcases; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.polarsys.capella.common.ef.command.AbstractReadWriteCommand; | ||
import org.polarsys.capella.common.helpers.EObjectLabelProviderHelper; | ||
import org.polarsys.capella.common.helpers.TransactionHelper; | ||
import org.polarsys.capella.test.framework.api.BasicTestCase; | ||
import org.polarsys.capella.test.framework.context.SessionContext; | ||
import org.polarsys.kitalpha.vp.requirements.Requirements.Requirement; | ||
|
||
public class HtmlToTextTestCase extends BasicTestCase { | ||
|
||
private static final String projectTestName = "misc"; | ||
|
||
/** | ||
* @see org.polarsys.capella.test.framework.api.BasicTestArtefact#getRequiredTestModels() | ||
*/ | ||
@Override | ||
public List<String> getRequiredTestModels() { | ||
return Arrays.asList(projectTestName); | ||
} | ||
|
||
/** | ||
* @see org.polarsys.capella.test.framework.api.BasicTestCase#test() | ||
*/ | ||
@Override | ||
public void test() throws Exception { | ||
SessionContext session = new SessionContext(getSession(projectTestName)); | ||
|
||
Requirement target = session.getSemanticElement("130237c0-c390-4b1a-99e8-1933d14d0f21"); | ||
setText(target, "value1<okok>"); | ||
assertTrue(EObjectLabelProviderHelper.getText(target).equals("value1")); | ||
|
||
setText(target, "value1<okok>\r\nvalue2"); | ||
assertTrue(EObjectLabelProviderHelper.getText(target).equals("value1 value2")); | ||
|
||
setText(target, "value1<okok>\nvalue2"); | ||
assertTrue(EObjectLabelProviderHelper.getText(target).equals("value1 value2")); | ||
|
||
setText(target, "value1<okok><pppp>\n<lll>\n</br>\r\n</kkkk>value2"); | ||
assertTrue(EObjectLabelProviderHelper.getText(target).equals("value1 value2")); | ||
} | ||
|
||
private void setText(Requirement req, String text) { | ||
TransactionHelper.getExecutionManager(req).execute(new AbstractReadWriteCommand() { | ||
@Override | ||
public void run() { | ||
req.setReqIFText(text); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters