From 31780c6b56ce1a320b19659ef917c95f72fba3fa Mon Sep 17 00:00:00 2001 From: "G. Hentschke" <123444711+ghentschke@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:08:55 +0100 Subject: [PATCH] [#930] fix broken semantic highlight unit test (#940) * [#930] fix broken semantic highlight unit test due to the https://github.com/eclipse/tm4e/commit/5c780dc312c764f59c1a3d52202e6f135840030c 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 --- ...manticHighlightReconcilerStrategyTest.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/semanticTokens/SemanticHighlightReconcilerStrategyTest.java b/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/semanticTokens/SemanticHighlightReconcilerStrategyTest.java index 61c023dc3..81c2be1cc 100644 --- a/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/semanticTokens/SemanticHighlightReconcilerStrategyTest.java +++ b/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/semanticTokens/SemanticHighlightReconcilerStrategyTest.java @@ -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; @@ -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 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); } }