This commit is contained in:
Eugene Kudelevsky
2012-11-15 23:25:02 +01:00
parent e0666433e4
commit 2a8937a7f3
21 changed files with 723 additions and 0 deletions
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="style2">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="styl<caret>e1">
<item name="android:textColor">@android:color/black</item>
<item name="android:background">@android:color/white</item>
</style>
</resources>
@@ -0,0 +1,42 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style2"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,39 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello" style="@style/style1"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/style1"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style2"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="style2">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="style2.styl<caret>e1">
<item name="android:textColor">@android:color/black</item>
<item name="android:background">@android:color/white</item>
</style>
</resources>
@@ -0,0 +1,42 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style2"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,40 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/style2.style1"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="style2">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="style3">
<item name="android:background">@android:color/black</item>
</style>
<sty<caret>le name="style1" parent="style2">
<item name="android:textColor">@android:color/black</item>
<item name="android:background">@android:color/white</item>
</style>
</resources>
@@ -0,0 +1,49 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style2"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style3"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,47 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/style1"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style3"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="style2.style3">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="style3">
<item name="android:background">@android:color/black</item>
</style>
<sty<caret>le name="style1" parent="style2.style3">
<item name="android:textColor">@android:color/black</item>
<item name="android:background">@android:color/white</item>
</style>
</resources>
@@ -0,0 +1,49 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style2.style3"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style3"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,47 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/style1"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style3"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="style2" parent="style3">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="style3">
<item name="android:background">@android:color/black</item>
</style>
<sty<caret>le name="style1" parent="style2">
<item name="android:textColor">@android:color/black</item>
<item name="android:background">@android:color/white</item>
</style>
</resources>
@@ -0,0 +1,49 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style2"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style3"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,47 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/style1"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style3"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="style2">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="styl<caret>e1">
<item name="android:textColor">@android:color/black</item>
<item name="android:background">@android:color/white</item>
</style>
</resources>
@@ -0,0 +1,42 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style2"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,39 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello" style="@style/style1"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/style1"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style2"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="style2">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="styl<caret>e1">
<item name="android:textColor">@android:color/black</item>
<item name="android:background">@android:color/black</item>
</style>
</resources>
@@ -0,0 +1,42 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Hello"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/black"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/unknown"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style2"
android:text="Hello"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:background="@android:color/white"
style="@style/style1"
android:text="Hello"/>
</LinearLayout>
@@ -0,0 +1,70 @@
package org.jetbrains.android.refactoring;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.android.AndroidTestCase;
/**
* @author Eugene.Kudelevsky
*/
public class AndroidFindStyleApplicationsTest extends AndroidTestCase {
private static final String BASE_PATH = "refactoring/findPossibleUsages/";
public void test1() throws Exception {
doTest();
}
public void test2() throws Exception {
doTest();
}
public void test3() throws Exception {
doTest();
}
public void test4() throws Exception {
doTest();
}
public void test5() throws Exception {
doTest();
}
public void test6() throws Exception {
final String testName = getTestName(true);
myFixture.copyFileToProject(BASE_PATH + testName + "_layout.xml", "res/layout/layout1.xml");
myFixture.copyFileToProject(BASE_PATH + testName + "_layout.xml", "res/layout/layout2.xml");
doTest1();
myFixture.checkResultByFile("res/layout/layout1.xml", BASE_PATH + testName + "_layout_after.xml", true);
myFixture.checkResultByFile("res/layout/layout2.xml", BASE_PATH + testName + "_layout_after.xml", true);
}
public void test7() throws Exception {
try {
doTest();
fail();
}
catch (RuntimeException e) {
assertEquals("IDEA has not found any possible applications of style 'style1'", e.getMessage());
}
}
private void doTest() {
final String testName = getTestName(true);
myFixture.copyFileToProject(BASE_PATH + testName + "_layout.xml", "res/layout/layout.xml");
doTest1();
myFixture.checkResultByFile("res/layout/layout.xml", BASE_PATH + testName + "_layout_after.xml", true);
}
private void doTest1() {
final String testName = getTestName(true);
final VirtualFile f = myFixture.copyFileToProject(BASE_PATH + testName + ".xml", "res/values/styles.xml");
myFixture.configureFromExistingVirtualFile(f);
myFixture.testAction(new AndroidFindStyleApplicationsAction(new AndroidFindStyleApplicationsAction.MyTestConfig(
AndroidFindStyleApplicationsProcessor.MyScope.PROJECT)));
myFixture.checkResultByFile(BASE_PATH + testName + ".xml");
}
}