Move Android compiler plugin tests to android-compiler-plugin module

This commit is contained in:
Yan Zhulanow
2014-11-06 15:20:20 +03:00
parent efff642635
commit fa62d3bcec
63 changed files with 70 additions and 79 deletions
@@ -0,0 +1,57 @@
package com.myapp
import android.app.Activity
import android.view.View
import android.widget.*
class R {
class id {
class object {
val item_detail_container = 0
val textView1 = 1
val password = 2
val textView2 = 3
val passwordConfirmation = 4
val login = 5
val passwordField = 6
val passwordCaption = 7
val loginButton = 8
}
}
}
class MyActivity(): Activity() {
val textViewWidget = TextView(this)
val editTextWidget = EditText(this)
val buttonWidget = Button(this)
val textViewWidget2 = TextView(this)
val editTextWidget2 = EditText(this)
val buttonWidget2 = Button(this)
override fun findViewById(id: Int): View? {
return when (id) {
R.id.textView1 -> textViewWidget
R.id.password -> editTextWidget
R.id.login -> buttonWidget
R.id.passwordField -> textViewWidget2
R.id.passwordCaption -> editTextWidget2
R.id.loginButton -> buttonWidget2
else -> null
}
}
public fun box(): String{
return if (textView1.toString() == "TextView" &&
password.toString() == "EditText" &&
login.toString() == "Button" &&
passwordField.toString() == "TextView" &&
passwordCaption.toString() == "EditText" &&
loginButton.toString() == "Button")
"OK" else ""
}
}
fun box(): String {
return MyActivity().box()
}
@@ -0,0 +1,37 @@
package com.myapp
import android.app.Activity
import android.view.View
import android.widget.*
class R {
class id {
class object {
val item_detail_container = 0
val textView1 = 1
val password = 2
val textView2 = 3
val passwordConfirmation = 4
val login = 5
}
}
}
class MyActivity(): Activity() {
val textViewWidget = TextView(this)
val editTextWidget = EditText(this)
val buttonWidget = Button(this)
override fun findViewById(id: Int): View? {
return when (id) {
R.id.textView1 -> textViewWidget
R.id.password -> editTextWidget
R.id.login -> buttonWidget
else -> null
}
}
}
fun box(): String {
return "OK"
}
@@ -0,0 +1,33 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
<permission android:name="android"></permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sample" >
<activity
android:name="com.example.android.basiccontactables.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop">
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
@@ -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>