add all goto tests
- fix base test case failing when no res directory present - get rid of JetProperty -> XmlAttr caching
This commit is contained in:
committed by
Yan Zhulanow
parent
04a905c35c
commit
65ef880dd3
@@ -66,9 +66,16 @@ public class IDEAndroidResourceManager(project: Project, searchPath: String?) :
|
|||||||
idToXmlAttributeCache.clear()
|
idToXmlAttributeCache.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun idToXmlAttribute(id: String): PsiElement? {
|
override fun idToXmlAttribute(searchId: String): PsiElement? {
|
||||||
val element = idToXmlAttributeCache[id]
|
// val element = idToXmlAttributeCache[id]
|
||||||
return element
|
// return element
|
||||||
|
var ret: PsiElement? = null
|
||||||
|
for (file in getLayoutXmlFiles()) {
|
||||||
|
file.accept(AndroidXmlVisitor(this, { id, wClass, valueElement ->
|
||||||
|
if (searchId == id) ret = valueElement
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renameXmlAttr(elem: PsiElement, newName: String) {
|
override fun renameXmlAttr(elem: PsiElement, newName: String) {
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.myapp
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
|
||||||
|
|
||||||
|
class MyActivity: Activity() {
|
||||||
|
val button = this.MyButton<caret>
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ItemDetailActivity"
|
||||||
|
tools:ignore="MergeRootFrame" >
|
||||||
|
|
||||||
|
<view
|
||||||
|
class="org.my.cool.Button"
|
||||||
|
android:id="@+id/MyButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Sign in" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.myapp
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
|
||||||
|
|
||||||
|
class MyActivity: Activity() {
|
||||||
|
val button = this.MyButton<caret>
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ItemDetailActivity"
|
||||||
|
tools:ignore="MergeRootFrame" >
|
||||||
|
|
||||||
|
<org.my.cool.Button
|
||||||
|
android:id="@+id/MyButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Sign in" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.myapp
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
|
||||||
|
|
||||||
|
class MyActivity: Activity() {
|
||||||
|
val button = this.login<caret>
|
||||||
|
val button1 = this.loginButton
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/item_detail_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ItemDetailActivity"
|
||||||
|
tools:ignore="MergeRootFrame" >
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Enter your password" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/password"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="textPassword" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/login"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Sign in" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/frameLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ItemDetailActivity"
|
||||||
|
tools:ignore="MergeRootFrame" >
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/passwordField"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Enter your password" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/passwordCaption"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="textPassword" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/loginButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Sign in" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -22,7 +22,6 @@ import junit.framework.TestSuite;
|
|||||||
import org.jetbrains.jet.JetTestUtils;
|
import org.jetbrains.jet.JetTestUtils;
|
||||||
import org.jetbrains.jet.test.InnerTestClasses;
|
import org.jetbrains.jet.test.InnerTestClasses;
|
||||||
import org.jetbrains.jet.test.TestMetadata;
|
import org.jetbrains.jet.test.TestMetadata;
|
||||||
import org.junit.Ignore;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -36,6 +35,24 @@ public class AndroidGotoTestGenerated extends AbstractAndroidGotoTest {
|
|||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/goto"), Pattern.compile("^([^\\.]+)$"), false);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/goto"), Pattern.compile("^([^\\.]+)$"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fqNameInAttr")
|
||||||
|
public void testFqNameInAttr() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/android/goto/fqNameInAttr/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fqNameInTag")
|
||||||
|
public void testFqNameInTag() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/android/goto/fqNameInTag/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("multiFile")
|
||||||
|
public void testMultiFile() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/android/goto/multiFile/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simple")
|
@TestMetadata("simple")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/android/goto/simple/");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/android/goto/simple/");
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import com.intellij.psi.PsiManager;
|
|||||||
import com.intellij.psi.impl.PsiManagerEx;
|
import com.intellij.psi.impl.PsiManagerEx;
|
||||||
import com.intellij.psi.impl.file.impl.FileManager;
|
import com.intellij.psi.impl.file.impl.FileManager;
|
||||||
import com.intellij.testFramework.InspectionTestUtil;
|
import com.intellij.testFramework.InspectionTestUtil;
|
||||||
|
import com.intellij.testFramework.TestLogger;
|
||||||
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
|
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
|
||||||
import com.intellij.testFramework.fixtures.*;
|
import com.intellij.testFramework.fixtures.*;
|
||||||
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
|
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
|
||||||
@@ -123,8 +124,11 @@ public abstract class KotlinAndroidTestCase extends KotlinAndroidTestCaseBase {
|
|||||||
|
|
||||||
androidSdk = createAndroidSdk(getTestSdkPath(), getPlatformDir());
|
androidSdk = createAndroidSdk(getTestSdkPath(), getPlatformDir());
|
||||||
myFacet = addAndroidFacet(myModule, sdkPath, getPlatformDir(), isToAddSdk());
|
myFacet = addAndroidFacet(myModule, sdkPath, getPlatformDir(), isToAddSdk());
|
||||||
myFixture.copyDirectoryToProject(getResDir(), "res");
|
if (new File(getResDir()).exists()) {
|
||||||
|
myFixture.copyDirectoryToProject(getResDir(), "res");
|
||||||
|
} else {
|
||||||
|
TestLogger.getInstance(this.getClass()).info("No res directory found in test");
|
||||||
|
}
|
||||||
myAdditionalModules = new ArrayList<Module>();
|
myAdditionalModules = new ArrayList<Module>();
|
||||||
|
|
||||||
for (MyAdditionalModuleData data : modules) {
|
for (MyAdditionalModuleData data : modules) {
|
||||||
|
|||||||
Reference in New Issue
Block a user