From 7d4c7044b0b6b4d3fca0bf72234656738f100fe4 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Thu, 12 Dec 2024 20:15:24 +0100 Subject: [PATCH 1/9] Update to 2024.3 --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 209ff7a64..7412250e6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -96,7 +96,7 @@ dependencies { testFramework(TestFrameworkType.Platform) testFramework(TestFrameworkType.Plugin.Java) - intellijIdeaCommunity("2024.2.3") + intellijIdeaCommunity("2024.3.1") // Docs: https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties // All snapshot versions: https://www.jetbrains.com/intellij-repository/snapshots/ From ffc5181a02d7c1f48e8ed91c7903f397a8eba226 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Fri, 13 Dec 2024 10:59:34 +0100 Subject: [PATCH 2/9] Replace deprecated FileTypeDescriptor --- .../run/bibtex/BibtexSettingsEditor.kt | 6 ++++-- .../externaltool/ExternalToolSettingsEditor.kt | 6 ++++-- .../run/latex/ui/LatexSettingsEditor.kt | 17 ++++++++++------- .../run/makeindex/MakeindexSettingsEditor.kt | 6 ++++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/nl/hannahsten/texifyidea/run/bibtex/BibtexSettingsEditor.kt b/src/nl/hannahsten/texifyidea/run/bibtex/BibtexSettingsEditor.kt index f029f3450..0b3ea053c 100644 --- a/src/nl/hannahsten/texifyidea/run/bibtex/BibtexSettingsEditor.kt +++ b/src/nl/hannahsten/texifyidea/run/bibtex/BibtexSettingsEditor.kt @@ -2,7 +2,7 @@ package nl.hannahsten.texifyidea.run.bibtex import com.intellij.execution.configuration.EnvironmentVariablesComponent import com.intellij.openapi.fileChooser.FileChooserDescriptor -import com.intellij.openapi.fileChooser.FileTypeDescriptor +import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory import com.intellij.openapi.options.SettingsEditor import com.intellij.openapi.project.Project import com.intellij.openapi.roots.ProjectRootManager @@ -108,7 +108,9 @@ class BibtexSettingsEditor(private val project: Project) : SettingsEditor Date: Fri, 13 Dec 2024 11:10:26 +0100 Subject: [PATCH 3/9] Copy deleted MockInlineMethodOptions --- .../texifyidea/refactoring/InlineFileTest.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/nl/hannahsten/texifyidea/refactoring/InlineFileTest.kt b/test/nl/hannahsten/texifyidea/refactoring/InlineFileTest.kt index d2a3f68e9..1bc3243bc 100644 --- a/test/nl/hannahsten/texifyidea/refactoring/InlineFileTest.kt +++ b/test/nl/hannahsten/texifyidea/refactoring/InlineFileTest.kt @@ -6,10 +6,8 @@ import com.intellij.openapi.util.io.FileUtilRt import com.intellij.openapi.vfs.CharsetToolkit import com.intellij.psi.PsiFileFactory import com.intellij.refactoring.BaseRefactoringProcessor.ConflictsInTestsException -import com.intellij.refactoring.MockInlineMethodOptions import com.intellij.refactoring.inline.InlineOptions import com.intellij.testFramework.LightPlatformCodeInsightTestCase -import junit.framework.TestCase import nl.hannahsten.texifyidea.file.LatexFileType import nl.hannahsten.texifyidea.refactoring.inlinecommand.LatexInlineCommandHandler.Util.getReference import nl.hannahsten.texifyidea.refactoring.inlinefile.LatexInlineFileHandler.Util.canInlineLatexElement @@ -127,7 +125,7 @@ class InlineFileTest : LightPlatformCodeInsightTestCase() { private fun configure(testIndex: Int? = null): String { @NonNls val fileName = getTestName(false) + (testIndex ?: "") + ".tex" configureByFile(fileName) - TestCase.assertTrue(file.parent != null) + assertTrue(file.parent != null) if (file.parent?.children?.any { it.containingFile.name == inlineFile } == false) { val ioFile = File(testDataPath + inlineFile) checkCaseSensitiveFS(testDataPath + inlineFile, ioFile) @@ -182,4 +180,12 @@ class InlineFileTest : LightPlatformCodeInsightTestCase() { ) processor.run() } + + open class MockInlineMethodOptions : InlineOptions { + override fun isInlineThisOnly() = false + + override fun close(p0: Int) {} + + override fun isPreviewUsages() = false + } } \ No newline at end of file From 09bf0159076103a4f2e5557a84ef75ef5d2dbcbe Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Sat, 14 Dec 2024 12:00:31 +0100 Subject: [PATCH 4/9] Move test file to avoid "VfsRootAccess$VfsRootAccessNotAllowedError: File accessed outside allowed roots" --- .../latex/probablebugs/LatexFileNotFoundInspectionTest.kt | 2 +- test/resources/completion/path/myOtherPicture.PNG | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 test/resources/completion/path/myOtherPicture.PNG diff --git a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt index fe159a676..5577fa4b5 100644 --- a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt +++ b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt @@ -40,7 +40,7 @@ class LatexFileNotFoundInspectionTest : TexifyInspectionTestBase(LatexFileNotFou } fun testValidAbsolutePathCaps() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/inspections/latex/filenotfound/myOtherPicture.PNG}""") + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myOtherPicture.PNG}""") myFixture.checkHighlighting() } diff --git a/test/resources/completion/path/myOtherPicture.PNG b/test/resources/completion/path/myOtherPicture.PNG new file mode 100644 index 000000000..e69de29bb From 25b94024af526aa29384dcea886106accebd72fb Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Sat, 14 Dec 2024 12:13:26 +0100 Subject: [PATCH 5/9] Move file to avoid other test failure --- .../latex/probablebugs/LatexFileNotFoundInspectionTest.kt | 2 +- .../completion/path/{ => filenotfound}/myOtherPicture.PNG | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename test/resources/completion/path/{ => filenotfound}/myOtherPicture.PNG (100%) diff --git a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt index 5577fa4b5..6c744ed9b 100644 --- a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt +++ b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt @@ -40,7 +40,7 @@ class LatexFileNotFoundInspectionTest : TexifyInspectionTestBase(LatexFileNotFou } fun testValidAbsolutePathCaps() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myOtherPicture.PNG}""") + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/filenotfound/myOtherPicture.PNG}""") myFixture.checkHighlighting() } diff --git a/test/resources/completion/path/myOtherPicture.PNG b/test/resources/completion/path/filenotfound/myOtherPicture.PNG similarity index 100% rename from test/resources/completion/path/myOtherPicture.PNG rename to test/resources/completion/path/filenotfound/myOtherPicture.PNG From 541ff3c5a21220bef9e300a19b17dbf1b35942a6 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Sat, 14 Dec 2024 12:37:42 +0100 Subject: [PATCH 6/9] Revert "Move file to avoid other test failure" This reverts commit 25b94024af526aa29384dcea886106accebd72fb. --- .../latex/probablebugs/LatexFileNotFoundInspectionTest.kt | 2 +- .../completion/path/{filenotfound => }/myOtherPicture.PNG | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename test/resources/completion/path/{filenotfound => }/myOtherPicture.PNG (100%) diff --git a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt index 6c744ed9b..5577fa4b5 100644 --- a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt +++ b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt @@ -40,7 +40,7 @@ class LatexFileNotFoundInspectionTest : TexifyInspectionTestBase(LatexFileNotFou } fun testValidAbsolutePathCaps() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/filenotfound/myOtherPicture.PNG}""") + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myOtherPicture.PNG}""") myFixture.checkHighlighting() } diff --git a/test/resources/completion/path/filenotfound/myOtherPicture.PNG b/test/resources/completion/path/myOtherPicture.PNG similarity index 100% rename from test/resources/completion/path/filenotfound/myOtherPicture.PNG rename to test/resources/completion/path/myOtherPicture.PNG From 86c85327c13f9f4f10b07b9d6f9d71dbdd31befd Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Sat, 14 Dec 2024 12:37:42 +0100 Subject: [PATCH 7/9] Revert "Move test file to avoid "VfsRootAccess$VfsRootAccessNotAllowedError: File accessed outside allowed roots"" This reverts commit 09bf0159076103a4f2e5557a84ef75ef5d2dbcbe. --- .../latex/probablebugs/LatexFileNotFoundInspectionTest.kt | 2 +- test/resources/completion/path/myOtherPicture.PNG | 0 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 test/resources/completion/path/myOtherPicture.PNG diff --git a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt index 5577fa4b5..fe159a676 100644 --- a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt +++ b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt @@ -40,7 +40,7 @@ class LatexFileNotFoundInspectionTest : TexifyInspectionTestBase(LatexFileNotFou } fun testValidAbsolutePathCaps() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myOtherPicture.PNG}""") + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/inspections/latex/filenotfound/myOtherPicture.PNG}""") myFixture.checkHighlighting() } diff --git a/test/resources/completion/path/myOtherPicture.PNG b/test/resources/completion/path/myOtherPicture.PNG deleted file mode 100644 index e69de29bb..000000000 From a0cf1f2fb0ce6db4247a63de200b2d9269e11322 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Sat, 14 Dec 2024 14:19:06 +0100 Subject: [PATCH 8/9] Another attempt to work around gh actions failure --- .../latex/probablebugs/LatexFileNotFoundInspectionTest.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt index fe159a676..9cc87d176 100644 --- a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt +++ b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt @@ -3,6 +3,7 @@ package nl.hannahsten.texifyidea.inspections.latex.probablebugs import io.mockk.every import io.mockk.mockkStatic import nl.hannahsten.texifyidea.file.LatexFileType +import nl.hannahsten.texifyidea.gutter.LatexNavigationGutter import nl.hannahsten.texifyidea.inspections.TexifyInspectionTestBase import nl.hannahsten.texifyidea.util.runCommandWithExitCode import java.io.File @@ -22,6 +23,8 @@ class LatexFileNotFoundInspectionTest : TexifyInspectionTestBase(LatexFileNotFou super.setUp() mockkStatic(::runCommandWithExitCode) every { runCommandWithExitCode(*anyVararg(), workingDirectory = any(), timeout = any(), returnExceptionMessage = any()) } returns Pair(null, 0) + + mockkStatic(LatexNavigationGutter::collectNavigationMarkers) } override fun getTestDataPath(): String { From 12512a247a873454952f574cc1644a95036b10dd Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Sun, 15 Dec 2024 11:52:52 +0100 Subject: [PATCH 9/9] Disable some broken tests on Windows --- .../LatexFileNotFoundInspectionTest.kt | 50 +++++++++++++------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt index 9cc87d176..f3a7322f3 100644 --- a/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt +++ b/test/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspectionTest.kt @@ -1,5 +1,6 @@ package nl.hannahsten.texifyidea.inspections.latex.probablebugs +import com.intellij.openapi.util.SystemInfo import io.mockk.every import io.mockk.mockkStatic import nl.hannahsten.texifyidea.file.LatexFileType @@ -32,29 +33,40 @@ class LatexFileNotFoundInspectionTest : TexifyInspectionTestBase(LatexFileNotFou } fun testMissingAbsolutePath() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myPicture.myinvalidextension}""") - myFixture.checkHighlighting() + // Avoid "VfsRootAccess$VfsRootAccessNotAllowedError: File accessed outside allowed roots" on Windows in github actions + if (!SystemInfo.isWindows) { + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myPicture.myinvalidextension}""") + myFixture.checkHighlighting() + } } fun testValidAbsolutePath() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myPicture.png}""") + if (!SystemInfo.isWindows) { + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myPicture.png}""") - myFixture.checkHighlighting() + myFixture.checkHighlighting() + } } fun testValidAbsolutePathCaps() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/inspections/latex/filenotfound/myOtherPicture.PNG}""") - myFixture.checkHighlighting() + if (!SystemInfo.isWindows) { + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/inspections/latex/filenotfound/myOtherPicture.PNG}""") + myFixture.checkHighlighting() + } } fun testBackActionAbsolute() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/../path/../path/myPicture.png}""") - myFixture.checkHighlighting() + if (!SystemInfo.isWindows) { + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/../path/../path/myPicture.png}""") + myFixture.checkHighlighting() + } } fun testCurrDirActionAbsolute() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/./resources/./././completion/path/././myPicture.png}""") - myFixture.checkHighlighting() + if (!SystemInfo.isWindows) { + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/./resources/./././completion/path/././myPicture.png}""") + myFixture.checkHighlighting() + } } fun testAbsoluteGraphicsDirWithInclude() { @@ -84,19 +96,25 @@ class LatexFileNotFoundInspectionTest : TexifyInspectionTestBase(LatexFileNotFou } fun testDefaultExtensionCompletion() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myPicture}""") - myFixture.checkHighlighting() + if (!SystemInfo.isWindows) { + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myPicture}""") + myFixture.checkHighlighting() + } } fun testDefaultUpperCaseExtensionCompletion() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/inspections/latex/filenotfound/myOtherPicture}""") - myFixture.checkHighlighting() + if (!SystemInfo.isWindows) { + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/inspections/latex/filenotfound/myOtherPicture}""") + myFixture.checkHighlighting() + } } fun testDefaultMixedCaseExtensionCompletion() { - myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myBadPicture}""") + if (!SystemInfo.isWindows) { + myFixture.configureByText(LatexFileType, """\includegraphics{$absoluteWorkingPath/test/resources/completion/path/myBadPicture}""") - myFixture.checkHighlighting() + myFixture.checkHighlighting() + } } fun testNoWarningInDefinition() {