mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
[gui-tests] GUI-155 move ProjectCreation definition from GuiTestUtil to GuiTestOptions
add additional projectDirPath among with tempDirPath
This commit is contained in:
+2
-19
@@ -32,6 +32,7 @@ import com.intellij.testGuiFramework.impl.GuiRobotHolder
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt.getComponentText
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt.isTextComponent
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions
|
||||
import com.intellij.testGuiFramework.matcher.ClassNameMatcher
|
||||
import com.intellij.testGuiFramework.util.*
|
||||
import com.intellij.ui.KeyStrokeAdapter
|
||||
@@ -89,7 +90,6 @@ object GuiTestUtil {
|
||||
val TEST_DATA_DIR = "GUI_TEST_DATA_DIR"
|
||||
val FIRST_START = "GUI_FIRST_START"
|
||||
private val SYSTEM_EVENT_QUEUE = Toolkit.getDefaultToolkit().systemEventQueue
|
||||
val projectCreationDirPath = createTempProjectCreationDir()
|
||||
|
||||
val gradleHomePath: File?
|
||||
get() = getFilePathProperty("supported.gradle.home.path", "the path of a local Gradle 2.2.1 distribution", true)
|
||||
@@ -179,7 +179,7 @@ object GuiTestUtil {
|
||||
}
|
||||
|
||||
fun setUpDefaultProjectCreationLocationPath() {
|
||||
RecentProjectsManager.getInstance().lastProjectCreationLocation = PathUtil.toSystemIndependentName(projectCreationDirPath.path)
|
||||
RecentProjectsManager.getInstance().lastProjectCreationLocation = PathUtil.toSystemIndependentName(GuiTestOptions.projectDirPath.path)
|
||||
}
|
||||
|
||||
// Called by IdeTestApplication via reflection.
|
||||
@@ -344,23 +344,6 @@ object GuiTestUtil {
|
||||
|
||||
}
|
||||
|
||||
private fun createTempProjectCreationDir(): File {
|
||||
try {
|
||||
// The temporary location might contain symlinks, such as /var@ -> /private/var on MacOS.
|
||||
// EditorFixture seems to require a canonical path when opening the file.
|
||||
return File(
|
||||
System.getProperty("teamcity.build.tempDir", System.getProperty("java.io.tmpdir")),
|
||||
"guiTest"
|
||||
).canonicalFile
|
||||
}
|
||||
catch (ex: IOException) {
|
||||
// For now, keep the original behavior and point inside the source tree.
|
||||
ex.printStackTrace()
|
||||
return File(testProjectsRootDirPath, "newProjects")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun deleteFile(file: VirtualFile?) {
|
||||
// File deletion must happen on UI thread under write lock
|
||||
if (file != null) {
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@ import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.impl.ApplicationImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.lang.UrlClassLoader;
|
||||
import com.intellij.util.text.StringTokenizer;
|
||||
@@ -116,7 +117,7 @@ public class IdeTestApplication {
|
||||
ourInstance = new IdeTestApplication();
|
||||
if (isDefaultConfig) recreateDirectory(configDirPath);
|
||||
|
||||
File newProjectsRootDirPath = GuiTestUtil.INSTANCE.getProjectCreationDirPath();
|
||||
File newProjectsRootDirPath = GuiTestOptions.INSTANCE.getProjectDirPath();
|
||||
recreateDirectory(newProjectsRootDirPath);
|
||||
|
||||
ClassLoader ideClassLoader = ourInstance.getIdeClassLoader();
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.testGuiFramework.framework.Timeouts
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt.computeOnEdt
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt.runOnEdt
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt.waitUntil
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions.screenRecorderJarDirPath
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions.testsToRecord
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions.videoDuration
|
||||
@@ -436,12 +437,12 @@ class GuiTestRule : TestRule {
|
||||
}
|
||||
|
||||
|
||||
fun getMasterProjectDirPath(projectDirName: String): File {
|
||||
private fun getMasterProjectDirPath(projectDirName: String): File {
|
||||
return File(GuiTestUtil.testProjectsRootDirPath, projectDirName)
|
||||
}
|
||||
|
||||
fun getTestProjectDirPath(projectDirName: String): File {
|
||||
return File(GuiTestUtil.projectCreationDirPath, projectDirName)
|
||||
private fun getTestProjectDirPath(projectDirName: String): File {
|
||||
return File(GuiTestOptions.projectDirPath, projectDirName)
|
||||
}
|
||||
|
||||
fun cleanUpProjectForImport(projectPath: File) {
|
||||
|
||||
+1
@@ -250,6 +250,7 @@ object GuiTestLocalLauncher {
|
||||
.plus("-Xrunjdwp:transport=dt_socket,server=y,suspend=${GuiTestOptions.suspendDebug},address=${GuiTestOptions.debugPort}")
|
||||
.plus("-Duse.linux.keychain=false")
|
||||
.plus("-Didea.suppress.statistics.report")
|
||||
.plus("-Djava.io.tmpdir=${GuiTestOptions.tempDirPath}")
|
||||
}
|
||||
|
||||
private fun getCurrentJavaExec(): String {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.testGuiFramework.launcher
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import java.io.File
|
||||
|
||||
object GuiTestOptions {
|
||||
|
||||
@@ -68,6 +69,13 @@ object GuiTestOptions {
|
||||
}
|
||||
}
|
||||
|
||||
val tempDirPath: File by lazy { File(System.getProperty("teamcity.build.tempDir", System.getProperty("java.io.tmpdir"))) }
|
||||
val projectDirPath: File by lazy {
|
||||
// The temporary location might contain symlinks, such as /var@ -> /private/var on MacOS.
|
||||
// EditorFixture seems to require a canonical path when opening the file.
|
||||
File(tempDirPath, "guiTest").canonicalFile
|
||||
}
|
||||
|
||||
private inline fun <reified ReturnType> getSystemProperty(key: String, defaultValue: ReturnType): ReturnType {
|
||||
val value = System.getProperty(key) ?: return defaultValue
|
||||
return when (defaultValue) {
|
||||
|
||||
Reference in New Issue
Block a user