add android goto declaration test stub
This commit is contained in:
committed by
Yan Zhulanow
parent
537933d145
commit
7c4661aba5
@@ -146,6 +146,7 @@ import org.jetbrains.jet.lang.resolve.android.AbstractAndroidXml2KConversionTest
|
||||
import org.jetbrains.jet.android.AbstractCrossParserTest
|
||||
import org.jetbrains.jet.lang.resolve.android.AbstractAndroidBoxTest
|
||||
import org.jetbrains.jet.android.AbstractAndroidCompletionTest
|
||||
import org.jetbrains.jet.android.AbstractAndroidGotoTest
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
@@ -715,6 +716,10 @@ fun main(args: Array<String>) {
|
||||
testClass(javaClass<AbstractAndroidCompletionTest>()) {
|
||||
model("android/completion", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractAndroidGotoTest>()) {
|
||||
model("android/goto", recursive = false, extension = null)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("idea/tests", "compiler/testData") {
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.app.Activity
|
||||
|
||||
|
||||
class MyActivity: Activity() {
|
||||
val button = this.log<caret>
|
||||
val button = this.login<caret>
|
||||
}
|
||||
|
||||
// EXIST: login
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<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" >
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
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.login<caret>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.android
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.android.SdkConstants
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase
|
||||
import com.intellij.codeInsight.navigation.actions.GotoDeclarationAction
|
||||
import kotlin.test.fail
|
||||
|
||||
public abstract class AbstractAndroidGotoTest : KotlinAndroidTestCase() {
|
||||
|
||||
override fun setUp() {
|
||||
System.setProperty(KotlinAndroidTestCaseBase.SDK_PATH_PROPERTY, PathManager.getHomePath() + "/androidSDK/")
|
||||
System.setProperty(KotlinAndroidTestCaseBase.PLATFORM_DIR_PROPERTY, "android-17")
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
override fun getTestDataPath(): String {
|
||||
return PluginTestCaseBase.getTestDataPathBase() + "/android/goto/" + getTestName(true) + "/"
|
||||
}
|
||||
|
||||
override fun createManifest() {
|
||||
myFixture!!.copyFileToProject("idea/testData/android/AndroidManifest.xml", SdkConstants.FN_ANDROID_MANIFEST_XML)
|
||||
}
|
||||
|
||||
override fun requireRecentSdk() = true
|
||||
|
||||
public fun doTest(path: String) {
|
||||
val f = myFixture!!
|
||||
f.copyDirectoryToProject(getResDir()!!, "res")
|
||||
f.configureByFile(path + getTestName(true) + ".kt");
|
||||
|
||||
val asf = GotoDeclarationAction.findTargetElement(f.getProject(), f.getEditor(), f.getCaretOffset())
|
||||
f.getEditor().toString()
|
||||
fail("this test doesn't work yet")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.android;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/testData/android/goto")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class AndroidGotoTestGenerated extends AbstractAndroidGotoTest {
|
||||
public void testAllFilesPresentInGoto() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/goto"), Pattern.compile("^([^\\.]+)$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("simple")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/android/goto/simple/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user