Skip to content

Commit

Permalink
[#930] fix broken semantic highlight unit test (#940)
Browse files Browse the repository at this point in the history
* [#930] fix broken semantic highlight unit test

due to the
eclipse/tm4e@5c780dc
commit in tm4e the unit test fails.

fixes #930

* issue fixed in tm4e

* Add color check

* Use tm4e snapshot version to fix unit test

* Use tm4e release until next release

* fix copy and paste error
  • Loading branch information
ghentschke committed Mar 5, 2024
1 parent 4d1f527 commit 31780c6
Showing 1 changed file with 16 additions and 7 deletions.
Expand Up @@ -8,7 +8,8 @@
*******************************************************************************/
package org.eclipse.lsp4e.test.semanticTokens;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -61,12 +62,20 @@ public void testKeyword() throws CoreException {
DisplayHelper.sleep(display, 2_000); // Give some time to the editor to update

StyleRange[] styleRanges = textViewer.getTextWidget().getStyleRanges();
var backgroundColor = textViewer.getTextWidget().getBackground();

List<StyleRange> expectedStyleRanges = Arrays.asList(//
new StyleRange(0, 4, SemanticTokensTestUtil.GREEN, null), //
new StyleRange(15, 4, SemanticTokensTestUtil.GREEN, null), //
new StyleRange(24, 7, SemanticTokensTestUtil.GREEN, null)//
);
assertArrayEquals(expectedStyleRanges.toArray(), styleRanges);
assertEquals(3, styleRanges.length);

assertEquals(0, styleRanges[0].start);
assertEquals(4, styleRanges[0].length);
assertNotEquals(styleRanges[0].foreground, backgroundColor);

assertEquals(15, styleRanges[1].start);
assertEquals(4, styleRanges[1].length);
assertNotEquals(styleRanges[1].foreground, backgroundColor);

assertEquals(24, styleRanges[2].start);
assertEquals(7, styleRanges[2].length);
assertNotEquals(styleRanges[2].foreground, backgroundColor);
}
}

0 comments on commit 31780c6

Please sign in to comment.