-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #226 from LorenzoBettini/task_217-Outline_should_h…
…ighlight_modified_elements Task 217 outline should highlight modified elements
- Loading branch information
Showing
14 changed files
with
286 additions
and
22 deletions.
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
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
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
68 changes: 68 additions & 0 deletions
68
edelta.parent/edelta.ui.tests/src/edelta/ui/tests/EdeltaLabelProviderTest.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,68 @@ | ||
package edelta.ui.tests; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.eclipse.emf.ecore.EcoreFactory; | ||
import org.eclipse.emf.ecore.resource.Resource; | ||
import org.eclipse.jface.viewers.StyledString; | ||
import org.eclipse.xtext.testing.InjectWith; | ||
import org.eclipse.xtext.testing.XtextRunner; | ||
import org.eclipse.xtext.testing.util.ParseHelper; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import com.google.inject.Inject; | ||
|
||
import edelta.edelta.EdeltaProgram; | ||
import edelta.resource.derivedstate.EdeltaDerivedStateHelper; | ||
import edelta.ui.labeling.EdeltaLabelProvider; | ||
|
||
@RunWith(XtextRunner.class) | ||
@InjectWith(EdeltaUiInjectorProvider.class) | ||
public class EdeltaLabelProviderTest { | ||
|
||
@Inject | ||
private EdeltaLabelProvider labelProvider; | ||
|
||
@Inject | ||
private EdeltaDerivedStateHelper derivedStateHelper; | ||
|
||
@Inject | ||
private ParseHelper<EdeltaProgram> parseHelper; | ||
|
||
private Resource resource; | ||
|
||
private static EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE; | ||
|
||
@Before | ||
public void setup() throws Exception { | ||
resource = parseHelper.parse("").eResource(); | ||
} | ||
|
||
@Test | ||
public void testEPackageStyledString() { | ||
var ePackage = ecoreFactory.createEPackage(); | ||
resource.getContents().add(ePackage); | ||
StyledString styledText = labelProvider.getStyledText(ePackage); | ||
assertThat(styledText.getStyleRanges()).isEmpty(); | ||
} | ||
|
||
@Test | ||
public void testStyledStringWhenNotModified() { | ||
var element = ecoreFactory.createEClass(); | ||
resource.getContents().add(element); | ||
StyledString styledText = labelProvider.getStyledText(element); | ||
assertThat(styledText.getStyleRanges()).isEmpty(); | ||
} | ||
|
||
@Test | ||
public void testStyledStringWhenModified() { | ||
var element = ecoreFactory.createEClass(); | ||
element.setName("aclass"); | ||
resource.getContents().add(element); | ||
derivedStateHelper.getModifiedElements(resource).add(element); | ||
StyledString styledText = labelProvider.getStyledText(element); | ||
assertThat(styledText.getStyleRanges()).isNotEmpty(); | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.