aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.tests
diff options
context:
space:
mode:
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.tests')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/.settings/org.eclipse.jdt.core.prefs64
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptParserTest.java200
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java283
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java836
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadataTest.java191
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java744
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeLayoutRefactoringTest.java85
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeViewRefactoringTest.java59
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractIncludeRefactoringTest.java146
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractStyleRefactoringTest.java230
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringAssistantTest.java127
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringTest.java299
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/WrapInRefactoringTest.java59
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror1.xml12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror2.xml9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror3.xml6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror4.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror5.xml6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror6.xml11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror7.xml10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion53.txt6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion54.txt6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion55.txt16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion56.txt14
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion57.txt3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1.xml20
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion58.txt4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion59.txt10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion60.txt3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion61.txt18
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1.xml27
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-applyCompletion15.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-completion20.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1.xml12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-applyCompletion16.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-completion21.txt5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2.xml12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-applyCompletion14.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-completion19.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3.xml12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion45.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46a.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46b.txt16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1.xml6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-actual-applyCompletion1.xml19
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion1.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion10.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11a.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11b.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion12.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion2.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion3.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion39.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion4.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion5.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion6.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7a.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7b.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion8.diff2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion9.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion1.txt3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion10.txt10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion11.txt60
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt60
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion2.txt4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion3.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion39.txt142
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion4.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion5.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion6.txt22
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion7a.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion7b.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion8.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion9.txt4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1.xml19
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13a.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13b.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13c.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13a.txt13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13b.txt4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13c.txt12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2.xml5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion17.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion18.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3.xml5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion4-expected-completion22.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion4.xml11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion19.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion20.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion21.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion40.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-completion40.txt142
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5.xml23
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6-expected-applyCompletion22.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7-expected-applyCompletion23.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-applyCompletion41.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion41.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion42.txt4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion43.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion44.txt10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8.xml10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24a.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24b.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion25.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion26.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion27.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion28.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion29.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion30.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion31.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion32.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion33.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion34.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion35.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion36.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion37.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion38.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion23.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion24.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion25.txt6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion26.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion27.txt13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion28.txt13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion29.txt3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion30.txt8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion31.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion32.txt293
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion33.txt3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion34.txt3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion35.txt3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion36.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion37.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion38.txt6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1.xml20
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion47.txt13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion48.txt3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion49.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion50.txt13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1.xml5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2-expected-completion51.txt10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2-expected-completion52.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2.xml5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1b.diff3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1c.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1d.diff6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract2.diff6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract3.diff15
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract4.diff7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract5.diff8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract6.diff6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract8.diff4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1.info3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1.xml11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2-expected-extract7.diff13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2.info3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2.xml11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion14.txt10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion15.txt3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion16.txt14
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion17.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion18.txt27
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate10.txt6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate11a.txt6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate11g.txt6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate9a.txt6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest.xml19
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/metadata.xml10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate1.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate12.txt6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate2.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate3.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate4.txt89
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1.xml16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-extract2.diff6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate5.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate6.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate7.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate8.txt7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles.xml28
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout1-expected-extract1.xml2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout2-expected-extract2.xml6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract3.xml2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract4.xml2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract5.xml6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract6.diff11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles-expected-extract1.diff9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles2-expected-extract1b.diff9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract1c.diff9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract8.diff9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract1d.diff9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract3.diff9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles5-expected-extract4.diff8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles6-expected-extract5.diff8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles7-expected-extract6.diff13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles8-expected-extract7.diff9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix1.xml6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix2.xml4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix3.xml8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1.xml16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2-expected-quickFix4.xml3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2.xml5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant1.txt3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant2.txt6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant3.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant4.txt2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-changeLayout1a.xml11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-changeView1.xml21
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract6.diff9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a.info13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a.xml21
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b-expected-changeLayout1b.xml45
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b.info14
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b.xml70
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeLayout2.xml11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeView2.xml13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-extract3.xml13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2.info9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2.xml13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-changeLayout3.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract1.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract2.xml6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract4.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract5.xml6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn1.xml11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn2.xml12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn3.xml11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1-expected-extract4.xml9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1-expected-extract5.xml8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1.xml10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2-expected-extract4.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2-expected-extract5.xml6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2.xml8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3.info5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4-expected-changeLayout4.xml6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4.info5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4.xml8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5-expected-changeLayout5.xml10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5.info9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5.xml12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6-expected-changeLayout6.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6.info5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract6.diff10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7.info11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7.xml19
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract6.diff15
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8.info12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8.xml40
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java328
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java281
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectCreationPage.java11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java49
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java15
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java45
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/AbsoluteLayoutRuleTest.java8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/LayoutTestBase.java11
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/TestNode.java8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtilsTest.java15
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfoTest.java132
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DomUtilitiesTest.java119
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PointTestCases.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionManagerTest.java120
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SwtUtilsTest.java60
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/ViewMetadataRepositoryTest.java28
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiElementNodeTest.java35
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/CountryCodeQualifierTest.java58
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/DockModeQualifierTest.java70
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/KeyboardStateQualifierTest.java63
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/LanguageQualifierTest.java56
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/NavigationMethodQualifierTest.java70
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/NetworkCodeQualifierTest.java58
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/PixelDensityQualifierTest.java120
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/RegionQualifierTest.java57
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenDimensionQualifierTest.java60
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenOrientationQualifierTest.java74
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenSizeQualifierTest.java71
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/TextInputMethodQualifierTest.java72
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/TouchScreenQualifierTest.java70
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java69
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/QualifierListTest.java76
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java40
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/ResourceHelperTest.java178
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/ResourceNameValidatorTest.java51
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/manager/FolderTypeRelationShipTest.java43
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/ResourceNameValidatorTest.java39
290 files changed, 7441 insertions, 1230 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..1cb4685
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,64 @@
+#Wed Mar 09 14:02:32 PST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
index 9d4285c..b6fe951 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
@@ -2,9 +2,9 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Android Plugin Tests
Bundle-SymbolicName: com.android.ide.eclipse.tests
-Bundle-Version: 10.0.0.qualifier
+Bundle-Version: 11.0.0.qualifier
Bundle-Vendor: The Android Open Source Project
-Fragment-Host: com.android.ide.eclipse.adt;bundle-version="10.0.0"
+Fragment-Host: com.android.ide.eclipse.adt;bundle-version="11.0.0"
Require-Bundle: org.junit
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: kxml2-2.3.0.jar,
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptParserTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptParserTest.java
new file mode 100644
index 0000000..af4e2b7
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptParserTest.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.build;
+
+import com.android.ide.eclipse.adt.AdtConstants;
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.List;
+
+public class AaptParserTest extends AdtProjectTest {
+
+ public void testBasic() throws Exception {
+ // Test the "at 'property' with value 'value' range matching included with most aapt errors
+ checkRanges("quickfix1.xml", "res/layout/quickfix1.xml",
+ "quickfix1.xml:7: error: Error: No resource found that matches the given name (at"
+ + " 'text' with value '@string/firststring').",
+ "android:text=\"^@string/firststring\"",
+ "android:text=\"@string/firststring^\"");
+ }
+
+ public void testRange1() throws Exception {
+ // Check that when the actual aapt error occurs on a line later than the original error
+ // line, the forward search which looks for a value match does not stop on an
+ // earlier line that happens to have the same value prefix
+ checkRanges("aapterror1.xml", "res/layout/aapterror1.xml",
+ "aapterror1.xml:5: error: Error: Integer types not allowed (at "
+ + "'layout_marginBottom' with value '50').",
+ "marginBottom=\"^50\"", "marginBottom=\"50^\"");
+ }
+
+ public void testRange2() throws Exception {
+ // Check that when we have a duplicate resource error, we highlight both the original
+ // property and the original definition.
+ // This tests the second, duplicate declaration ration.
+ checkRanges("aapterror2.xml", "res/values/aapterror2.xml",
+ "aapterror2.xml:7: error: Resource entry repeatedStyle1 already has bag item "
+ + "android:gravity.",
+ "<item name=\"^android:gravity\">bottom</item>",
+ "<item name=\"android:gravity^\">bottom</item>");
+ }
+
+ public void testRange3() throws Exception {
+ // Check that when we have a duplicate resource error, we highlight both the original
+ // property and the original definition.
+ // This tests the original definition. Note that we don't have enough position info
+ // so we simply highlight the whitespace portion of the line.
+ checkRanges("aapterror2.xml", "res/values/aapterror2.xml",
+ "aapterror2.xml:4: Originally defined here.",
+ "^<item name=\"android:gravity\">left</item>",
+ "<item name=\"android:gravity\">left</item>^");
+ }
+
+ public void testRange4() throws Exception {
+ // Check for aapt error which occurs when the attribute name in an item style declaration
+ // is nonexistent
+ checkRanges("aapterror3.xml", "res/values/aapterror3.xml",
+ "aapterror3.xml:4: error: Error: No resource found that matches the given name: "
+ + "attr 'nonexistent'.",
+ "<item name=\"^nonexistent\">5</item>",
+ "<item name=\"nonexistent^\">5</item>");
+ }
+
+ public void testRange5() throws Exception {
+ // Test missing resource name
+ checkRanges("aapterror4.xml", "res/values/aapterror4.xml",
+ "aapterror4.xml:3: error: A 'name' attribute is required for <style>",
+ "<^style>",
+ "<style^>");
+ }
+
+ public void testRange6() throws Exception {
+ checkRanges("aapterror4.xml", "res/values/aapterror4.xml",
+ "aapterror4.xml:6: error: A 'type' attribute is required for <item>",
+ "<^item></item>",
+ "<item^></item>");
+ }
+
+ public void testRange7() throws Exception {
+ // Test missing resource name
+ checkRanges("aapterror4.xml", "res/values/aapterror4.xml",
+ "aapterror4.xml:6: error: A 'name' attribute is required for <item>",
+ "<^item></item>",
+ "<item^></item>");
+ }
+
+ // This test is disabled because I can't find a useful scenario for handling this error
+ // message. When this error occurs, we will also get a warning on a missing attribute, and
+ // that warning already underlines the element name.
+ //public void testRange8() throws Exception {
+ // // Test missing resource name
+ // checkRanges("aapterror4.xml", "res/values/aapterror4.xml",
+ // "aapterror4.xml:4: error: Error: Resource id cannot be an empty string: attr ''.",
+ // " ^<item />",
+ // " <item />^");
+ //}
+
+ public void testRange9() throws Exception {
+ // Test missing resource name
+ checkRanges("aapterror5.xml", "res/values/aapterror5.xml",
+ "aapterror5.xml:4: error: Error: String types not allowed (at "
+ + "'android:layout_width' with value '').",
+ " <item name=\"^android:layout_width\"></item>",
+ " <item name=\"android:layout_width^\"></item>");
+ }
+
+ public void testRange10() throws Exception {
+ // Test missing resource name
+ checkRanges("aapterror6.xml", "res/layout/aapterror6.xml",
+ "aapterror6.xml:5: error: Error: String types not allowed (at 'layout_marginTop'"
+ + " with value '').",
+ "android:layout_marginTop=^\"\"",
+ "android:layout_marginTop=\"\"^");
+ }
+
+ public void testRange11() throws Exception {
+ // Test missing resource name
+ checkRanges("aapterror6.xml", "res/layout/aapterror6.xml",
+ "aapterror1.xml:5: error: Error: String types not allowed (at 'layout_marginLeft'"
+ + " with value '').",
+ "android:layout_marginLeft=^''",
+ "android:layout_marginLeft=''^");
+ }
+
+ public void testRange12() throws Exception {
+ // Test missing resource name
+ checkRanges("aapterror7.xml", "res/layout/aapterror7.xml",
+ "aapterror7.xml:5: error: Error: String types not allowed (at 'id'"
+ + " with value '').",
+ "android:id=^\"\"",
+ "android:id=\"\"^");
+ }
+
+ private void checkRanges(String name, String destPath, String aaptError,
+ String expectCaretBegin, String expectCaretEnd)
+ throws Exception {
+ IProject project = getProject();
+ IFile file = getTestDataFile(project, name, destPath);
+
+ // Make file paths absolute
+ String osRoot = project.getLocation().toOSString();
+ String fileRelativePath = file.getProjectRelativePath().toPortableString();
+ String filePath = osRoot + File.separator + fileRelativePath;
+ String originalError = filePath + aaptError.substring(aaptError.indexOf(':'));
+ List<String> errors = Collections.singletonList(originalError);
+
+ // Remove anything already placed there by the project create/build automatic
+ // (this usually only happens while debugging so the background thread has a chance
+ // to get things going)
+ IMarker[] markers = file.findMarkers(AdtConstants.MARKER_AAPT_COMPILE, true,
+ IResource.DEPTH_ZERO);
+ for (IMarker marker : markers) {
+ marker.delete();
+ }
+
+ AaptParser.parseOutput(errors, project);
+ markers = file.findMarkers(AdtConstants.MARKER_AAPT_COMPILE, true,
+ IResource.DEPTH_ZERO);
+ assertNotNull(markers);
+ assertEquals(1, markers.length);
+
+ String fileContents = AdtPlugin.readFile(file);
+ int rangeBegin = getCaretOffset(file, expectCaretBegin);
+ int rangeEnd = getCaretOffset(file, expectCaretEnd);
+
+ // Check text range
+ IMarker marker = markers[0];
+ String message = marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
+ String simplerMessage = aaptError.substring(aaptError.indexOf(' ') + 1);
+ assertEquals(simplerMessage, message);
+ int start = marker.getAttribute(IMarker.CHAR_START, 0);
+ int end = marker.getAttribute(IMarker.CHAR_END, 0);
+
+ assertEquals("Wrong start offset, expected " + expectCaretBegin + " but was "
+ + getCaretContext(fileContents, start), rangeBegin, start);
+ assertEquals("Wrong end offset, expected " + expectCaretEnd + " but was "
+ + getCaretContext(fileContents, end), rangeEnd, end);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java
new file mode 100644
index 0000000..78f16a2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java
@@ -0,0 +1,283 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.build;
+
+import static com.android.AndroidConstants.FD_RES_COLOR;
+import static com.android.AndroidConstants.FD_RES_LAYOUT;
+import static com.android.sdklib.SdkConstants.FD_RES;
+
+import com.android.ide.eclipse.adt.AdtConstants;
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
+import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest;
+import com.android.ide.eclipse.adt.internal.editors.xml.Hyperlinks;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AaptQuickFixTest extends AdtProjectTest {
+ @Override
+ protected boolean testCaseNeedsUniqueProject() {
+ // Make a separate test project for this test such that we don't pollute code assist
+ // tests with our new resources
+ return true;
+ }
+
+ public void testQuickFix1() throws Exception {
+ // Test adding a value into an existing file (res/values/strings.xml)
+ checkResourceFix("quickfix1.xml", "android:text=\"@string/firs^tstring\"",
+ "res/values/strings.xml");
+ }
+
+ public void testQuickFix2() throws Exception {
+ // Test adding a value into a new file (res/values/dimens.xml, will be created)
+ checkResourceFix("quickfix1.xml", "android:layout_width=\"@dimen/^testdimen\"",
+ "res/values/dimens.xml");
+ }
+
+ public void testQuickFix3() throws Exception {
+ // Test adding a file based resource (uses new file wizard machinery)
+ checkResourceFix("quickfix1.xml", "layout=\"@layout/^testlayout\"",
+ "res/layout/testlayout.xml");
+ }
+
+ public void testQuickFix4() throws Exception {
+ // Test adding a value into a new file (res/values/dimens.xml, will be created)
+ checkNamespaceFix("quickfix2.xml", "<c^olor");
+ }
+
+ private void checkResourceFix(String name, String caretLocation, String expectedNewPath)
+ throws Exception {
+ IProject project = getProject();
+ IFile file = getTestDataFile(project, name, FD_RES + "/" + FD_RES_LAYOUT + "/" + name);
+
+ // Determine the offset
+ final int offset = getCaretOffset(file, caretLocation);
+
+
+ String osRoot = project.getLocation().toOSString();
+ List<String> errors = new ArrayList<String>();
+ String fileRelativePath = file.getProjectRelativePath().toPortableString();
+ String filePath = osRoot + File.separator + fileRelativePath;
+ // Run AaptParser such that markers are added...
+ // When debugging these tests, the project gets a chance to build itself so
+ // the real aapt errors are there. But when the test is run directly, aapt has
+ // not yet run. I tried waiting for the build (using the code in SampleProjectTest)
+ // but this had various adverse effects (exception popups from the Eclipse debugger
+ // etc) so instead this test just hardcodes the aapt errors that should be
+ // observed on quickfix1.xml.
+ assertEquals("Unit test is hardcoded to errors for quickfix1.xml", "quickfix1.xml", name);
+ errors.add(filePath + ":7: error: Error: No resource found that matches the given name"
+ + " (at 'text' with value '@string/firststring').");
+ errors.add(filePath + ":7: error: Error: No resource found that matches the given name"
+ + " (at 'layout_width' with value '@dimen/testdimen').");
+ errors.add(filePath + ":13: error: Error: No resource found that matches the given name"
+ + " (at 'layout' with value '@layout/testlayout').");
+ AaptParser.parseOutput(errors, project);
+
+ AaptQuickFix aaptQuickFix = new AaptQuickFix();
+
+ // Open file
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ assertNotNull(page);
+ IEditorPart editor = IDE.openEditor(page, file);
+ assertTrue(editor instanceof AndroidXmlEditor);
+ AndroidXmlEditor layoutEditor = (AndroidXmlEditor) editor;
+ final ISourceViewer viewer = layoutEditor.getStructuredSourceViewer();
+
+ // Test marker resolution.
+ IMarker[] markers = file.findMarkers(AdtConstants.MARKER_AAPT_COMPILE, true,
+ IResource.DEPTH_ZERO);
+ for (IMarker marker : markers) {
+ int start = marker.getAttribute(IMarker.CHAR_START, 0);
+ int end = marker.getAttribute(IMarker.CHAR_END, 0);
+ if (offset >= start && offset <= end) {
+ // Found the target marker. Now check the marker resolution of it.
+ assertTrue(aaptQuickFix.hasResolutions(marker));
+ IMarkerResolution[] resolutions = aaptQuickFix.getResolutions(marker);
+ assertNotNull(resolutions);
+ assertEquals(1, resolutions.length);
+ IMarkerResolution resolution = resolutions[0];
+ assertNotNull(resolution);
+ assertTrue(resolution.getLabel().contains("Create resource"));
+
+ // Not running marker yet -- if we create the files here they already
+ // exist when the quick assist code runs. (The quick fix and the quick assist
+ // mostly share code for the implementation anyway.)
+ //resolution.run(marker);
+ break;
+ }
+ }
+
+ // Next test quick assist.
+
+ IQuickAssistInvocationContext invocationContext = new IQuickAssistInvocationContext() {
+ public int getLength() {
+ return 0;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public ISourceViewer getSourceViewer() {
+ return viewer;
+ }
+ };
+ ICompletionProposal[] proposals = aaptQuickFix
+ .computeQuickAssistProposals(invocationContext);
+ assertNotNull(proposals);
+ assertTrue(proposals.length == 1);
+ ICompletionProposal proposal = proposals[0];
+
+ assertNotNull(proposal.getAdditionalProposalInfo());
+ assertNotNull(proposal.getImage());
+ assertTrue(proposal.getDisplayString().contains("Create resource"));
+
+ IDocument document = new Document();
+ String fileContent = AdtPlugin.readFile(file);
+ document.set(fileContent);
+
+ // Apply quick fix
+ proposal.apply(document);
+
+ IPath path = new Path(expectedNewPath);
+ IFile newFile = project.getFile(path);
+ assertNotNull(path.toPortableString(), newFile);
+
+ // Ensure that the newly created file was opened
+ IEditorPart currentFile = Hyperlinks.getEditor();
+ assertEquals(newFile.getProjectRelativePath(),
+ ((FileEditorInput) currentFile.getEditorInput()).getFile().getProjectRelativePath());
+
+ // Look up caret offset
+ assertTrue(currentFile != null ? currentFile.getClass().getName() : "null",
+ currentFile instanceof AndroidXmlEditor);
+ AndroidXmlEditor newEditor = (AndroidXmlEditor) currentFile;
+ ISourceViewer newViewer = newEditor.getStructuredSourceViewer();
+ Point selectedRange = newViewer.getSelectedRange();
+
+ String newFileContents = AdtPlugin.readFile(newFile);
+
+ // Insert selection markers -- [ ] for the selection range, ^ for the caret
+ String newFileWithCaret = addSelection(newFileContents, selectedRange);
+ newFileWithCaret = removeSessionData(newFileWithCaret);
+
+ assertEqualsGolden(name, newFileWithCaret);
+ }
+
+ private void checkNamespaceFix(String name, String caretLocation)
+ throws Exception {
+ IProject project = getProject();
+ IFile file = getTestDataFile(project, name, FD_RES + "/" + FD_RES_COLOR + "/" + name);
+
+ // Determine the offset
+ final int offset = getCaretOffset(file, caretLocation);
+
+ String osRoot = project.getLocation().toOSString();
+ List<String> errors = new ArrayList<String>();
+ String fileRelativePath = file.getProjectRelativePath().toPortableString();
+ String filePath = osRoot + File.separator + fileRelativePath;
+ assertEquals("Unit test is hardcoded to errors for quickfix2.xml", "quickfix2.xml", name);
+ errors.add(filePath + ":5: error: Error parsing XML: unbound prefix");
+ AaptParser.parseOutput(errors, project);
+
+ AaptQuickFix aaptQuickFix = new AaptQuickFix();
+
+ // Open file
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ assertNotNull(page);
+ IEditorPart editor = IDE.openEditor(page, file);
+ assertTrue(editor instanceof AndroidXmlEditor);
+ AndroidXmlEditor layoutEditor = (AndroidXmlEditor) editor;
+ final ISourceViewer viewer = layoutEditor.getStructuredSourceViewer();
+
+ // Test marker resolution.
+ IMarker[] markers = file.findMarkers(AdtConstants.MARKER_AAPT_COMPILE, true,
+ IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ IMarker marker = markers[0];
+ // Found the target marker. Now check the marker resolution of it.
+ assertTrue(aaptQuickFix.hasResolutions(marker));
+ IMarkerResolution[] resolutions = aaptQuickFix.getResolutions(marker);
+ assertNotNull(resolutions);
+ assertEquals(1, resolutions.length);
+ IMarkerResolution resolution = resolutions[0];
+ assertNotNull(resolution);
+ assertTrue(resolution.getLabel().contains("Insert namespace"));
+
+ // Next test quick assist.
+
+ IQuickAssistInvocationContext invocationContext = new IQuickAssistInvocationContext() {
+ public int getLength() {
+ return 0;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public ISourceViewer getSourceViewer() {
+ return viewer;
+ }
+ };
+ ICompletionProposal[] proposals = aaptQuickFix
+ .computeQuickAssistProposals(invocationContext);
+ assertNotNull(proposals);
+ assertTrue(proposals.length == 1);
+ ICompletionProposal proposal = proposals[0];
+
+ assertNotNull(proposal.getAdditionalProposalInfo());
+ assertNotNull(proposal.getImage());
+ assertTrue(proposal.getDisplayString().contains("Insert namespace"));
+
+ // Open the file to ensure we can get an XML model with getExistingModelForEdit:
+ AdtPlugin.openFile(file, null);
+ IEditorPart newEditor = Hyperlinks.getEditor();
+ assertTrue(newEditor instanceof AndroidXmlEditor);
+
+ AndroidXmlEditor xmlEditor = (AndroidXmlEditor) newEditor;
+ IDocument document = xmlEditor.getStructuredSourceViewer().getDocument();
+
+ // Apply quick fix
+ String before = document.get();
+ proposal.apply(document);
+ String after = document.get();
+ String diff = getDiff(before, after);
+ assertEqualsGolden(name, diff);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java
new file mode 100644
index 0000000..c7a452e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java
@@ -0,0 +1,836 @@
+/*
+
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors;
+
+import static com.android.AndroidConstants.FD_RES_ANIM;
+import static com.android.AndroidConstants.FD_RES_ANIMATOR;
+import static com.android.AndroidConstants.FD_RES_COLOR;
+import static com.android.AndroidConstants.FD_RES_DRAWABLE;
+import static com.android.sdklib.SdkConstants.FD_RES;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.editors.animator.AnimationContentAssist;
+import com.android.ide.eclipse.adt.internal.editors.color.ColorContentAssist;
+import com.android.ide.eclipse.adt.internal.editors.drawable.DrawableContentAssist;
+import com.android.ide.eclipse.adt.internal.editors.layout.LayoutContentAssist;
+import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest;
+import com.android.ide.eclipse.adt.internal.editors.manifest.ManifestContentAssist;
+import com.android.ide.eclipse.adt.internal.editors.resources.ResourcesContentAssist;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+public class AndroidContentAssistTest extends AdtProjectTest {
+ private static final String CARET = "^"; //$NON-NLS-1$
+
+ public void testStartsWith() {
+ assertTrue(AndroidContentAssist.startsWith("", ""));
+ assertTrue(AndroidContentAssist.startsWith("a", ""));
+ assertTrue(AndroidContentAssist.startsWith("A", ""));
+ assertTrue(AndroidContentAssist.startsWith("A", "a"));
+ assertTrue(AndroidContentAssist.startsWith("A", "A"));
+ assertTrue(AndroidContentAssist.startsWith("Ab", "a"));
+ assertTrue(AndroidContentAssist.startsWith("ab", "A"));
+ assertTrue(AndroidContentAssist.startsWith("ab", "AB"));
+ assertFalse(AndroidContentAssist.startsWith("ab", "ABc"));
+ assertFalse(AndroidContentAssist.startsWith("", "ABc"));
+ }
+
+ public void testNameStartsWith() {
+ String fullWord = "android:marginTop";
+ for (int i = 0; i < fullWord.length(); i++) {
+ assertTrue(i + ":" + fullWord.substring(0, i),
+ AndroidContentAssist.nameStartsWith(
+ "android:layout_marginTop", fullWord.substring(0, i), "android:"));
+ }
+
+ fullWord = "android:layout_marginTop";
+ for (int i = 0; i < fullWord.length(); i++) {
+ assertTrue(i + ":" + fullWord.substring(0, i),
+ AndroidContentAssist.nameStartsWith("android:layout_marginTop", fullWord
+ .substring(0, i), "android:"));
+ }
+
+ fullWord = "layout_marginTop";
+ for (int i = 0; i < fullWord.length(); i++) {
+ assertTrue(i + ":" + fullWord.substring(0, i),
+ AndroidContentAssist.nameStartsWith("android:layout_marginTop", fullWord
+ .substring(0, i), "android:"));
+ }
+
+ fullWord = "marginTop";
+ for (int i = 0; i < fullWord.length(); i++) {
+ assertTrue(i + ":" + fullWord.substring(0, i),
+ AndroidContentAssist.nameStartsWith("android:layout_marginTop", fullWord
+ .substring(0, i), "android:"));
+ }
+
+ assertFalse(AndroidContentAssist.nameStartsWith("ab", "ABc", null));
+ assertFalse(AndroidContentAssist.nameStartsWith("", "ABc", null));
+ }
+
+ public void testCompletion1() throws Exception {
+ // Change attribute name completion
+ checkLayoutCompletion("completion1.xml", "layout_w^idth=\"fill_parent\"");
+ }
+
+ public void testCompletion2() throws Exception {
+ // Check attribute value completion for enum
+ checkLayoutCompletion("completion1.xml", "layout_width=\"^fill_parent\"");
+ }
+
+ public void testCompletion3() throws Exception {
+ // Check attribute value completion for enum with a prefix
+ checkLayoutCompletion("completion1.xml", "layout_width=\"fi^ll_parent\"");
+ }
+
+ public void testCompletion4() throws Exception {
+ // Check attribute value completion on units
+ checkLayoutCompletion("completion1.xml", "marginBottom=\"50^\"");
+ }
+
+ public void testCompletion5() throws Exception {
+ // Check attribute value completion on units with prefix
+ checkLayoutCompletion("completion1.xml", "layout_marginLeft=\"50d^p\"");
+ }
+
+ public void testCompletion6() throws Exception {
+ // Check resource sorting - "style" should bubble to the top for a style attribute
+ checkLayoutCompletion("completion1.xml", "style=\"@android:^style/Widget.Button\"");
+ }
+
+ public void testCompletion7a() throws Exception {
+ // Check flags (multiple values inside a single XML value, separated by | - where
+ // the prefix is reset as soon as you pass each | )
+ checkLayoutCompletion("completion1.xml", "android:gravity=\"l^eft|bottom\"");
+ }
+
+ public void testCompletion7b() throws Exception {
+ checkLayoutCompletion("completion1.xml", "android:gravity=\"left|b^ottom\"");
+ }
+
+ public void testCompletion8() throws Exception {
+ // Test completion right at the "=" sign; this will be taken to be the last
+ // character of the attribute name (the caret is between the last char and before
+ // the = characters), so it should match a single attribute
+ checkLayoutCompletion("completion1.xml", "layout_width^=\"fill_parent\"");
+ }
+
+ public void testCompletion9() throws Exception {
+ // Test completion right after the "=" sign; this will be taken to be the beginning
+ // of the attribute value, but all values will also include a leading quote
+ checkLayoutCompletion("completion1.xml", "layout_width=^\"fill_parent\"");
+ }
+
+ public void testCompletion10() throws Exception {
+ // Test completion of element names
+ checkLayoutCompletion("completion1.xml", "<T^extView");
+ }
+
+ public void testCompletion11() throws Exception {
+ // Test completion of element names at the outside of the <. This should include
+ // all the elements too (along with the leading <).
+ checkLayoutCompletion("completion1.xml", "^<TextView");
+ }
+
+ public void testCompletion12() throws Exception {
+ // Test completion of element names inside a nested XML; ensure that this will
+ // correctly compute element names, not previous attribute
+ checkLayoutCompletion("completion1.xml", "btn_default\">^</FrameLayout>");
+ }
+
+ public void testCompletion13a() throws Exception {
+ checkLayoutCompletion("completion2.xml", "gravity=\"left|bottom|^cen");
+ }
+
+ public void testCompletion13b() throws Exception {
+ checkLayoutCompletion("completion2.xml", "gravity=\"left|bottom|cen^");
+ }
+
+ public void testCompletion13c() throws Exception {
+ checkLayoutCompletion("completion2.xml", "gravity=\"left|bottom^|cen");
+ }
+
+ public void testCompletion14() throws Exception {
+ // Test completion of permissions
+ checkManifestCompletion("manifest.xml", "android.permission.ACC^ESS_NETWORK_STATE");
+ }
+
+ public void testCompletion15() throws Exception {
+ // Test completion of intents
+ checkManifestCompletion("manifest.xml", "android.intent.category.L^AUNCHER");
+ }
+
+ public void testCompletion16() throws Exception {
+ // Test completion of top level elements
+ checkManifestCompletion("manifest.xml", "<^application android:i");
+ }
+
+ public void testCompletion17() throws Exception {
+ // Test completion of attributes on the manifest element
+ checkManifestCompletion("manifest.xml", "^android:versionCode=\"1\"");
+ }
+
+ public void testCompletion18() throws Exception {
+ // Test completion of attributes on the manifest element
+ checkManifestCompletion("manifest.xml",
+ "<activity android:^name=\".TestActivity\"");
+ }
+
+ public void testCompletion19() throws Exception {
+ // Test special case where completing on a new element in an otherwise blank line
+ // does not add in full completion (with closing tags)
+ checkLayoutCompletion("broken3.xml", "<EditT^");
+ }
+
+ public void testCompletion20() throws Exception {
+ checkLayoutCompletion("broken1.xml", "android:textColorHigh^");
+ }
+
+ public void testCompletion21() throws Exception {
+ checkLayoutCompletion("broken2.xml", "style=^");
+ }
+
+ public void testCompletion22() throws Exception {
+ // Test completion where the cursor is inside an element (e.g. the next
+ // char is NOT a <) - should not complete with end tags
+ checkLayoutCompletion("completion4.xml", "<Button^");
+ }
+
+ // Test completion in style files
+
+ public void testCompletion23() throws Exception {
+ checkResourceCompletion("completionvalues1.xml", "android:textS^ize");
+ }
+
+ public void testCompletion24() throws Exception {
+ checkResourceCompletion("completionvalues1.xml", "17^sp");
+ }
+
+ public void testCompletion25() throws Exception {
+ checkResourceCompletion("completionvalues1.xml", "textColor\">^@color/title_color</item>");
+ }
+
+ public void testCompletion26() throws Exception {
+ checkResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:shadowColor\">@an^</item>");
+ }
+
+ public void testCompletion27() throws Exception {
+ checkResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:gravity\">^ </item>");
+ }
+
+ public void testCompletion28() throws Exception {
+ checkResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:gravity\"> ^</item>");
+ }
+
+ public void testCompletion29() throws Exception {
+ checkResourceCompletion("completionvalues1.xml", "<item name=\"gr^\">");
+ }
+
+ public void testCompletion30() throws Exception {
+ checkResourceCompletion("completionvalues1.xml", "<item name=\"an^\">");
+ }
+
+ public void testCompletion31() throws Exception {
+ checkResourceCompletion("completionvalues1.xml", "<item ^></item>");
+ }
+
+ public void testCompletion32() throws Exception {
+ checkResourceCompletion("completionvalues1.xml", "<item name=\"^\"></item>");
+ }
+
+ public void testCompletion33() throws Exception {
+ checkResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:allowSingleTap\">^</item>");
+ }
+
+ public void testCompletion34() throws Exception {
+ checkResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:alwaysDrawnWithCache\">^ false </item>");
+ }
+
+ public void testCompletion35() throws Exception {
+ checkResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:alwaysDrawnWithCache\"> ^false </item>");
+ }
+
+ public void testCompletion36() throws Exception {
+ checkResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:alwaysDrawnWithCache\"> f^alse </item>");
+ }
+
+ public void testCompletion37() throws Exception {
+ checkResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:orientation\">h^</item>");
+ }
+
+ public void testCompletion38() throws Exception {
+ checkResourceCompletion("completionvalues1.xml",
+ " c^");
+ }
+
+ public void testCompletion39() throws Exception {
+ // If you are at the end of a closing quote (but with no space), completion should
+ // include a separating space.
+ checkLayoutCompletion("completion1.xml", "marginBottom=\"50\"^");
+ }
+
+ public void testCompletion40() throws Exception {
+ // Same as test 39 but with single quote
+ checkLayoutCompletion("completion5.xml", "android:id='@+id/button2'^");
+ }
+
+ public void testCompletion41() throws Exception {
+ // Test prefix matching on layout_ with namespace prefix
+ checkLayoutCompletion("completion8.xml", "android:mar^=\"50dp\"");
+ }
+
+ public void testCompletion42() throws Exception {
+ // Test prefix matching on layout_ with namespace prefix
+ checkLayoutCompletion("completion8.xml", "android:w^i=\"100\"");
+ }
+
+ public void testCompletion43() throws Exception {
+ // Test prefix matching on layout_ without namespace prefix
+ checkLayoutCompletion("completion8.xml", "mar^=\"60dp\"");
+ }
+
+ public void testCompletion44() throws Exception {
+ // Test prefix matching on layout_ without namespace prefix
+ checkLayoutCompletion("completion8.xml", "android:layo^ut_width=\"fill_parent\"");
+ }
+
+ public void testCompletion45() throws Exception {
+ // Test top level elements in colors
+ checkColorCompletion("color1.xml", "^<selector");
+ }
+
+ public void testCompletion46a() throws Exception {
+ // Test children of selector: should offer item
+ checkColorCompletion("color1.xml", "^<item android");
+ }
+
+ public void testCompletion46b() throws Exception {
+ // Test attribute matching in color files
+ checkColorCompletion("color1.xml", "<item ^android:state_focused=\"true\"/>");
+ }
+
+ public void testCompletion47() throws Exception {
+ // Check root completion in drawables: should list all drawable root elements
+ checkDrawableCompletion("drawable1.xml", "^<layer-list");
+ }
+
+ public void testCompletion48() throws Exception {
+ // Check attributes of the layer list
+ checkDrawableCompletion("drawable1.xml", "^xmlns:android");
+ }
+
+ public void testCompletion49() throws Exception {
+ // Check attributes of the <item> element inside a <layer-list>
+ checkDrawableCompletion("drawable1.xml", "<item ^></item>");
+ }
+
+ public void testCompletion50() throws Exception {
+ // Check elements nested inside the <item> in a layer list: can use any drawable again
+ checkDrawableCompletion("drawable1.xml", "<item >^</item>");
+ }
+
+ public void testCompletion51() throws Exception {
+ // Check attributes of <shape> element
+ checkDrawableCompletion("drawable2.xml", "^android:innerRadiusRatio=\"2\"");
+ }
+
+ public void testCompletion52() throws Exception {
+ // Check list of available elements inside a shape
+ checkDrawableCompletion("drawable2.xml", "^<gradient");
+ }
+
+ public void testCompletion53() throws Exception {
+ // Check list of root anim elements
+ checkAnimCompletion("anim1.xml", "^<set xmlns");
+ }
+
+ public void testCompletion54() throws Exception {
+ // Check that we can nest inside <set>'s
+ checkAnimCompletion("anim1.xml", "^<translate android:id=");
+ }
+
+ public void testCompletion55() throws Exception {
+ // translate properties
+ checkAnimCompletion("anim1.xml", "android:^fromXDelta=");
+ }
+
+ public void testCompletion56() throws Exception {
+ // alpha properties
+ checkAnimCompletion("anim1.xml", "android:^fromAlpha=");
+ }
+
+ public void testCompletion57() throws Exception {
+ // Fractional properties
+ checkAnimCompletion("anim1.xml", "android:fromXDelta=\"100^%p\"");
+ }
+
+ public void testCompletion58() throws Exception {
+ // Top level animator elements
+ checkAnimatorCompletion("animator1.xml", "^<set xmlns");
+ }
+
+ public void testCompletion59() throws Exception {
+ // objectAnimator properties
+ checkAnimatorCompletion("animator1.xml", "android:^duration=\"2000\"");
+ }
+
+ public void testCompletion60() throws Exception {
+ // propertyName completion
+ checkAnimatorCompletion("animator1.xml", "android:propertyName=\"scal^eX\"/>");
+ }
+
+ public void testCompletion61() throws Exception {
+ // Interpolator completion
+ checkAnimatorCompletion("animator1.xml",
+ "android:interpolator=\"^@android:anim/bounce_interpolator\"");
+ }
+
+ // ---- Test *applying* code completion ----
+
+
+
+ // The following tests check -applying- a specific code completion
+ // match - this verifies that the document is updated correctly, the
+ // caret is moved appropriately, etc.
+
+ public void testApplyCompletion1() throws Exception {
+ // Change attribute name completion
+ checkApplyLayoutCompletion("completion1.xml", "layout_w^idth=\"fill_parent\"",
+ "android:layout_weight");
+ }
+
+ public void testApplyCompletion2() throws Exception {
+ // Check attribute value completion for enum
+ checkApplyLayoutCompletion("completion1.xml", "layout_width=\"^fill_parent\"",
+ "match_parent");
+ }
+
+ public void testApplyCompletion3() throws Exception {
+ // Check attribute value completion for enum with a prefix
+ checkApplyLayoutCompletion("completion1.xml", "layout_width=\"fi^ll_parent\"",
+ "fill_parent");
+ }
+
+ public void testApplyCompletion4() throws Exception {
+ // Check attribute value completion on units
+ checkApplyLayoutCompletion("completion1.xml", "marginBottom=\"50^\"", "50mm");
+ }
+
+ public void testApplyCompletion5() throws Exception {
+ // Check attribute value completion on units with prefix
+ checkApplyLayoutCompletion("completion1.xml", "layout_marginLeft=\"50d^p\"", "50dp");
+ }
+
+ public void testApplyCompletion6() throws Exception {
+ // Check resource sorting - "style" should bubble to the top for a style attribute
+ checkApplyLayoutCompletion("completion1.xml", "style=\"@android:^style/Widget.Button\"",
+ "@android:drawable/");
+ }
+
+ public void testApplyCompletion7a() throws Exception {
+ // Check flags (multiple values inside a single XML value, separated by | - where
+ // the prefix is reset as soon as you pass each | )
+ checkApplyLayoutCompletion("completion1.xml", "android:gravity=\"l^eft|bottom\"",
+ "left");
+ // NOTE - this will replace all flag values with the newly selected value.
+ // That may not be the best behavior - perhaps we should only replace one portion
+ // of the value.
+ }
+
+ public void testApplyCompletion7b() throws Exception {
+ checkApplyLayoutCompletion("completion1.xml", "android:gravity=\"left|b^ottom\"",
+ "bottom");
+ // NOTE - this will replace all flag values with the newly selected value.
+ // That may not be the best behavior - perhaps we should only replace one portion
+ // of the value.
+ }
+
+ public void testApplyCompletion8() throws Exception {
+ // Test completion right at the "=" sign; this will be taken to be the last
+ // character of the attribute name (the caret is between the last char and before
+ // the = characters), so it should match a single attribute
+ checkApplyLayoutCompletion("completion1.xml", "layout_width^=\"fill_parent\"",
+ "android:layout_width");
+ }
+
+ public void testApplyCompletion9() throws Exception {
+ // Test completion right after the "=" sign; this will be taken to be the beginning
+ // of the attribute value, but all values will also include a leading quote
+ checkApplyLayoutCompletion("completion1.xml", "layout_width=^\"fill_parent\"",
+ "\"wrap_content\"");
+ }
+
+ public void testApplyCompletion10() throws Exception {
+ // Test completion of element names
+ checkApplyLayoutCompletion("completion1.xml", "<T^extView", "TableLayout");
+ }
+
+ public void testApplyCompletion11a() throws Exception {
+ // Test completion of element names at the outside of the <. This should include
+ // all the elements too (along with the leading <).
+ checkApplyLayoutCompletion("completion1.xml", "^<TextView", "<RadioGroup ></RadioGroup>");
+ }
+
+ public void testApplyCompletion11b() throws Exception {
+ // Similar to testApplyCompletion11a, but replacing with an element that does not
+ // have children (to test the closing tag insertion code)
+ checkApplyLayoutCompletion("completion1.xml", "^<TextView", "<CheckBox />");
+ }
+
+ public void testApplyCompletion12() throws Exception {
+ // Test completion of element names inside a nested XML; ensure that this will
+ // correctly compute element names, not previous attribute
+ checkApplyLayoutCompletion("completion1.xml", "btn_default\">^</FrameLayout>",
+ "<FrameLayout ></FrameLayout>");
+ }
+
+ public void testApplyCompletion13a() throws Exception {
+ checkApplyLayoutCompletion("completion2.xml", "gravity=\"left|bottom|^cen",
+ "fill_vertical");
+ }
+
+ public void testApplyCompletion13b() throws Exception {
+ checkApplyLayoutCompletion("completion2.xml", "gravity=\"left|bottom|cen^",
+ "center_horizontal");
+ }
+
+ public void testApplyCompletion13c() throws Exception {
+ checkApplyLayoutCompletion("completion2.xml", "gravity=\"left|bottom^|cen",
+ "bottom|fill_horizontal");
+ }
+
+ public void testApplyCompletion14() throws Exception {
+ // Test special case where completing on a new element in an otherwise blank line
+ // does not add in full completion (with closing tags)
+ checkApplyLayoutCompletion("broken3.xml", "<EditT^", "EditText />");
+ }
+
+ public void testApplyCompletion15() throws Exception {
+ checkApplyLayoutCompletion("broken1.xml", "android:textColorHigh^",
+ "android:textColorHighlight");
+ }
+
+ public void testApplyCompletion16() throws Exception {
+ checkApplyLayoutCompletion("broken2.xml", "style=^",
+ "\"@android:\"");
+ }
+
+ public void testApplyCompletion17() throws Exception {
+ // Make sure that completion right before a / inside an element still
+ // inserts the ="" part (e.g. handles it as "insertNew)
+ checkApplyLayoutCompletion("completion3.xml", "<EditText ^/>",
+ "android:textColorHighlight");
+ }
+
+ public void testApplyCompletion18() throws Exception {
+ // Make sure that completion right before a > inside an element still
+ // inserts the ="" part (e.g. handles it as "insertNew)
+ checkApplyLayoutCompletion("completion3.xml", "<Button ^></Button>",
+ "android:paddingRight");
+ }
+
+ public void testApplyCompletion19() throws Exception {
+ // Test completion with single quotes (apostrophe)
+ checkApplyLayoutCompletion("completion5.xml", "android:orientation='^'", "horizontal");
+ }
+
+ public void testApplyCompletion20() throws Exception {
+ // Test completion with single quotes (apostrophe)
+ checkApplyLayoutCompletion("completion5.xml", "android:layout_marginTop='50^dp'", "50pt");
+ }
+
+ public void testApplyCompletion21() throws Exception {
+ // Test completion with single quotes (apostrophe)
+ checkApplyLayoutCompletion("completion5.xml", "android:layout_width='^wrap_content'",
+ "match_parent");
+ // Still broken - but not a common case
+ //checkApplyLayoutCompletion("completion5.xml", "android:layout_width=^'wrap_content'",
+ // "\"match_parent\"");
+ }
+
+ public void testApplyCompletion22() throws Exception {
+ // Test completion in an empty string
+ checkApplyLayoutCompletion("completion6.xml", "android:orientation=\"^\"", "horizontal");
+ }
+
+ public void testApplyCompletion23() throws Exception {
+ // Test completion in an empty string
+ checkApplyLayoutCompletion("completion7.xml", "android:orientation=\"^", "horizontal");
+ }
+
+ // Test completion in style files
+
+ public void testApplyCompletion24a() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml", "android:textS^ize",
+ "android:textSelectHandleLeft");
+ }
+
+ public void testApplyCompletion24b() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml", "17^sp", "17mm");
+ }
+
+ public void testApplyCompletion25() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml",
+ "textColor\">^@color/title_color</item>", "@android:");
+ }
+
+ public void testApplyCompletion26() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:shadowColor\">@an^</item>", "@android:");
+ }
+
+ public void testApplyCompletion27() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:gravity\">^ </item>", "center_vertical");
+ }
+
+ public void testApplyCompletion28() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:gravity\"> ^</item>", "left");
+ }
+
+ public void testApplyCompletion29() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml", "<item name=\"gr^\">",
+ "android:gravity");
+ }
+
+ public void testApplyCompletion30() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml", "<item name=\"an^\">",
+ "android:animateOnClick");
+ }
+
+ public void testApplyCompletion31() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml", "<item ^></item>", "name");
+ }
+
+ public void testApplyCompletion32() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml", "<item name=\"^\"></item>",
+ "android:background");
+ }
+
+ public void testApplyCompletion33() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:allowSingleTap\">^</item>", "true");
+ }
+
+ public void testApplyCompletion34() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:alwaysDrawnWithCache\">^ false </item>", "true");
+ }
+
+ public void testApplyCompletion35() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:alwaysDrawnWithCache\"> ^false </item>", "true");
+ }
+
+ public void testApplyCompletion36() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:alwaysDrawnWithCache\"> f^alse </item>", "false");
+ }
+
+ public void testApplyCompletion37() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml",
+ "<item name=\"android:orientation\">h^</item>", "horizontal");
+ }
+
+ public void testApplyCompletion38() throws Exception {
+ checkApplyResourceCompletion("completionvalues1.xml",
+ " c^", "center");
+ }
+
+ public void testApplyCompletion39() throws Exception {
+ // If you are at the end of a closing quote (but with no space), completion should
+ // include a separating space.
+ checkApplyLayoutCompletion("completion1.xml", "marginBottom=\"50\"^", " android:maxEms");
+ }
+
+ public void testApplyCompletion40() throws Exception {
+ // If you are at the end of a closing quote (but with no space), completion should
+ // include a separating space.
+ checkApplyLayoutCompletion("completion5.xml", "android:id='@+id/button2'^",
+ " android:maxWidth");
+ }
+
+ public void testApplyCompletion41() throws Exception {
+ // Test prefix matching on layout_ with namespace prefix
+ checkApplyLayoutCompletion("completion8.xml", "android:mar^=\"50dp\"",
+ "android:layout_marginRight");
+ }
+
+ // --- Code Completion test infrastructure ----
+
+ private void checkLayoutCompletion(String name, String caretLocation) throws Exception {
+ checkCompletion(name, getLayoutFile(getProject(), name), caretLocation,
+ new LayoutContentAssist());
+ }
+
+ private void checkColorCompletion(String name, String caretLocation) throws Exception {
+ IFile file = getTestDataFile(getProject(), name,
+ FD_RES + "/" + FD_RES_COLOR + "/" + name);
+ checkCompletion(name, file, caretLocation,
+ new ColorContentAssist());
+ }
+ private void checkAnimCompletion(String name, String caretLocation) throws Exception {
+ IFile file = getTestDataFile(getProject(), name,
+ FD_RES + "/" + FD_RES_ANIM + "/" + name);
+ checkCompletion(name, file, caretLocation,
+ new AnimationContentAssist());
+ }
+
+ private void checkAnimatorCompletion(String name, String caretLocation) throws Exception {
+ IFile file = getTestDataFile(getProject(), name,
+ FD_RES + "/" + FD_RES_ANIMATOR + "/" + name);
+ checkCompletion(name, file, caretLocation,
+ new AnimationContentAssist());
+ }
+
+
+ private void checkDrawableCompletion(String name, String caretLocation) throws Exception {
+ IFile file = getTestDataFile(getProject(), name,
+ FD_RES + "/" + FD_RES_DRAWABLE + "/" + name);
+ checkCompletion(name, file, caretLocation,
+ new DrawableContentAssist());
+ }
+
+ private void checkManifestCompletion(String name, String caretLocation) throws Exception {
+ // Manifest files must be named AndroidManifest.xml. Must overwrite to replace
+ // the default manifest created in the test project.
+ IFile file = getTestDataFile(getProject(), name, "AndroidManifest.xml", true);
+
+ checkCompletion(name, file, caretLocation,
+ new ManifestContentAssist());
+ }
+
+ private void checkApplyLayoutCompletion(String name, String caretLocation,
+ String match) throws Exception {
+ checkApplyCompletion(name, getLayoutFile(getProject(), name), caretLocation,
+ new LayoutContentAssist(), match);
+ }
+
+ private void checkResourceCompletion(String name, String caretLocation) throws Exception {
+ checkCompletion(name, getValueFile(getProject(), name), caretLocation,
+ new ResourcesContentAssist());
+ }
+
+ private void checkApplyResourceCompletion(String name, String caretLocation,
+ String match) throws Exception {
+ checkApplyCompletion(name, getValueFile(getProject(), name), caretLocation,
+ new ResourcesContentAssist(), match);
+ }
+
+ private ICompletionProposal[] complete(IFile file, String caretLocation,
+ AndroidContentAssist assist) throws Exception {
+
+ // Determine the offset
+ int offset = getCaretOffset(file, caretLocation);
+
+ // Open file
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ assertNotNull(page);
+ IEditorPart editor = IDE.openEditor(page, file);
+ assertTrue(editor instanceof AndroidXmlEditor);
+ AndroidXmlEditor layoutEditor = (AndroidXmlEditor) editor;
+ ISourceViewer viewer = layoutEditor.getStructuredSourceViewer();
+
+ // Run code completion
+ ICompletionProposal[] proposals = assist.computeCompletionProposals(viewer, offset);
+ if (proposals == null) {
+ proposals = new ICompletionProposal[0];
+ }
+
+ return proposals;
+ }
+
+ private void checkApplyCompletion(String basename, IFile file, String caretLocation,
+ AndroidContentAssist assist, String match) throws Exception {
+ ICompletionProposal[] proposals = complete(file, caretLocation, assist);
+ ICompletionProposal chosen = null;
+ for (ICompletionProposal proposal : proposals) {
+ if (proposal.getDisplayString().equals(match)) {
+ chosen = proposal;
+ break;
+ }
+ }
+ assertNotNull(chosen);
+ assert chosen != null; // Eclipse null pointer analysis doesn't believe the JUnit assertion
+
+ String fileContent = AdtPlugin.readFile(file);
+ IDocument document = new Document();
+ document.set(fileContent);
+
+ // Apply code completion
+ chosen.apply(document);
+
+ // Insert caret location as well
+ Point location = chosen.getSelection(document);
+ document.replace(location.x, 0, CARET);
+
+ String actual = document.get();
+
+ int offset = getCaretOffset(fileContent, caretLocation);
+ String beforeWithCaret = fileContent.substring(0, offset) + CARET
+ + fileContent.substring(offset);
+
+ String diff = getDiff(beforeWithCaret, actual);
+ assertTrue(diff + " versus " + actual, diff.length() > 0 || beforeWithCaret.equals(actual));
+
+ StringBuilder summary = new StringBuilder();
+ summary.append("Code completion in " + basename + " for " + caretLocation + " selecting " + match + ":\n");
+ if (diff.length() == 0) {
+ diff = "No changes";
+ }
+ summary.append(diff);
+
+ //assertEqualsGolden(basename, actual);
+ assertEqualsGolden(basename, summary.toString(), "diff");
+ }
+
+ private void checkCompletion(String basename, IFile file, String caretLocation,
+ AndroidContentAssist assist) throws Exception {
+ ICompletionProposal[] proposals = complete(file, caretLocation, assist);
+ StringBuilder sb = new StringBuilder(1000);
+ sb.append("Code completion in " + basename + " for " + caretLocation + ":\n");
+ for (ICompletionProposal proposal : proposals) {
+ // TODO: assertNotNull(proposal.getImage());
+ sb.append(proposal.getDisplayString());
+ String help = proposal.getAdditionalProposalInfo();
+ if (help != null && help.trim().length() > 0) {
+ sb.append(" : ");
+ sb.append(help.replace('\n', ' '));
+ }
+ sb.append('\n');
+ }
+ assertEqualsGolden(basename, sb.toString(), "txt");
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadataTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadataTest.java
new file mode 100644
index 0000000..7dc3f2d
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadataTest.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.gle2;
+
+import static com.android.ide.common.layout.LayoutConstants.ATTR_ID;
+import static com.android.ide.common.layout.LayoutConstants.ID_PREFIX;
+import static com.android.ide.common.layout.LayoutConstants.NEW_ID_PREFIX;
+
+import com.android.ide.common.layout.BaseLayoutRule;
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
+import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest;
+import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
+import com.android.ide.eclipse.adt.internal.editors.xml.Hyperlinks;
+import com.android.util.Pair;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.w3c.dom.Node;
+
+@SuppressWarnings("restriction") // XML DOM model
+public class LayoutMetadataTest extends AdtProjectTest {
+ public void testMetadata1() throws Exception {
+ Pair<IDocument, UiElementNode> pair = getNode("metadata.xml", "listView1");
+ IDocument document = pair.getFirst();
+ UiElementNode uiNode = pair.getSecond();
+ Node node = uiNode.getXmlNode();
+
+ LayoutMetadata metadata = LayoutMetadata.get();
+ assertNull(metadata.getProperty(document, node, "foo"));
+ String before =
+ "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" +
+ " android:layout_height=\"wrap_content\">\n" +
+ " </ListView>";
+ assertEquals(before, getText(document, node));
+
+ // Set the property
+ metadata.setProperty(document, node,
+ "listitem", "@android:layout/simple_list_item_checked");
+ String after =
+ "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" +
+ " android:layout_height=\"wrap_content\">\n" +
+ " <!-- Preview: listitem=@android:layout/simple_list_item_checked -->\n" +
+ " </ListView>";
+ assertEquals(after, getText(document, node));
+
+ // Set a second property
+ metadata.setProperty(document, node,
+ "listheader", "@android:layout/browser_link_context_header");
+ after =
+ "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" +
+ " android:layout_height=\"wrap_content\">\n" +
+ " <!-- Preview: \n" +
+ " listheader=@android:layout/browser_link_context_header\n" +
+ " listitem=@android:layout/simple_list_item_checked\n" +
+ " -->\n" +
+ " </ListView>";
+ assertEquals(after, getText(document, node));
+
+ // Set list item to a different layout
+ metadata.setProperty(document, node,
+ "listitem", "@android:layout/simple_list_item_single_choice");
+ after =
+ "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" +
+ " android:layout_height=\"wrap_content\">\n" +
+ " <!-- Preview: \n" +
+ " listheader=@android:layout/browser_link_context_header\n" +
+ " listitem=@android:layout/simple_list_item_single_choice\n" +
+ " -->\n" +
+ " </ListView>";
+ assertEquals(after, getText(document, node));
+
+ // Set header to a different layout
+ metadata.setProperty(document, node,
+ "listheader", "@layout/foo");
+ after =
+ "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" +
+ " android:layout_height=\"wrap_content\">\n" +
+ " <!-- Preview: \n" +
+ " listheader=@layout/foo\n" +
+ " listitem=@android:layout/simple_list_item_single_choice\n" +
+ " -->\n" +
+ " </ListView>";
+ assertEquals(after, getText(document, node));
+
+ // Clear out list item
+ metadata.setProperty(document, node,
+ "listitem", null);
+ after =
+ "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" +
+ " android:layout_height=\"wrap_content\">\n" +
+ " <!-- Preview: listheader=@layout/foo -->\n" +
+ " </ListView>";
+ assertEquals(after, getText(document, node));
+
+ // Clear out list header
+ metadata.setProperty(document, node,
+ "listheader", null);
+ after =
+ "<ListView android:layout_width=\"match_parent\" android:id=\"@+id/listView1\"\n" +
+ " android:layout_height=\"wrap_content\"></ListView>";
+ assertEquals(after, getText(document, node));
+
+ // Check node expansion on the button which doesn't have an end tag:
+ before = "<Button android:text=\"Button\" android:id=\"@+id/button1\"/>";
+ }
+
+ public void testMetadata2() throws Exception {
+ Pair<IDocument, UiElementNode> pair = getNode("metadata.xml", "button1");
+ IDocument document = pair.getFirst();
+ UiElementNode uiNode = pair.getSecond();
+ Node node = uiNode.getXmlNode();
+
+ LayoutMetadata metadata = LayoutMetadata.get();
+ assertNull(metadata.getProperty(document, node, "foo"));
+ String before =
+ "<Button android:text=\"Button\" android:id=\"@+id/button1\"/>";
+ assertEquals(before, getText(document, node));
+
+ // Set the property
+ metadata.setProperty(document, node,
+ "listitem", "@android:layout/simple_list_item_checked");
+ String after =
+ "<Button android:text=\"Button\" android:id=\"@+id/button1\">\n" +
+ " <!-- Preview: listitem=@android:layout/simple_list_item_checked -->\n" +
+ " </Button>";
+ assertEquals(after, getText(document, node));
+ }
+
+ // ==== Test utilities ====
+
+ private static String getText(IDocument document, Node node) throws Exception {
+ IndexedRegion region = (IndexedRegion) node;
+ // This often returns the wrong value:
+ //int length = region.getLength();
+ int length = region.getEndOffset() - region.getStartOffset();
+ return document.get(region.getStartOffset(), length);
+ }
+
+ private Pair<IDocument, UiElementNode> getNode(String filename, String targetId)
+ throws Exception, PartInitException {
+ IFile file = getLayoutFile(getProject(), filename);
+ AdtPlugin.openFile(file, null);
+ IEditorPart newEditor = Hyperlinks.getEditor();
+ assertTrue(newEditor instanceof AndroidXmlEditor);
+ AndroidXmlEditor xmlEditor = (AndroidXmlEditor) newEditor;
+ IStructuredDocument document = xmlEditor.getStructuredDocument();
+ UiElementNode root = xmlEditor.getUiRootNode();
+ assertNotNull(root);
+ UiElementNode node = findById(root, targetId);
+ assertNotNull(node);
+ Pair<IDocument, UiElementNode> pair = Pair.<IDocument, UiElementNode>of(document, node);
+ return pair;
+ }
+
+ private static UiElementNode findById(UiElementNode node, String targetId) {
+ assertFalse(targetId.startsWith(NEW_ID_PREFIX));
+ assertFalse(targetId.startsWith(ID_PREFIX));
+
+ String id = node.getAttributeValue(ATTR_ID);
+ if (id != null && targetId.equals(BaseLayoutRule.stripIdPrefix(id))) {
+ return node;
+ }
+
+ for (UiElementNode child : node.getUiChildren()) {
+ UiElementNode result = findById(child, targetId);
+ if (result != null) {
+ return result;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java
new file mode 100644
index 0000000..3b83bd7
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java
@@ -0,0 +1,744 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.refactoring;
+
+import static com.android.AndroidConstants.FD_RES_LAYOUT;
+import static com.android.AndroidConstants.FD_RES_VALUES;
+import static com.android.sdklib.SdkConstants.FD_RES;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.editors.descriptors.AttributeDescriptor;
+import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
+import com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor;
+import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor;
+import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode;
+import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
+import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
+import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreationPage;
+import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizard;
+import com.android.ide.eclipse.adt.internal.wizards.newproject.NewTestProjectCreationPage;
+import com.android.ide.eclipse.tests.SdkTestCase;
+import com.android.sdklib.IAndroidTarget;
+import com.android.sdklib.SdkConstants;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+
+@SuppressWarnings("restriction")
+public class AdtProjectTest extends SdkTestCase {
+ private static final int TARGET_API_LEVEL = 11;
+ /** Update golden files if different from the actual results */
+ private static final boolean UPDATE_DIFFERENT_FILES = false;
+ /** Create golden files if missing */
+ private static final boolean UPDATE_MISSING_FILES = true;
+ private static final String TEST_DATA_REL_PATH =
+ "eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/"
+ + "internal/editors/layout/refactoring/testdata";
+ private static final String PROJECTNAME_PREFIX = "testproject-";
+ private static final long TESTS_START_TIME = System.currentTimeMillis();
+ private static File sTempDir = null;
+
+ /**
+ * We don't stash the project used by each test case as a field such that test cases
+ * can share a single project instance (which is typically much faster).
+ * However, see {@link #getProjectName()} for exceptions to this sharing scheme.
+ */
+ private static Map<String, IProject> sProjectMap = new HashMap<String, IProject>();
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // Prevent preview icon computation during plugin test to make test faster
+ if (AdtPlugin.getDefault() == null) {
+ fail("This test must be run as an Eclipse plugin test, not a plain JUnit test!");
+ }
+ AdtPrefs.getPrefs().setPaletteModes("ICON_TEXT"); //$NON-NLS-1$
+
+ getProject();
+ }
+
+ /** Set to true if the subclass test case should use a per-instance project rather
+ * than a shared project. This is needed by projects which modify the project in such
+ * a way that it affects what other tests see (for example, the quickfix resource creation
+ * tests will add in new resources, which the code completion tests will then list as
+ * possible matches if the code completion test is run after the quickfix test.)
+ * @return true to create a per-instance project instead of the default shared project
+ */
+ protected boolean testCaseNeedsUniqueProject() {
+ return false;
+ }
+
+ protected boolean testNeedsUniqueProject() {
+ return false;
+ }
+
+ @Override
+ protected boolean validateSdk(IAndroidTarget target) {
+ // Not quite working yet. When enabled will make tests run faster.
+ //if (target.getVersion().getApiLevel() < TARGET_API_LEVEL) {
+ // return false;
+ //}
+
+ return true;
+ }
+
+ /** Returns a name to use for the project used in this test. Subclasses do not need to
+ * override this if they can share a project with others - which is the case if they do
+ * not modify the project in a way that does not affect other tests. For example
+ * the resource quickfix test will create new resources which affect what shows up
+ * in the code completion results, so the quickfix tests will override this method
+ * to produce a unique project for its own tests.
+ */
+ private String getProjectName() {
+ if (testNeedsUniqueProject()) {
+ return PROJECTNAME_PREFIX + getClass().getSimpleName() + "-" + getName();
+ } else if (testCaseNeedsUniqueProject()) {
+ return PROJECTNAME_PREFIX + getClass().getSimpleName();
+ } else {
+ return PROJECTNAME_PREFIX + TESTS_START_TIME;
+ }
+ }
+
+ protected IProject getProject() {
+ String projectName = getProjectName();
+ IProject project = sProjectMap.get(projectName);
+ if (project == null) {
+ project = createProject(projectName);
+ assertNotNull(project);
+ sProjectMap.put(projectName, project);
+ }
+
+ return project;
+ }
+
+ protected IFile getTestDataFile(IProject project, String name) throws Exception {
+ return getTestDataFile(project, name, name);
+ }
+
+ protected IFile getLayoutFile(IProject project, String name) throws Exception {
+ return getTestDataFile(project, name, FD_RES + "/" + FD_RES_LAYOUT + "/" + name);
+ }
+
+ protected IFile getValueFile(IProject project, String name) throws Exception {
+ return getTestDataFile(project, name, FD_RES + "/" + FD_RES_VALUES + "/" + name);
+ }
+
+ protected IFile getTestDataFile(IProject project, String sourceName,
+ String destPath) throws Exception {
+ return getTestDataFile(project, sourceName, destPath, false);
+ }
+
+ protected IFile getTestDataFile(IProject project, String sourceName,
+ String destPath, boolean overwrite) throws Exception {
+ String[] split = destPath.split("/"); //$NON-NLS-1$
+ IContainer parent;
+ String name;
+ if (split.length == 1) {
+ parent = project;
+ name = destPath;
+ } else {
+ IFolder folder = project.getFolder(split[0]);
+ NullProgressMonitor monitor = new NullProgressMonitor();
+ if (!folder.exists()) {
+ folder.create(true /* force */, true /* local */, monitor);
+ }
+ for (int i = 1, n = split.length; i < n -1; i++) {
+ IFolder subFolder = folder.getFolder(split[i]);
+ if (!subFolder.exists()) {
+ subFolder.create(true /* force */, true /* local */, monitor);
+ }
+ folder = subFolder;
+ }
+ name = split[split.length - 1];
+ parent = folder;
+ }
+ IFile file = parent.getFile(new Path(name));
+ if (overwrite && file.exists()) {
+ String currentContents = AdtPlugin.readFile(file);
+ String newContents = readTestFile(sourceName, true);
+ if (currentContents == null || !currentContents.equals(newContents)) {
+ file.delete(true, new NullProgressMonitor());
+ } else {
+ return file;
+ }
+ }
+ if (!file.exists()) {
+ String xml = readTestFile(sourceName, true);
+ InputStream bstream = new ByteArrayInputStream(xml.getBytes("UTF-8")); //$NON-NLS-1$
+ NullProgressMonitor monitor = new NullProgressMonitor();
+ file.create(bstream, false /* force */, monitor);
+ }
+
+ return file;
+ }
+
+ protected IProject createProject(String name) {
+ IAndroidTarget target = null;
+
+ IAndroidTarget[] targets = getSdk().getTargets();
+ for (IAndroidTarget t : targets) {
+ if (t.getVersion().getApiLevel() >= TARGET_API_LEVEL) {
+ target = t;
+ break;
+ }
+ }
+ assertNotNull(target);
+
+ final StubProjectWizard newProjCreator = new StubProjectWizard(
+ name, target);
+ newProjCreator.init(null, null);
+ // need to run finish on ui thread since it invokes a perspective switch
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ newProjCreator.performFinish();
+ }
+ });
+
+ return validateProjectExists(name);
+ }
+
+ public void createTestProject() {
+ IAndroidTarget target = null;
+
+ IAndroidTarget[] targets = getSdk().getTargets();
+ for (IAndroidTarget t : targets) {
+ if (t.getVersion().getApiLevel() >= TARGET_API_LEVEL) {
+ target = t;
+ break;
+ }
+ }
+ assertNotNull(target);
+ }
+
+ private static IProject validateProjectExists(String name) {
+ IProject iproject = getProject(name);
+ assertTrue(String.format("%s project not created", name), iproject.exists());
+ assertTrue(String.format("%s project not opened", name), iproject.isOpen());
+ return iproject;
+ }
+
+ private static IProject getProject(String name) {
+ IProject iproject = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(name);
+ return iproject;
+ }
+
+ protected int getCaretOffset(IFile file, String caretLocation) {
+ assertTrue(caretLocation, caretLocation.contains("^"));
+
+ String fileContent = AdtPlugin.readFile(file);
+ return getCaretOffset(fileContent, caretLocation);
+ }
+
+ protected int getCaretOffset(String fileContent, String caretLocation) {
+ assertTrue(caretLocation, caretLocation.contains("^"));
+
+ int caretDelta = caretLocation.indexOf("^");
+ assertTrue(caretLocation, caretDelta != -1);
+ String caretContext = caretLocation.substring(0, caretDelta)
+ + caretLocation.substring(caretDelta + 1); // +1: skip "^"
+ int caretContextIndex = fileContent.indexOf(caretContext);
+ assertTrue("Caret content " + caretContext + " not found in file",
+ caretContextIndex != -1);
+ return caretContextIndex + caretDelta;
+ }
+
+ protected String addSelection(String newFileContents, Point selectedRange) {
+ int selectionBegin = selectedRange.x;
+ int selectionEnd = selectionBegin + selectedRange.y;
+ return addSelection(newFileContents, selectionBegin, selectionEnd);
+ }
+
+ protected String addSelection(String newFileContents, int selectionBegin, int selectionEnd) {
+ // Insert selection markers -- [ ] for the selection range, ^ for the caret
+ String newFileWithCaret;
+ if (selectionBegin < selectionEnd) {
+ newFileWithCaret = newFileContents.substring(0, selectionBegin) + "[^"
+ + newFileContents.substring(selectionBegin, selectionEnd) + "]"
+ + newFileContents.substring(selectionEnd);
+ } else {
+ // Selected range
+ newFileWithCaret = newFileContents.substring(0, selectionBegin) + "^"
+ + newFileContents.substring(selectionBegin);
+ }
+
+ return newFileWithCaret;
+ }
+
+ protected String getCaretContext(String file, int offset) {
+ int windowSize = 20;
+ int begin = Math.max(0, offset - windowSize / 2);
+ int end = Math.min(file.length(), offset + windowSize / 2);
+
+ return "..." + file.substring(begin, offset) + "^" + file.substring(offset, end) + "...";
+ }
+
+ /**
+ * Very primitive line differ, intended for files where there are very minor changes
+ * (such as code completion apply-tests)
+ */
+ protected String getDiff(String before, String after) {
+ // Do line by line analysis
+ String[] beforeLines = before.split("\n");
+ String[] afterLines = after.split("\n");
+
+ int firstDelta = 0;
+ for (; firstDelta < Math.min(beforeLines.length, afterLines.length); firstDelta++) {
+ if (!beforeLines[firstDelta].equals(afterLines[firstDelta])) {
+ break;
+ }
+ }
+
+ if (firstDelta == beforeLines.length && firstDelta == afterLines.length) {
+ return "";
+ }
+
+ // Counts from the end of both arrays
+ int lastDelta = 0;
+ for (; lastDelta < Math.min(beforeLines.length, afterLines.length); lastDelta++) {
+ if (!beforeLines[beforeLines.length - 1 - lastDelta].equals(
+ afterLines[afterLines.length - 1 - lastDelta])) {
+ break;
+ }
+ }
+
+
+ boolean showBeforeWindow = firstDelta >= beforeLines.length - lastDelta;
+ boolean showAfterWindow = firstDelta >= afterLines.length - lastDelta;
+
+ StringBuilder sb = new StringBuilder();
+ if (showAfterWindow && firstDelta > 0) {
+ sb.append(" ");
+ sb.append(afterLines[firstDelta - 1]);
+ sb.append('\n');
+ }
+ for (int i = firstDelta; i < beforeLines.length - lastDelta; i++) {
+ sb.append("< ");
+ sb.append(beforeLines[i]);
+ sb.append('\n');
+ }
+ if (showAfterWindow && lastDelta < afterLines.length - 1) {
+ sb.append(" ");
+ sb.append(afterLines[afterLines.length - (lastDelta -1)]);
+ sb.append('\n');
+ }
+
+ sb.append("---\n");
+
+ if (showBeforeWindow && firstDelta > 0) {
+ sb.append(" ");
+ sb.append(beforeLines[firstDelta - 1]);
+ sb.append('\n');
+ }
+ for (int i = firstDelta; i < afterLines.length - lastDelta; i++) {
+ sb.append("> ");
+ sb.append(afterLines[i]);
+ sb.append('\n');
+ }
+ if (showBeforeWindow && lastDelta < beforeLines.length - 1) {
+ sb.append(" ");
+ sb.append(beforeLines[beforeLines.length - (lastDelta -1)]);
+ sb.append('\n');
+ }
+
+ return sb.toString();
+ }
+
+ protected String removeSessionData(String data) {
+ if (getProject() != null) {
+ data = data.replace(getProject().getName(), "PROJECTNAME");
+ }
+
+ return data;
+ }
+
+ public static ViewElementDescriptor createDesc(String name, String fqn, boolean hasChildren) {
+ if (hasChildren) {
+ return new ViewElementDescriptor(name, name, fqn, "", "", new AttributeDescriptor[0],
+ new AttributeDescriptor[0], new ElementDescriptor[1], false);
+ } else {
+ return new ViewElementDescriptor(name, fqn);
+ }
+ }
+
+ public static UiViewElementNode createNode(UiViewElementNode parent, String fqn,
+ boolean hasChildren) {
+ String name = fqn.substring(fqn.lastIndexOf('.') + 1);
+ ViewElementDescriptor descriptor = createDesc(name, fqn, hasChildren);
+ if (parent == null) {
+ // All node hierarchies should be wrapped inside a document node at the root
+ parent = new UiViewElementNode(createDesc("doc", "doc", true));
+ }
+ return (UiViewElementNode) parent.appendNewUiChild(descriptor);
+ }
+
+ public static UiViewElementNode createNode(String fqn, boolean hasChildren) {
+ return createNode(null, fqn, hasChildren);
+ }
+
+ protected String readTestFile(String relativePath, boolean expectExists) {
+ String path = "testdata" + File.separator + relativePath; //$NON-NLS-1$
+ InputStream stream =
+ AdtProjectTest.class.getResourceAsStream(path);
+ if (!expectExists && stream == null) {
+ return null;
+ }
+
+ assertNotNull(relativePath + " does not exist", stream);
+
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
+ String xml = AdtPlugin.readFile(reader);
+ assertNotNull(xml);
+ assertTrue(xml.length() > 0);
+
+ // Remove any references to the project name such that we are isolated from
+ // that in golden file.
+ // Appears in strings.xml etc.
+ xml = removeSessionData(xml);
+
+ return xml;
+ }
+
+ protected void assertEqualsGolden(String basename, String actual) {
+ assertEqualsGolden(basename, actual, basename.substring(basename.lastIndexOf('.') + 1));
+ }
+
+ protected void assertEqualsGolden(String basename, String actual, String newExtension) {
+ String testName = getName();
+ if (testName.startsWith("test")) {
+ testName = testName.substring(4);
+ if (Character.isUpperCase(testName.charAt(0))) {
+ testName = Character.toLowerCase(testName.charAt(0)) + testName.substring(1);
+ }
+ }
+ String expectedName;
+ String extension = basename.substring(basename.lastIndexOf('.') + 1);
+ if (newExtension == null) {
+ newExtension = extension;
+ }
+ expectedName = basename.substring(0, basename.indexOf('.'))
+ + "-expected-" + testName + '.' + newExtension;
+ String expected = readTestFile(expectedName, false);
+ if (expected == null) {
+ File expectedPath = new File(
+ UPDATE_MISSING_FILES ? getTargetDir() : getTempDir(), expectedName);
+ AdtPlugin.writeFile(expectedPath, actual);
+ System.out.println("Expected - written to " + expectedPath + ":\n");
+ System.out.println(actual);
+ fail("Did not find golden file (" + expectedName + "): Wrote contents as "
+ + expectedPath);
+ } else {
+ if (!expected.equals(actual)) {
+ File expectedPath = new File(getTempDir(), expectedName);
+ File actualPath = new File(getTempDir(),
+ expectedName.replace("expected", "actual"));
+ AdtPlugin.writeFile(expectedPath, expected);
+ AdtPlugin.writeFile(actualPath, actual);
+ // Also update data dir with the current value
+ if (UPDATE_DIFFERENT_FILES) {
+ AdtPlugin.writeFile( new File(getTargetDir(), expectedName), actual);
+ }
+ System.out.println("The files differ: diff " + expectedPath + " "
+ + actualPath);
+ assertEquals("The files differ - see " + expectedPath + " versus " + actualPath,
+ expected, actual);
+ }
+ }
+ }
+
+ /** Get the location to write missing golden files to */
+ protected File getTargetDir() {
+ // Set $ADT_SDK_SOURCE_PATH to point to your git "sdk" directory; if done, then
+ // if you run a unit test which refers to a golden file which does not exist, it
+ // will be created directly into the test data directory and you can rerun the
+ // test
+ // and it should pass (after you verify that the golden file contains the correct
+ // result of course).
+ String sdk = System.getenv("ADT_SDK_SOURCE_PATH");
+ if (sdk != null) {
+ File sdkPath = new File(sdk);
+ if (sdkPath.exists()) {
+ File testData = new File(sdkPath, TEST_DATA_REL_PATH.replace('/',
+ File.separatorChar));
+ if (testData.exists()) {
+ return testData;
+ }
+ }
+ }
+ return getTempDir();
+ }
+
+ protected File getTempDir() {
+ if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_DARWIN) {
+ return new File("/tmp"); //$NON-NLS-1$
+ }
+
+ if (sTempDir == null) {
+ // On Windows, we don't want to pollute the temp folder (which is generally
+ // already incredibly busy). So let's create a temp folder for the results.
+
+ File base = new File(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
+
+ Calendar c = Calendar.getInstance();
+ String name = String.format("adtTests_%1$tF_%1$tT", c).replace(':', '-'); //$NON-NLS-1$
+ File tmpDir = new File(base, name);
+ if (!tmpDir.exists() && tmpDir.mkdir()) {
+ sTempDir = tmpDir;
+ } else {
+ sTempDir = base;
+ }
+ }
+
+ return sTempDir;
+ }
+
+ /** Special editor context set on the model to be rendered */
+ protected static class TestLayoutEditor extends LayoutEditor {
+ private final IFile mFile;
+ private final IStructuredDocument mStructuredDocument;
+ private UiDocumentNode mUiRootNode;
+
+ public TestLayoutEditor(IFile file, IStructuredDocument structuredDocument,
+ UiDocumentNode uiRootNode) {
+ mFile = file;
+ mStructuredDocument = structuredDocument;
+ mUiRootNode = uiRootNode;
+ }
+
+ @Override
+ public IFile getInputFile() {
+ return mFile;
+ }
+
+ @Override
+ public IProject getProject() {
+ return mFile.getProject();
+ }
+
+ @Override
+ public IStructuredDocument getStructuredDocument() {
+ return mStructuredDocument;
+ }
+
+ @Override
+ public UiDocumentNode getUiRootNode() {
+ return mUiRootNode;
+ }
+
+ @Override
+ public void editorDirtyStateChanged() {
+ }
+
+ @Override
+ public IStructuredModel getModelForRead() {
+ IModelManager mm = StructuredModelManager.getModelManager();
+ if (mm != null) {
+ try {
+ return mm.getModelForRead(mFile);
+ } catch (Exception e) {
+ fail(e.toString());
+ }
+ }
+
+ return null;
+ }
+ }
+
+ /**
+ * Stub class for project creation wizard.
+ * <p/>
+ * Created so project creation logic can be run without UI creation/manipulation.
+ */
+ public class StubProjectWizard extends NewProjectWizard {
+
+ private final String mProjectName;
+ private final IAndroidTarget mTarget;
+
+ public StubProjectWizard(String projectName, IAndroidTarget target) {
+ this.mProjectName = projectName;
+ this.mTarget = target;
+ }
+
+ /**
+ * Override parent to return stub page
+ */
+ @Override
+ protected NewProjectCreationPage createMainPage() {
+ return new StubProjectCreationPage(mProjectName, mTarget);
+ }
+
+ /**
+ * Override parent to return null page
+ */
+ @Override
+ protected NewTestProjectCreationPage createTestPage() {
+ return null;
+ }
+
+ /**
+ * Overrides parent to return dummy wizard container
+ */
+ @Override
+ public IWizardContainer getContainer() {
+ return new IWizardContainer() {
+
+ public IWizardPage getCurrentPage() {
+ return null;
+ }
+
+ public Shell getShell() {
+ return null;
+ }
+
+ public void showPage(IWizardPage page) {
+ // pass
+ }
+
+ public void updateButtons() {
+ // pass
+ }
+
+ public void updateMessage() {
+ // pass
+ }
+
+ public void updateTitleBar() {
+ // pass
+ }
+
+ public void updateWindowTitle() {
+ // pass
+ }
+
+ /**
+ * Executes runnable on current thread
+ */
+ public void run(boolean fork, boolean cancelable,
+ IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException {
+ runnable.run(new NullProgressMonitor());
+ }
+
+ };
+ }
+ }
+
+ /**
+ * Stub class for project creation page.
+ * <p/>
+ * Returns canned responses for creating a sample project.
+ */
+ public class StubProjectCreationPage extends NewProjectCreationPage {
+
+ private final String mProjectName;
+ private final IAndroidTarget mTarget;
+
+ public StubProjectCreationPage(String projectName, IAndroidTarget target) {
+ super();
+ this.mProjectName = projectName;
+ this.mTarget = target;
+ setTestInfo(null);
+ }
+
+ @Override
+ public IMainInfo getMainInfo() {
+ return new IMainInfo() {
+ public String getProjectName() {
+ return mProjectName;
+ }
+
+ public String getPackageName() {
+ return "com.android.eclipse.tests";
+ }
+
+ public String getActivityName() {
+ return mProjectName;
+ }
+
+ public String getApplicationName() {
+ return mProjectName;
+ }
+
+ public boolean isNewProject() {
+ return true;
+ }
+
+ public String getSourceFolder() {
+ return "src";
+ }
+
+ public IPath getLocationPath() {
+ // Default location
+ return null;//new Path(mLocation);
+ }
+
+ public String getMinSdkVersion() {
+ return null;
+ }
+
+ public IAndroidTarget getSdkTarget() {
+ return mTarget;
+ }
+
+ public boolean isCreateActivity() {
+ return false;
+ }
+
+ public boolean useDefaultLocation() {
+ return true;
+ }
+
+ public IWorkingSet[] getSelectedWorkingSets() {
+ return new IWorkingSet[0];
+ }
+ };
+ }
+ }
+
+ public void testDummy() {
+ // This class contains shared test functionality for testcase subclasses,
+ // but without an actual test in the class JUnit complains (even if we make
+ // it abstract)
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeLayoutRefactoringTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeLayoutRefactoringTest.java
new file mode 100644
index 0000000..f822c62
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeLayoutRefactoringTest.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.refactoring;
+
+import static com.android.ide.common.layout.LayoutConstants.FQCN_RELATIVE_LAYOUT;
+
+import com.android.ide.eclipse.adt.internal.editors.layout.gle2.CanvasViewInfo;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.w3c.dom.Element;
+
+import java.util.Collections;
+import java.util.List;
+
+public class ChangeLayoutRefactoringTest extends RefactoringTest {
+
+ public void testChangeLayout1a() throws Exception {
+ // Test a basic layout which performs some nesting -- tests basic grid layout conversion
+ checkRefactoring("sample1a.xml", true);
+ }
+
+ public void testChangeLayout1b() throws Exception {
+ // Same as 1a, but with different formatting to look for edit handling to for example
+ // remove a line that is made empty when its only attribute is removed
+ checkRefactoring("sample1b.xml", true);
+ }
+
+ public void testChangeLayout2() throws Exception {
+ // Test code which analyzes an embedded RelativeLayout
+ checkRefactoring("sample2.xml", true);
+ }
+
+ public void testChangeLayout3() throws Exception {
+ // Test handling of LinearLayout "weight" attributes on its children: the child with
+ // weight > 0 should fill and subsequent children attach on the bottom/right
+ checkRefactoring("sample3.xml", true);
+ }
+
+ public void testChangeLayout4() throws Exception {
+ checkRefactoring("sample4.xml", true);
+ }
+
+ public void testChangeLayout5() throws Exception {
+ // Test handling of LinearLayout "gravity" attributes on its children
+ checkRefactoring("sample5.xml", true);
+ }
+
+ public void testChangeLayout6() throws Exception {
+ // Check handling of the LinearLayout "baseline" attribute
+ checkRefactoring("sample6.xml", true);
+ }
+
+ private void checkRefactoring(String basename, boolean flatten) throws Exception {
+ IFile file = getLayoutFile(getProject(), basename);
+ TestContext info = setupTestContext(file, basename);
+ TestLayoutEditor layoutEditor = info.mLayoutEditor;
+ CanvasViewInfo rootView = info.mRootView;
+ Element element = info.mElement;
+
+ List<Element> selectedElements = Collections.singletonList(element);
+ ChangeLayoutRefactoring refactoring = new ChangeLayoutRefactoring(selectedElements,
+ layoutEditor);
+ refactoring.setFlatten(flatten);
+ refactoring.setType(FQCN_RELATIVE_LAYOUT);
+ refactoring.setRootView(rootView);
+
+ List<Change> changes = refactoring.computeChanges(new NullProgressMonitor());
+ checkEdits(basename, changes);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeViewRefactoringTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeViewRefactoringTest.java
new file mode 100644
index 0000000..80307d2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ChangeViewRefactoringTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.refactoring;
+
+import static com.android.ide.common.layout.LayoutConstants.FQCN_RADIO_BUTTON;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.w3c.dom.Element;
+
+import java.util.List;
+
+public class ChangeViewRefactoringTest extends RefactoringTest {
+
+ public void testChangeView1() throws Exception {
+ checkRefactoring("sample1a.xml", FQCN_RADIO_BUTTON, "@+id/button1", "@+id/button6");
+ }
+
+ public void testChangeView2() throws Exception {
+ // Tests (1) updating references to the renamed id of the changed widgets
+ // (e.g. button3 is renamed to imageButton1 and layout references to button3
+ // must be updated), and (2) removal of attributes not available in the new type
+ // (the text property is removed since it is not available on the new widget
+ // type ImageButton)
+ checkRefactoring("sample2.xml", "android.widget.ImageButton",
+ "@+id/button3", "@+id/button5");
+ }
+
+ private void checkRefactoring(String basename, String newType,
+ String... ids) throws Exception {
+ assertTrue(ids.length > 0);
+
+ IFile file = getLayoutFile(getProject(), basename);
+ TestContext info = setupTestContext(file, basename);
+ TestLayoutEditor layoutEditor = info.mLayoutEditor;
+ List<Element> selectedElements = getElements(info.mElement, ids);
+
+ ChangeViewRefactoring refactoring = new ChangeViewRefactoring(selectedElements,
+ layoutEditor);
+ refactoring.setType(newType);
+
+ List<Change> changes = refactoring.computeChanges(new NullProgressMonitor());
+ checkEdits(basename, changes);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractIncludeRefactoringTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractIncludeRefactoringTest.java
new file mode 100644
index 0000000..da2a890
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractIncludeRefactoringTest.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.refactoring;
+
+import static com.android.ide.eclipse.adt.AdtConstants.DOT_XML;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.w3c.dom.Element;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ExtractIncludeRefactoringTest extends RefactoringTest {
+ @Override
+ protected boolean testCaseNeedsUniqueProject() {
+ // Because some of these tests look at ALL layouts in the project
+ // to identify matches
+ return true;
+ }
+
+ public void testExtract1() throws Exception {
+ // Basic: Extract a single button
+ checkRefactoring("sample3.xml", "newlayout1", false, null, 2, false /* diffs */,
+ "@+id/button2");
+ }
+
+ public void testExtract2() throws Exception {
+ // Extract a couple of elements
+ checkRefactoring("sample3.xml", "newlayout2", false, null, 2, false /* diffs */,
+ "@+id/button2", "@+id/android_logo");
+ }
+
+ public void testExtract3() throws Exception {
+ // Test to make sure layout attributes are updated
+ checkRefactoring("sample2.xml", "newlayout3", false, null, 2, false /* diffs */,
+ "@+id/button3");
+ }
+
+ public void testExtract4() throws Exception {
+ // Tests extracting from -multiple- files (as well as with custom android namespace
+ // prefix)
+
+ // Make sure the variation-files exist
+ Map<IPath, String> extraFiles = new HashMap<IPath, String>();
+ extraFiles.put(getTestDataFile(getProject(), "sample3-variation1.xml",
+ "res/layout-land/sample3.xml").getProjectRelativePath(),
+ "sample3-variation1.xml");
+ extraFiles.put(getTestDataFile(getProject(), "sample3-variation2.xml",
+ "res/layout-xlarge-land/sample3.xml").getProjectRelativePath(),
+ "sample3-variation2.xml");
+
+ checkRefactoring("sample3.xml", "newlayout3", true, extraFiles, 4, false /* diffs */,
+ "@+id/android_logo");
+ }
+
+ public void testExtract5() throws Exception {
+ // Tests extracting from multiple files with -contiguous regions-.
+
+ // Make sure the variation-files exist
+ Map<IPath, String> extraFiles = new HashMap<IPath, String>();
+ extraFiles.put(getTestDataFile(getProject(), "sample3-variation1.xml",
+ "res/layout-land/sample3.xml").getProjectRelativePath(),
+ "sample3-variation1.xml");
+ extraFiles.put(getTestDataFile(getProject(), "sample3-variation2.xml",
+ "res/layout-xlarge-land/sample3.xml").getProjectRelativePath(),
+ "sample3-variation2.xml");
+
+ checkRefactoring("sample3.xml", "newlayout3", true, extraFiles, 4, false /* diffs */,
+ "@+id/android_logo", "@+id/button1");
+ }
+
+ public void testExtract6() throws Exception {
+ // Tests extracting from multiple files where the layouts are completely
+ // different/unrelated files
+
+ // Create the duplicate files
+ Map<IPath, String> extraFiles = new HashMap<IPath, String>();
+ extraFiles.put(getTestDataFile(getProject(), "sample1a.xml",
+ "res/layout/sample1a.xml").getProjectRelativePath(),
+ "sample1a.xml");
+ extraFiles.put(getTestDataFile(getProject(), "sample7.xml", "res/layout/sample7.xml")
+ .getProjectRelativePath(), "sample7.xml");
+ extraFiles.put(getTestDataFile(getProject(), "sample8.xml", "res/layout/sample8.xml")
+ .getProjectRelativePath(), "sample8.xml");
+
+ checkRefactoring("sample7.xml", "newlayout6", true, extraFiles, 4, true /* diffs */,
+ "@+id/linearLayout4");
+ }
+
+
+ private void checkRefactoring(String basename, String layoutName,
+ boolean replaceOccurrences, Map<IPath,String> extraFiles,
+ int expectedModifiedFileCount, boolean createDiffs, String... ids) throws Exception {
+ assertTrue(ids.length > 0);
+
+ IFile file = getLayoutFile(getProject(), basename);
+ TestContext info = setupTestContext(file, basename);
+ TestLayoutEditor layoutEditor = info.mLayoutEditor;
+ List<Element> selectedElements = getElements(info.mElement, ids);
+
+ ExtractIncludeRefactoring refactoring = new ExtractIncludeRefactoring(selectedElements,
+ layoutEditor);
+ refactoring.setLayoutName(layoutName);
+ refactoring.setReplaceOccurrences(replaceOccurrences);
+ List<Change> changes = refactoring.computeChanges(new NullProgressMonitor());
+
+ assertTrue(changes.size() >= 3);
+
+ Map<IPath,String> fileToGolden = new HashMap<IPath,String>();
+ IPath sourcePath = file.getProjectRelativePath();
+ fileToGolden.put(sourcePath, basename);
+ IPath newPath = sourcePath.removeLastSegments(1).append(layoutName + DOT_XML);
+ fileToGolden.put(newPath, layoutName + DOT_XML);
+ if (extraFiles != null) {
+ fileToGolden.putAll(extraFiles);
+ }
+
+ checkEdits(changes, fileToGolden, createDiffs);
+
+ int modifiedFileCount = 0;
+ for (Change change : changes) {
+ if (change instanceof TextFileChange) {
+ modifiedFileCount++;
+ }
+ }
+ assertEquals(expectedModifiedFileCount, modifiedFileCount);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractStyleRefactoringTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractStyleRefactoringTest.java
new file mode 100644
index 0000000..2802013
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractStyleRefactoringTest.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.refactoring;
+
+import com.android.util.Pair;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class ExtractStyleRefactoringTest extends RefactoringTest {
+ @Override
+ protected boolean testCaseNeedsUniqueProject() {
+ return true;
+ }
+
+ public void testExtract1() throws Exception {
+ // Test extracting into a new style file
+ checkRefactoring("extractstyle1.xml", "newstyles.xml", "newstyle",
+ false /* removeExtracted */, false /* applyStyle */, null, 1, "@+id/button2");
+ }
+
+ public void testExtract1b() throws Exception {
+ // Extract and apply new style
+ checkRefactoring("extractstyle1.xml", "newstyles2.xml", "newstyle",
+ false /* removeExtracted */, true /* applyStyle */, null, 2, "@+id/button2");
+ }
+
+ public void testExtract1c() throws Exception {
+ // Extract and remove extracted
+ checkRefactoring("extractstyle1.xml", "newstyles3.xml", "newstyle",
+ true /* removeExtracted */, false /* applyStyle */, null, 2, "@+id/button2");
+ }
+
+ public void testExtract1d() throws Exception {
+ // Extract and apply style and remove extracted
+ checkRefactoring("extractstyle1.xml", "newstyles4.xml", "newstyle",
+ true /* removeExtracted */, true /* applyStyle */, null, 2, "@+id/button2");
+ }
+
+ public void testExtract2() throws Exception {
+ getTestDataFile(getProject(), "navigationstyles.xml", "res/values/navigationstyles.xml");
+
+ // -Modify- the existing styles.xml file
+ checkRefactoring("extractstyle1.xml", "navigationstyles.xml", "newstyle",
+ true /* removeExtracted */, true /* applyStyle */, null, 2, "@+id/button2");
+ }
+
+ public void testExtract3() throws Exception {
+ // Select multiple elements - overlap in values.
+ checkRefactoring("extractstyle1.xml", "newstyles4.xml", "newstyle",
+ true /* removeExtracted */, true /* applyStyle */, null, 2,
+ "@+id/button1", "@+id/button2");
+ }
+
+ // This test fails for some reason - not in the refactoring (checked manually)
+ // but the DOM model returns null when run in a test context.
+ public void testExtract4() throws Exception {
+ // Test extracting on a single caret position over an attribute: Should extract
+ // just that one attribute
+ checkRefactoringByOffset("extractstyle1.xml", "newstyles5.xml", "newstyle",
+ true /* removeExtracted */, true /* applyStyle */, null, 2,
+ "android:text^Color=\"#FF00FF\"", "android:text^Color=\"#FF00FF\"");
+ }
+
+ public void testExtract5() throws Exception {
+ // Test extracting on a range selection inside an element: should extract just
+ // the attributes that overlap the selection
+ checkRefactoringByOffset("extractstyle1.xml", "newstyles6.xml", "newstyle",
+ true /* removeExtracted */, true /* applyStyle */, null, 2,
+ "android:^textSize=\"20pt",
+ "android:id=\"@+id/button1\" android:layout_a^lignParentBottom");
+ }
+
+ public void testExtract6() throws Exception {
+ // Test extracting on a single caret position which is not over any attributes:
+ checkRefactoringByOffset("extractstyle1.xml", "newstyles7.xml", "newstyle",
+ true /* removeExtracted */, true /* applyStyle */, null, 0,
+ "<Bu^tton", "<Bu^tton");
+ }
+
+ public void testExtract7() throws Exception {
+ // Verify that even with a different namespace prefix we end up with android:
+ // in the extracted style
+ checkRefactoring("extractstyle2.xml", "newstyles8.xml", "newstyle",
+ true /* removeExtracted */, true /* applyStyle */, null, 2,
+ "@+id/button1", "@+id/button2");
+ }
+
+ public void testExtract8() throws Exception {
+ // Test setting parent style
+ checkRefactoring("extractstyle1.xml", "newstyles3.xml", "newstyle",
+ true /* removeExtracted */, false /* applyStyle */, "android:Widget.Button",
+ 2, "@+id/button2");
+ }
+
+ // Check extract style on a selection of elements
+ private void checkRefactoring(String basename, String styleFileName, String newStyleName,
+ boolean removeExtracted, boolean applyStyle, String parentStyle,
+ int expectedModifiedFileCount, String... ids) throws Exception {
+ assertTrue(ids.length > 0);
+
+ IFile file = getLayoutFile(getProject(), basename);
+ TestContext info = setupTestContext(file, basename);
+ TestLayoutEditor layoutEditor = info.mLayoutEditor;
+ List<Element> selectedElements = getElements(info.mElement, ids);
+
+ // Open the file such that ModelManager.getExistingModelForRead() in DomUtilities
+ // will succeed
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
+ IDE.openEditor(page, file);
+
+ ExtractStyleRefactoring refactoring = new ExtractStyleRefactoring(selectedElements,
+ layoutEditor);
+ checkRefactoring(basename, styleFileName, newStyleName, removeExtracted, applyStyle,
+ parentStyle, expectedModifiedFileCount, file, refactoring);
+ }
+
+ // Check extract style against a set of editor text locations
+ private void checkRefactoringByOffset(String basename, String styleFileName,
+ String newStyleName, boolean removeExtracted, boolean applyStyle,
+ String parentStyle,
+ int expectedModifiedFileCount, String beginCaretLocation, String endCaretLocation)
+ throws Exception {
+ IFile file = getLayoutFile(getProject(), basename);
+ int beginOffset = getCaretOffset(file, beginCaretLocation);
+ int endOffset = getCaretOffset(file, endCaretLocation);
+
+ TestContext info = setupTestContext(file, basename);
+ TestLayoutEditor layoutEditor = info.mLayoutEditor;
+
+ // Open the file such that ModelManager.getExistingModelForRead() in DomUtilities
+ // will succeed
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
+ IDE.openEditor(page, file);
+
+ ITextSelection selection = new TextSelection(beginOffset, endOffset - beginOffset);
+ ExtractStyleRefactoring refactoring = new ExtractStyleRefactoring(file,
+ layoutEditor, selection, null);
+ checkRefactoring(basename, styleFileName, newStyleName, removeExtracted, applyStyle,
+ parentStyle, expectedModifiedFileCount, file, refactoring);
+ }
+
+ // Common test code used by the other two check methods
+ private void checkRefactoring(String basename, String styleFileName, String newStyleName,
+ boolean removeExtracted, boolean applyStyle, String parentStyle,
+ int expectedModifiedFileCount, IFile file,
+ ExtractStyleRefactoring refactoring) throws Exception {
+ refactoring.setStyleName(newStyleName);
+ refactoring.setApplyStyle(applyStyle);
+ refactoring.setRemoveExtracted(removeExtracted);
+ refactoring.setStyleFileName(styleFileName);
+ refactoring.setParent(parentStyle);
+
+ // Pick the attributes to extract -- for now everything (and where there are
+ // conflicting values, pick the first one)
+ Pair<Map<String, List<Attr>>, Set<Attr>> result = refactoring.getAvailableAttributes();
+ Map<String, List<Attr>> availableAttributes = result.getFirst();
+ Set<Attr> selected = result.getSecond();
+ List<Attr> chosenAttributes = new ArrayList<Attr>();
+ for (List<Attr> list : availableAttributes.values()) {
+ Collections.sort(list, new Comparator<Attr>() {
+ public int compare(Attr a1, Attr a2) {
+ return a1.getValue().compareTo(a2.getValue());
+ }
+ });
+ Attr attr = list.get(0);
+ if (selected.contains(attr)) {
+ chosenAttributes.add(attr);
+ }
+ }
+ refactoring.setChosenAttributes(chosenAttributes);
+
+ List<Change> changes = refactoring.computeChanges(new NullProgressMonitor());
+ assertEquals(expectedModifiedFileCount, changes.size());
+
+ Map<IPath,String> fileToGolden = new HashMap<IPath,String>();
+ IPath sourcePath = file.getProjectRelativePath();
+ fileToGolden.put(sourcePath, basename);
+ IPath newPath = refactoring.getStyleFile(getProject()).getProjectRelativePath();
+ fileToGolden.put(newPath, styleFileName);
+
+ checkEdits(changes, fileToGolden, true);
+
+ int modifiedFileCount = 0;
+ for (Change change : changes) {
+ if (change instanceof TextFileChange) {
+ modifiedFileCount++;
+ }
+ }
+ assertEquals(expectedModifiedFileCount, modifiedFileCount);
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringAssistantTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringAssistantTest.java
new file mode 100644
index 0000000..498f65a
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringAssistantTest.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.refactoring;
+
+import static com.android.AndroidConstants.FD_RES_LAYOUT;
+import static com.android.sdklib.SdkConstants.FD_RES;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+public class RefactoringAssistantTest extends AdtProjectTest {
+ public void testAssistant1() throws Exception {
+ // "Extract String"
+ checkFixes("sample1a.xml", "<Button android:text=\"Fir^stButton\"");
+ }
+
+ public void testAssistant2() throws Exception {
+ // Visual refactoring operations
+ checkFixes("sample1a.xml", "<Bu^tton android:text");
+ }
+
+ public void testAssistant3() throws Exception {
+ // Negative test: ensure that we don't get completion items in other parts of the XML
+ checkFixes("sample1a.xml", "<Button andr^oid:text=\"FirstButton\"");
+ }
+
+ public void testAssistant4() throws Exception {
+ // Negative test: ensure that we don't offer extract string on a value that is
+ // already a resource
+ checkFixes("sample1a.xml", "android:id=\"@+id/Linea^rLayout2\"");
+ }
+
+ private void checkFixes(String name, String caretLocation)
+ throws Exception {
+ IProject project = getProject();
+ IFile file = getTestDataFile(project, name, FD_RES + "/" + FD_RES_LAYOUT + "/" + name);
+
+ // Determine the offset
+ String fileContent = AdtPlugin.readFile(file);
+ int caretDelta = caretLocation.indexOf("^");
+ assertTrue(caretLocation, caretDelta != -1);
+ String caretContext = caretLocation.substring(0, caretDelta)
+ + caretLocation.substring(caretDelta + "^".length());
+ int caretContextIndex = fileContent.indexOf(caretContext);
+ assertTrue("Caret content " + caretContext + " not found in file",
+ caretContextIndex != -1);
+ final int offset = caretContextIndex + caretDelta;
+
+
+ RefactoringAssistant refactoringAssistant = new RefactoringAssistant();
+
+ // Open file
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ assertNotNull(page);
+ IEditorPart editor = IDE.openEditor(page, file);
+ assertTrue(editor instanceof AndroidXmlEditor);
+ AndroidXmlEditor layoutEditor = (AndroidXmlEditor) editor;
+ final ISourceViewer viewer = layoutEditor.getStructuredSourceViewer();
+
+ IQuickAssistInvocationContext invocationContext = new IQuickAssistInvocationContext() {
+ public int getLength() {
+ return 0;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public ISourceViewer getSourceViewer() {
+ return viewer;
+ }
+ };
+ ICompletionProposal[] proposals = refactoringAssistant
+ .computeQuickAssistProposals(invocationContext);
+
+ if (proposals != null) {
+ for (ICompletionProposal proposal : proposals) {
+ assertNotNull(proposal.getAdditionalProposalInfo());
+ assertNotNull(proposal.getImage());
+ }
+ }
+
+ StringBuilder sb = new StringBuilder(1000);
+ sb.append("Quick assistant in " + name + " for " + caretLocation + ":\n");
+ if (proposals != null) {
+ for (ICompletionProposal proposal : proposals) {
+ sb.append(proposal.getDisplayString());
+ String help = proposal.getAdditionalProposalInfo();
+ if (help != null && help.trim().length() > 0) {
+ sb.append(" : ");
+ sb.append(help.replace('\n', ' '));
+ }
+ sb.append('\n');
+ }
+ } else {
+ sb.append("None found.\n");
+ }
+ assertEqualsGolden(name, sb.toString(), "txt");
+
+ // No "apply" test on these assists since they are interactive. Refactoring
+ // is tested elsewhere.
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringTest.java
new file mode 100644
index 0000000..4ca30d6
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringTest.java
@@ -0,0 +1,299 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.refactoring;
+
+import static com.android.ide.common.layout.LayoutConstants.ANDROID_WIDGET_PREFIX;
+import static com.android.ide.eclipse.adt.AdtConstants.DOT_XML;
+
+import com.android.ide.common.rendering.api.ViewInfo;
+import com.android.ide.eclipse.adt.internal.editors.layout.gle2.CanvasViewInfo;
+import com.android.ide.eclipse.adt.internal.editors.layout.gle2.DomUtilities;
+import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode;
+import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.w3c.dom.Element;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@SuppressWarnings("restriction")
+public class RefactoringTest extends AdtProjectTest {
+
+ protected static Element findElementById(Element root, String id) {
+ if (id.equals(VisualRefactoring.getId(root))) {
+ return root;
+ }
+
+ for (Element child : DomUtilities.getChildren(root)) {
+ Element result = findElementById(child, id);
+ if (result != null) {
+ return result;
+ }
+ }
+
+ return null;
+ }
+
+ protected static List<Element> getElements(Element root, String... ids) {
+ List<Element> selectedElements = new ArrayList<Element>();
+ for (String id : ids) {
+ Element element = findElementById(root, id);
+ assertNotNull(element);
+ selectedElements.add(element);
+ }
+ return selectedElements;
+ }
+
+ protected void checkEdits(String basename, List<Change> changes) throws BadLocationException,
+ IOException {
+ IDocument document = new Document();
+
+ String xml = readTestFile(basename, false);
+ if (xml == null) { // New file
+ xml = ""; //$NON-NLS-1$
+ }
+ document.set(xml);
+
+ for (Change change : changes) {
+ if (change instanceof TextFileChange) {
+ TextFileChange tf = (TextFileChange) change;
+ TextEdit edit = tf.getEdit();
+ if (edit instanceof MultiTextEdit) {
+ MultiTextEdit edits = (MultiTextEdit) edit;
+ edits.apply(document);
+ } else {
+ edit.apply(document);
+ }
+ } else {
+ System.out.println("Ignoring non-textfilechange in refactoring result");
+ }
+ }
+
+ String actual = document.get();
+ assertEqualsGolden(basename, actual);
+ }
+
+ protected void checkEdits(List<Change> changes,
+ Map<IPath, String> fileToGoldenName) throws BadLocationException {
+ checkEdits(changes, fileToGoldenName, false);
+ }
+
+ protected void checkEdits(List<Change> changes,
+ Map<IPath, String> fileToGoldenName, boolean createDiffs) throws BadLocationException {
+ for (Change change : changes) {
+ if (change instanceof TextFileChange) {
+ TextFileChange tf = (TextFileChange) change;
+ IFile file = tf.getFile();
+ assertNotNull(file);
+ IPath path = file.getProjectRelativePath();
+ String goldenName = fileToGoldenName.get(path);
+ assertNotNull("Not found: " + path.toString(), goldenName);
+
+ String xml = readTestFile(goldenName, false);
+ if (xml == null) { // New file
+ xml = ""; //$NON-NLS-1$
+ }
+ IDocument document = new Document();
+ document.set(xml);
+
+ String before = document.get();
+
+ TextEdit edit = tf.getEdit();
+ if (edit instanceof MultiTextEdit) {
+ MultiTextEdit edits = (MultiTextEdit) edit;
+ edits.apply(document);
+ } else {
+ edit.apply(document);
+ }
+
+ String actual = document.get();
+
+ if (createDiffs) {
+ // Use a diff as the golden file instead of the after
+ actual = getDiff(before, actual);
+ if (goldenName.endsWith(DOT_XML)) {
+ goldenName = goldenName.substring(0,
+ goldenName.length() - DOT_XML.length())
+ + ".diff";
+ }
+ }
+
+ assertEqualsGolden(goldenName, actual);
+ } else {
+ System.out.println("Ignoring non-textfilechange in refactoring result");
+ assertNull(change.getAffectedObjects());
+ }
+ }
+ }
+
+ protected UiViewElementNode createModel(UiViewElementNode parent, Element element) {
+ List<Element> children = DomUtilities.getChildren(element);
+ String fqcn = ANDROID_WIDGET_PREFIX + element.getTagName();
+ boolean hasChildren = children.size() > 0;
+ UiViewElementNode node = createNode(parent, fqcn, hasChildren);
+ node.setXmlNode(element);
+ for (Element child : children) {
+ createModel(node, child);
+ }
+
+ return node;
+ }
+
+ /**
+ * Builds up a ViewInfo hierarchy for the given model. This is done by
+ * reading .info dump files which record the exact pixel sizes of each
+ * ViewInfo object. These files are assumed to match up exactly with the
+ * model objects. This is done rather than rendering an actual layout
+ * hierarchy to insulate the test from pixel difference (in say font size)
+ * among platforms, as well as tying the test to particulars about relative
+ * sizes of things which may change with theme adjustments etc.
+ * <p>
+ * Each file can be generated by the dump method in the ViewHierarchy.
+ */
+ protected ViewInfo createInfos(UiElementNode model, String relativePath) {
+ String basename = relativePath.substring(0, relativePath.lastIndexOf('.') + 1);
+ String relative = basename + "info"; //$NON-NLS-1$
+ String info = readTestFile(relative, true);
+ // Parse the info file and build up a model from it
+ // Each line contains a new info.
+ // If indented it is a child of the parent.
+ String[] lines = info.split("\n"); //$NON-NLS-1$
+
+ // Iteration order for the info file should match exactly the UI model so
+ // we can just advance the line index sequentially as we traverse
+
+ return create(model, Arrays.asList(lines).iterator());
+ }
+
+ protected ViewInfo create(UiElementNode node, Iterator<String> lineIterator) {
+ // android.widget.LinearLayout [0,36,240,320]
+ Pattern pattern = Pattern.compile("(\\s*)(\\S+) \\[(\\d+),(\\d+),(\\d+),(\\d+)\\].*");
+ assertTrue(lineIterator.hasNext());
+ String description = lineIterator.next();
+ Matcher matcher = pattern.matcher(description);
+ assertTrue(matcher.matches());
+ //String indent = matcher.group(1);
+ //String fqcn = matcher.group(2);
+ String left = matcher.group(3);
+ String top = matcher.group(4);
+ String right = matcher.group(5);
+ String bottom = matcher.group(6);
+
+ ViewInfo view = new ViewInfo(node.getXmlNode().getLocalName(), node,
+ Integer.parseInt(left), Integer.parseInt(top),
+ Integer.parseInt(right), Integer.parseInt(bottom));
+
+ List<UiElementNode> childNodes = node.getUiChildren();
+ if (childNodes.size() > 0) {
+ List<ViewInfo> children = new ArrayList<ViewInfo>();
+ for (UiElementNode child : childNodes) {
+ children.add(create(child, lineIterator));
+ }
+ view.setChildren(children);
+ }
+
+ return view;
+ }
+
+ protected TestContext setupTestContext(IFile file, String relativePath) throws Exception {
+ IStructuredModel structuredModel = null;
+ org.w3c.dom.Document domDocument = null;
+ IStructuredDocument structuredDocument = null;
+ Element element = null;
+
+ try {
+ IModelManager modelManager = StructuredModelManager.getModelManager();
+ structuredModel = modelManager.getModelForRead(file);
+ if (structuredModel instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) structuredModel;
+ domDocument = domModel.getDocument();
+ element = domDocument.getDocumentElement();
+ structuredDocument = structuredModel.getStructuredDocument();
+ }
+ } finally {
+ if (structuredModel != null) {
+ structuredModel.releaseFromRead();
+ }
+ }
+
+ assertNotNull(structuredModel);
+ assertNotNull(domDocument);
+ assertNotNull(element);
+ assertNotNull(structuredDocument);
+ assertTrue(element instanceof IndexedRegion);
+
+ UiViewElementNode model = createModel(null, element);
+ ViewInfo info = createInfos(model, relativePath);
+ CanvasViewInfo rootView = CanvasViewInfo.create(info, true /* layoutlib5 */).getFirst();
+ TestLayoutEditor layoutEditor = new TestLayoutEditor(file, structuredDocument, null);
+
+ TestContext testInfo = createTestContext();
+ testInfo.mFile = file;
+ testInfo.mStructuredModel = structuredModel;
+ testInfo.mStructuredDocument = structuredDocument;
+ testInfo.mElement = element;
+ testInfo.mDomDocument = domDocument;
+ testInfo.mUiModel = model;
+ testInfo.mViewInfo = info;
+ testInfo.mRootView = rootView;
+ testInfo.mLayoutEditor = layoutEditor;
+
+ return testInfo;
+ }
+
+ protected TestContext createTestContext() {
+ return new TestContext();
+ }
+
+ protected static class TestContext {
+ protected IFile mFile;
+ protected IStructuredModel mStructuredModel;
+ protected IStructuredDocument mStructuredDocument;
+ protected org.w3c.dom.Document mDomDocument;
+ protected Element mElement;
+ protected UiViewElementNode mUiModel;
+ protected ViewInfo mViewInfo;
+ protected CanvasViewInfo mRootView;
+ protected TestLayoutEditor mLayoutEditor;
+ }
+
+ @Override
+ public void testDummy() {
+ // To avoid JUnit warning that this class contains no tests, even though
+ // this is an abstract class and JUnit shouldn't try
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/WrapInRefactoringTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/WrapInRefactoringTest.java
new file mode 100644
index 0000000..26d908b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/WrapInRefactoringTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.refactoring;
+
+import static com.android.ide.common.layout.LayoutConstants.FQCN_GESTURE_OVERLAY_VIEW;
+import static com.android.ide.common.layout.LayoutConstants.FQCN_LINEAR_LAYOUT;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.w3c.dom.Element;
+
+import java.util.List;
+
+public class WrapInRefactoringTest extends RefactoringTest {
+
+ public void testWrapIn1() throws Exception {
+ // Test wrapping view: should indent view
+ checkRefactoring("sample3.xml", FQCN_LINEAR_LAYOUT, "@+id/button2");
+ }
+
+ public void testWrapIn2() throws Exception {
+ // Test wrapping the root: should move namespace
+ checkRefactoring("sample3.xml", FQCN_GESTURE_OVERLAY_VIEW, "@+id/newlinear");
+ }
+
+ public void testWrapIn3() throws Exception {
+ // Test wrap multiple adjacent elements - should wrap all as a unit
+ checkRefactoring("sample3.xml", FQCN_LINEAR_LAYOUT, "@+id/button2", "@+id/android_logo");
+ }
+
+ private void checkRefactoring(String basename, String fqcn, String... ids) throws Exception {
+ assertTrue(ids.length > 0);
+
+ IFile file = getLayoutFile(getProject(), basename);
+ TestContext info = setupTestContext(file, basename);
+ TestLayoutEditor layoutEditor = info.mLayoutEditor;
+ List<Element> selectedElements = getElements(info.mElement, ids);
+
+ WrapInRefactoring refactoring = new WrapInRefactoring(selectedElements,
+ layoutEditor);
+ refactoring.setType(fqcn);
+ List<Change> changes = refactoring.computeChanges(new NullProgressMonitor());
+ checkEdits(basename, changes);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror1.xml
new file mode 100644
index 0000000..d72f4ba
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror1.xml
@@ -0,0 +1,12 @@
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="50pt"
+ android:layout_marginLeft="50dp"
+ android:layout_marginBottom="50"
+ />
+</FrameLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror2.xml
new file mode 100644
index 0000000..b720daa
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror2.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <style name="repeatedStyle1">
+ <item name="android:gravity">left</item>
+ </style>
+ <style name="repeatedStyle1">
+ <item name="android:gravity">bottom</item>
+ </style>
+</resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror3.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror3.xml
new file mode 100644
index 0000000..bc9c134
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror3.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <style name="wrongAttribute">
+ <item name="nonexistent">5</item>
+ </style>
+</resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror4.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror4.xml
new file mode 100644
index 0000000..28dd467
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror4.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style>
+ <item />
+ </style>
+ <item></item>
+</resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror5.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror5.xml
new file mode 100644
index 0000000..ee89ac4
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror5.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="test">
+ <item name="android:layout_width"></item>
+ </style>
+</resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror6.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror6.xml
new file mode 100644
index 0000000..e552ff7
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror6.xml
@@ -0,0 +1,11 @@
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop=""
+ android:layout_marginLeft=''
+ />
+</FrameLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror7.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror7.xml
new file mode 100644
index 0000000..d47f4ae
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/aapterror7.xml
@@ -0,0 +1,10 @@
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+ <TextView
+ android:id=""
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ />
+</FrameLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion53.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion53.txt
new file mode 100644
index 0000000..3e44918
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion53.txt
@@ -0,0 +1,6 @@
+Code completion in anim1.xml for ^<set xmlns:
+<alpha />
+<rotate />
+<scale />
+<set ></set>
+<translate />
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion54.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion54.txt
new file mode 100644
index 0000000..f5e5cba
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion54.txt
@@ -0,0 +1,6 @@
+Code completion in anim1.xml for ^<translate android:id=:
+<alpha />
+<rotate />
+<scale />
+<set ></set>
+<translate />
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion55.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion55.txt
new file mode 100644
index 0000000..28b15d3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion55.txt
@@ -0,0 +1,16 @@
+Code completion in anim1.xml for android:^fromXDelta=:
+android:fromXDelta : [float, fraction]
+android:toXDelta : [float, fraction]
+android:fromYDelta : [float, fraction]
+android:toYDelta : [float, fraction]
+android:interpolator : Defines the interpolator used to smooth the animation movement in time. [reference]
+android:fillEnabled : When set to true, fillAfter is taken into account. [boolean]
+android:fillBefore : When set to true, the animation transformation is applied before the animation has started. [boolean]
+android:fillAfter : When set to true, the animation transformation is applied after the animation is over. [boolean]
+android:duration : Amount of time (in milliseconds) for the animation to run. [integer]
+android:startOffset : Delay in milliseconds before the animation runs, once start time is reached. [integer]
+android:repeatCount : Defines how many times the animation should repeat. [integer, enum]
+android:repeatMode : Defines the animation behavior when it reaches the end and the repeat count is greater than 0 or infinite. [enum]
+android:zAdjustment : Allows for an adjustment of the Z ordering of the content being animated for the duration of the animation. [enum]
+android:background : Special background behind animation. [reference, color]
+android:detachWallpaper : Special option for window animations: if this window is on top of a wallpaper, don't animate the wallpaper with it. [boolean]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion56.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion56.txt
new file mode 100644
index 0000000..632a9c5
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion56.txt
@@ -0,0 +1,14 @@
+Code completion in anim1.xml for android:^fromAlpha=:
+android:fromAlpha : [float]
+android:toAlpha : [float]
+android:interpolator : Defines the interpolator used to smooth the animation movement in time. [reference]
+android:fillEnabled : When set to true, fillAfter is taken into account. [boolean]
+android:fillBefore : When set to true, the animation transformation is applied before the animation has started. [boolean]
+android:fillAfter : When set to true, the animation transformation is applied after the animation is over. [boolean]
+android:duration : Amount of time (in milliseconds) for the animation to run. [integer]
+android:startOffset : Delay in milliseconds before the animation runs, once start time is reached. [integer]
+android:repeatCount : Defines how many times the animation should repeat. [integer, enum]
+android:repeatMode : Defines the animation behavior when it reaches the end and the repeat count is greater than 0 or infinite. [enum]
+android:zAdjustment : Allows for an adjustment of the Z ordering of the content being animated for the duration of the animation. [enum]
+android:background : Special background behind animation. [reference, color]
+android:detachWallpaper : Special option for window animations: if this window is on top of a wallpaper, don't animate the wallpaper with it. [boolean]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion57.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion57.txt
new file mode 100644
index 0000000..9225dac
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1-expected-completion57.txt
@@ -0,0 +1,3 @@
+Code completion in anim1.xml for android:fromXDelta="100^%p":
+100% : <b>Fraction</b> - a percentage of the base size
+100%p : <b>Fraction</b> - a percentage relative to parent container
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1.xml
new file mode 100644
index 0000000..48fefc2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/anim1.xml
@@ -0,0 +1,20 @@
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:id="@+id/test1"
+ android:fromXDelta="100%p"
+ android:pivotY="60%p"
+ android:toXDelta="40%p"
+ android:toYDelta="33%p"
+ android:fillBefore="true"
+ android:fillAfter="true"
+ android:startOffset="1000"
+ android:duration="1000" />
+ <alpha
+ android:id="@+id/test2"
+ android:fromAlpha="1.0"
+ android:toAlpha="0.0"
+ android:startOffset="3000"
+ android:duration="250"
+ android:fillBefore="true"
+ android:fillAfter="false"
+ />
+</set>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion58.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion58.txt
new file mode 100644
index 0000000..0759415
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion58.txt
@@ -0,0 +1,4 @@
+Code completion in animator1.xml for ^<set xmlns:
+<animator ></animator>
+<objectAnimator ></objectAnimator>
+<set ></set>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion59.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion59.txt
new file mode 100644
index 0000000..0702712
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion59.txt
@@ -0,0 +1,10 @@
+Code completion in animator1.xml for android:^duration="2000":
+android:propertyName : Name of the property being animated. [string]
+android:interpolator : Defines the interpolator used to smooth the animation movement in time. [reference]
+android:duration : Amount of time (in milliseconds) for the animation to run. [integer]
+android:startOffset : Delay in milliseconds before the animation runs, once start time is reached. [integer]
+android:repeatCount : Defines how many times the animation should repeat. [integer, enum]
+android:repeatMode : Defines the animation behavior when it reaches the end and the repeat count is greater than 0 or infinite. [enum]
+android:valueFrom : Value the animation starts from. [integer, float, color, dimension]
+android:valueTo : Value the animation animates to. [integer, float, color, dimension]
+android:valueType : The type of valueFrom and valueTo. [enum]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion60.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion60.txt
new file mode 100644
index 0000000..3e5e6b1
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion60.txt
@@ -0,0 +1,3 @@
+Code completion in animator1.xml for android:propertyName="scal^eX"/>:
+scaleX : scale of the view in the x direction.
+scaleY : scale of the view in the y direction.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion61.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion61.txt
new file mode 100644
index 0000000..d4618c2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1-expected-completion61.txt
@@ -0,0 +1,18 @@
+Code completion in animator1.xml for android:interpolator="^@android:anim/bounce_interpolator":
+@android:anim/accelerate_decelerate_interpolator
+@android:anim/accelerate_interpolator
+@android:anim/decelerate_interpolator
+@android:anim/anticipate_interpolator
+@android:anim/overshoot_interpolator
+@android:anim/anticipate_overshoot_interpolator
+@android:anim/bounce_interpolator
+@android:anim/linear_interpolator
+@android:anim/cycle_interpolator
+@android:
+@anim/
+@animator/
+@color/
+@drawable/
+@layout/
+@string/
+@style/
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1.xml
new file mode 100644
index 0000000..bdf10dc
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/animator1.xml
@@ -0,0 +1,27 @@
+<!-- Simple bounce animation -->
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:ordering="sequentially">
+ <set>
+ <objectAnimator
+ android:duration="2000"
+ android:valueTo="310"
+ android:propertyName="x"/>
+ <objectAnimator
+ android:duration="2000"
+ android:valueTo="130"
+ android:propertyName="y"
+ android:interpolator="@android:anim/bounce_interpolator"/>
+ <objectAnimator
+ android:duration="2000"
+ android:valueTo=".4"
+ android:propertyName="scaleX"/>
+ <objectAnimator
+ android:duration="2000"
+ android:valueTo=".4"
+ android:propertyName="scaleY"/>
+ </set>
+ <objectAnimator
+ android:duration="500"
+ android:valueTo="0"
+ android:propertyName="alpha"/>
+</set>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-applyCompletion15.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-applyCompletion15.diff
new file mode 100644
index 0000000..51a2cc9
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-applyCompletion15.diff
@@ -0,0 +1,4 @@
+Code completion in broken1.xml for android:textColorHigh^ selecting android:textColorHighlight:
+< android:textColorHigh^
+---
+> android:textColorHighlight="^"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-completion20.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-completion20.txt
new file mode 100644
index 0000000..0a4c2f4
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1-expected-completion20.txt
@@ -0,0 +1,2 @@
+Code completion in broken1.xml for android:textColorHigh^:
+android:textColorHighlight : Color of the text selection highlight. [reference, color]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1.xml
new file mode 100644
index 0000000..161b981
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken1.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <Button
+ android:text="@string/app_name"
+ android:textColorHigh
+ android:layout_marginLeft="@android:dimen/app_icon_size"
+ android:id="@+id/button1"
+ ></Button>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-applyCompletion16.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-applyCompletion16.diff
new file mode 100644
index 0000000..21437b9
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-applyCompletion16.diff
@@ -0,0 +1,4 @@
+Code completion in broken2.xml for style=^ selecting "@android:":
+< style=^
+---
+> style="@android:^"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-completion21.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-completion21.txt
new file mode 100644
index 0000000..96e8408
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2-expected-completion21.txt
@@ -0,0 +1,5 @@
+Code completion in broken2.xml for style=^:
+"@android:"
+"@drawable/"
+"@layout/"
+"@string/"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2.xml
new file mode 100644
index 0000000..60644b9
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken2.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <Button
+ android:text="@string/app_name"
+ android:layout_marginLeft="@android:dimen/app_icon_size"
+ style=
+ android:id="@+id/button1"
+ ></Button>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-applyCompletion14.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-applyCompletion14.diff
new file mode 100644
index 0000000..3e60eb9
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-applyCompletion14.diff
@@ -0,0 +1,4 @@
+Code completion in broken3.xml for <EditT^ selecting EditText />:
+< <EditT^
+---
+> <EditText ^/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-completion19.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-completion19.txt
new file mode 100644
index 0000000..ccc6a4c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3-expected-completion19.txt
@@ -0,0 +1,2 @@
+Code completion in broken3.xml for <EditT^:
+EditText />
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3.xml
new file mode 100644
index 0000000..b8b1685
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/broken3.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <EditT
+ <Button
+ android:text="@string/app_name"
+ android:layout_marginLeft="@android:dimen/app_icon_size"
+ android:id="@+id/button1"
+ ></Button>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion45.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion45.txt
new file mode 100644
index 0000000..c799b80
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion45.txt
@@ -0,0 +1,2 @@
+Code completion in color1.xml for ^<selector:
+<selector ></selector> : Required. This must be the root element. Contains one or more <item> elements.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46a.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46a.txt
new file mode 100644
index 0000000..32f0066
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46a.txt
@@ -0,0 +1,2 @@
+Code completion in color1.xml for ^<item android:
+<item /> : Drawable states.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46b.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46b.txt
new file mode 100644
index 0000000..7fcc5a9
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1-expected-completion46b.txt
@@ -0,0 +1,16 @@
+Code completion in color1.xml for <item ^android:state_focused="true"/>:
+android:state_focused : State value for StateListDrawable, set when a view has input focus. [boolean]
+android:state_window_focused : State value for StateListDrawable, set when a view's window has input focus. [boolean]
+android:state_enabled : State value for StateListDrawable, set when a view is enabled. [boolean]
+android:state_checkable : State identifier indicating that the object <var>may</var> display a check mark. [boolean]
+android:state_checked : State identifier indicating that the object is currently checked. [boolean]
+android:state_selected : State value for StateListDrawable, set when a view (or one of its parents) is currently selected. [boolean]
+android:state_pressed : State value for StateListDrawable, set when the user is pressing down in a view. [boolean]
+android:state_activated : State value for StateListDrawable, set when a view or its parent has been "activated" meaning the user has currently marked it as being of interest. [boolean]
+android:state_active : State value for StateListDrawable. [boolean]
+android:state_single : State value for StateListDrawable. [boolean]
+android:state_first : State value for StateListDrawable. [boolean]
+android:state_middle : State value for StateListDrawable. [boolean]
+android:state_last : State value for StateListDrawable. [boolean]
+android:state_accelerated : State value for StateListDrawable, indicating that the Drawable is in a view that is hardware accelerated. [boolean]
+android:color : Hexadeximal color. Required. The color is specified with an RGB value and optional alpha channel. The value always begins with a pound (#) character and then followed by the Alpha-Red-Green-Blue information in one of the following formats: * RGB * ARGB * RRGGBB * AARRGGBB
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1.xml
new file mode 100644
index 0000000..a8482ab
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/color1.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_focused="true"/>
+ <item />
+</selector>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-actual-applyCompletion1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-actual-applyCompletion1.xml
new file mode 100644
index 0000000..2413658
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-actual-applyCompletion1.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
+<!--
+ This file deliberately contains errors - it represents partial keyboard
+ typing for interactive code completion
+-->
+ <TextView
+ android:layout_weight^="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@android:dimen/app_icon_size"
+ android:layout_marginLeft="50dp"
+ android:layout_marginBottom="50"
+ android:textColor="#000000"
+ style="@android:style/Widget.Button"
+ android:gravity="left|bottom"
+ android:text="@string/hello"
+ android:hint="hint" />
+ <FrameLayout android:foreground="@android:drawable/btn_default"></FrameLayout>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion1.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion1.diff
new file mode 100644
index 0000000..d656509
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion1.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for layout_w^idth="fill_parent" selecting android:layout_weight:
+< android:layout_w^idth="fill_parent"
+---
+> android:layout_weight^="fill_parent"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion10.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion10.diff
new file mode 100644
index 0000000..824fa25
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion10.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for <T^extView selecting TableLayout:
+< <T^extView
+---
+> <TableLayout^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11a.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11a.diff
new file mode 100644
index 0000000..7f4ec86
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11a.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for ^<TextView selecting <RadioGroup ></RadioGroup>:
+< ^<TextView
+---
+> <RadioGroup ^></RadioGroup><TextView
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11b.diff
new file mode 100644
index 0000000..384c4a9
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion11b.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for ^<TextView selecting <CheckBox />:
+< ^<TextView
+---
+> <CheckBox ^/><TextView
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion12.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion12.diff
new file mode 100644
index 0000000..a4b7231
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion12.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for btn_default">^</FrameLayout> selecting <FrameLayout ></FrameLayout>:
+< <FrameLayout android:foreground="@android:drawable/btn_default">^</FrameLayout>
+---
+> <FrameLayout android:foreground="@android:drawable/btn_default"><FrameLayout ^></FrameLayout></FrameLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion2.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion2.diff
new file mode 100644
index 0000000..a410606
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion2.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for layout_width="^fill_parent" selecting match_parent:
+< android:layout_width="^fill_parent"
+---
+> android:layout_width="match_parent"^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion3.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion3.diff
new file mode 100644
index 0000000..578f8ea
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion3.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for layout_width="fi^ll_parent" selecting fill_parent:
+< android:layout_width="fi^ll_parent"
+---
+> android:layout_width="fill_parent"^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion39.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion39.diff
new file mode 100644
index 0000000..577089b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion39.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for marginBottom="50"^ selecting android:maxEms:
+< android:layout_marginBottom="50"^
+---
+> android:layout_marginBottom="50" android:maxEms="^"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion4.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion4.diff
new file mode 100644
index 0000000..ebbba89
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion4.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for marginBottom="50^" selecting 50mm:
+< android:layout_marginBottom="50^"
+---
+> android:layout_marginBottom="50mm"^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion5.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion5.diff
new file mode 100644
index 0000000..ba7cb0b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion5.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for layout_marginLeft="50d^p" selecting 50dp:
+< android:layout_marginLeft="50d^p"
+---
+> android:layout_marginLeft="50dp"^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion6.diff
new file mode 100644
index 0000000..f1e6465
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion6.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for style="@android:^style/Widget.Button" selecting @android:drawable/:
+< style="@android:^style/Widget.Button"
+---
+> style="@android:drawable/^"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7a.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7a.diff
new file mode 100644
index 0000000..1a577db
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7a.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for android:gravity="l^eft|bottom" selecting left:
+< android:gravity="l^eft|bottom"
+---
+> android:gravity="left^"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7b.diff
new file mode 100644
index 0000000..2560011
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion7b.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for android:gravity="left|b^ottom" selecting bottom:
+< android:gravity="left|b^ottom"
+---
+> android:gravity="left|bottom^"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion8.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion8.diff
new file mode 100644
index 0000000..655afc5
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion8.diff
@@ -0,0 +1,2 @@
+Code completion in completion1.xml for layout_width^="fill_parent" selecting android:layout_width:
+No changes \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion9.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion9.diff
new file mode 100644
index 0000000..05656fb
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-applyCompletion9.diff
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for layout_width=^"fill_parent" selecting "wrap_content":
+< android:layout_width=^"fill_parent"
+---
+> android:layout_width="wrap_content"^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion1.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion1.txt
new file mode 100644
index 0000000..949067a
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion1.txt
@@ -0,0 +1,3 @@
+Code completion in completion1.xml for layout_w^idth="fill_parent":
+android:layout_width : Specifies the basic width of the view. [dimension, enum]
+android:layout_weight : [float]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion10.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion10.txt
new file mode 100644
index 0000000..68efdfb
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion10.txt
@@ -0,0 +1,10 @@
+Code completion in completion1.xml for <T^extView:
+TabHost
+TabWidget
+TableLayout
+TableRow
+TextSwitcher
+TextView
+TimePicker
+ToggleButton
+TwoLineListItem
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion11.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion11.txt
new file mode 100644
index 0000000..9c1e396
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion11.txt
@@ -0,0 +1,60 @@
+Code completion in completion1.xml for ^<TextView:
+<AbsoluteLayout ></AbsoluteLayout>
+<AdapterViewFlipper ></AdapterViewFlipper>
+<AnalogClock />
+<AutoCompleteTextView />
+<Button />
+<CalendarView />
+<CheckBox />
+<CheckedTextView />
+<Chronometer />
+<DatePicker />
+<DialerFilter ></DialerFilter>
+<DigitalClock />
+<EditText />
+<ExpandableListView ></ExpandableListView>
+<FrameLayout ></FrameLayout>
+<Gallery />
+<GestureOverlayView /> : GestureOverlayView specific attributes.
+<GridView ></GridView>
+<HorizontalScrollView ></HorizontalScrollView>
+<ImageButton />
+<ImageSwitcher ></ImageSwitcher>
+<ImageView />
+<LinearLayout ></LinearLayout>
+<ListView ></ListView>
+<MediaController ></MediaController>
+<MultiAutoCompleteTextView />
+<NumberPicker />
+<ProgressBar />
+<QuickContactBadge />
+<RadioButton />
+<RadioGroup ></RadioGroup>
+<RatingBar />
+<RelativeLayout ></RelativeLayout>
+<ScrollView ></ScrollView>
+<SearchView ></SearchView>
+<SeekBar />
+<SlidingDrawer ></SlidingDrawer> : SlidingDrawer specific attributes.
+<Spinner />
+<StackView ></StackView>
+<SurfaceView />
+<TabHost ></TabHost>
+<TabWidget ></TabWidget>
+<TableLayout ></TableLayout>
+<TableRow ></TableRow>
+<TextSwitcher ></TextSwitcher>
+<TextView />
+<TimePicker />
+<ToggleButton />
+<TwoLineListItem />
+<VideoView />
+<View /> : Attributes that can be used with android.view.View or any of its subclasses.
+<ViewAnimator ></ViewAnimator>
+<ViewFlipper ></ViewFlipper>
+<ViewStub /> : A android.view.ViewStub lets you lazily include other XML layouts inside your application at runtime.
+<ViewSwitcher ></ViewSwitcher>
+<WebView />
+<ZoomButton />
+<ZoomControls />
+<include /> : Lets you statically include XML layouts inside other XML layouts.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt
new file mode 100644
index 0000000..fd41c10
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion12.txt
@@ -0,0 +1,60 @@
+Code completion in completion1.xml for btn_default">^</FrameLayout>:
+<AbsoluteLayout ></AbsoluteLayout>
+<AdapterViewFlipper ></AdapterViewFlipper>
+<AnalogClock />
+<AutoCompleteTextView />
+<Button />
+<CalendarView />
+<CheckBox />
+<CheckedTextView />
+<Chronometer />
+<DatePicker />
+<DialerFilter ></DialerFilter>
+<DigitalClock />
+<EditText />
+<ExpandableListView ></ExpandableListView>
+<FrameLayout ></FrameLayout>
+<Gallery />
+<GestureOverlayView /> : GestureOverlayView specific attributes.
+<GridView ></GridView>
+<HorizontalScrollView ></HorizontalScrollView>
+<ImageButton />
+<ImageSwitcher ></ImageSwitcher>
+<ImageView />
+<LinearLayout ></LinearLayout>
+<ListView ></ListView>
+<MediaController ></MediaController>
+<MultiAutoCompleteTextView />
+<NumberPicker />
+<ProgressBar />
+<QuickContactBadge />
+<RadioButton />
+<RadioGroup ></RadioGroup>
+<RatingBar />
+<RelativeLayout ></RelativeLayout>
+<ScrollView ></ScrollView>
+<SearchView ></SearchView>
+<SeekBar />
+<SlidingDrawer ></SlidingDrawer> : SlidingDrawer specific attributes.
+<Spinner />
+<StackView ></StackView>
+<SurfaceView />
+<TabHost ></TabHost>
+<TabWidget ></TabWidget>
+<TableLayout ></TableLayout>
+<TableRow ></TableRow>
+<TextSwitcher ></TextSwitcher>
+<TextView />
+<TimePicker />
+<ToggleButton />
+<TwoLineListItem />
+<VideoView />
+<View /> : Attributes that can be used with android.view.View or any of its subclasses.
+<ViewAnimator ></ViewAnimator>
+<ViewFlipper ></ViewFlipper>
+<ViewStub /> : A android.view.ViewStub lets you lazily include other XML layouts inside your application at runtime.
+<ViewSwitcher ></ViewSwitcher>
+<WebView />
+<ZoomButton />
+<ZoomControls />
+<include /> : Lets you statically include XML layouts inside other XML layouts.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion2.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion2.txt
new file mode 100644
index 0000000..136a6fe
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion2.txt
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for layout_width="^fill_parent":
+fill_parent
+match_parent
+wrap_content
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion3.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion3.txt
new file mode 100644
index 0000000..09c27ce
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion3.txt
@@ -0,0 +1,2 @@
+Code completion in completion1.xml for layout_width="fi^ll_parent":
+fill_parent
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion39.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion39.txt
new file mode 100644
index 0000000..d03f129
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion39.txt
@@ -0,0 +1,142 @@
+Code completion in completion1.xml for marginBottom="50"^:
+ style : A reference to a custom style [reference]
+ android:bufferType : Determines the minimum type that getText() will return. [enum]
+ android:text : Text to display. [string]
+ android:hint : Hint text to display when the text is empty. [string]
+ android:textColor : Text color. [reference, color]
+ android:textColorHighlight : Color of the text selection highlight. [reference, color]
+ android:textColorHint : Color of the hint text. [reference, color]
+ android:textAppearance : Base text color, typeface, size, and style. [reference]
+ android:textSize : Size of the text. [dimension]
+ android:textScaleX : Sets the horizontal scaling factor for the text. [float]
+ android:typeface : Typeface (normal, sans, serif, monospace) for the text. [enum]
+ android:textStyle : Style (bold, italic, bolditalic) for the text. [flag]
+ android:textColorLink : Text color for links. [reference, color]
+ android:cursorVisible : Makes the cursor visible (the default) or invisible. [boolean]
+ android:maxLines : Makes the TextView be at most this many lines tall. [integer]
+ android:maxHeight : Makes the TextView be at most this many pixels tall. [dimension]
+ android:lines : Makes the TextView be exactly this many lines tall. [integer]
+ android:height : Makes the TextView be exactly this many pixels tall. [dimension]
+ android:minLines : Makes the TextView be at least this many lines tall. [integer]
+ android:minHeight : Makes the TextView be at least this many pixels tall. [dimension]
+ android:maxEms : Makes the TextView be at most this many ems wide. [integer]
+ android:maxWidth : Makes the TextView be at most this many pixels wide. [dimension]
+ android:ems : Makes the TextView be exactly this many ems wide. [integer]
+ android:width : Makes the TextView be exactly this many pixels wide. [dimension]
+ android:minEms : Makes the TextView be at least this many ems wide. [integer]
+ android:minWidth : Makes the TextView be at least this many pixels wide. [dimension]
+ android:gravity : Specifies how to align the text by the view's x- and/or y-axis when the text is smaller than the view. [flag]
+ android:scrollHorizontally : Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally). [boolean]
+ android:password : Whether the characters of the field are displayed as password dots instead of themselves. * Deprecated: Use inputType instead. [boolean]
+ android:singleLine : Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. * Deprecated: This attribute is deprecated and is replaced by the textMultiLine flag in the inputType attribute. Use caution when altering existing layouts, as the default value of singeLine is false (multi-line mode), but if you specify any value for inputType, the default is single-line mode. (If both singleLine and inputType attributes are found, the inputType flags will override the value of singleLine.). [boolean]
+ android:enabled : Specifies whether the TextView is enabled or not. * Deprecated: Use state_enabled instead. [boolean]
+ android:selectAllOnFocus : If the text is selectable, select it all when the view takes focus instead of moving the cursor to the start or end. [boolean]
+ android:includeFontPadding : Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. [boolean]
+ android:maxLength : Set an input filter to constrain the text length to the specified number. [integer]
+ android:shadowColor : Place a shadow of the specified color behind the text. [color]
+ android:shadowDx : Horizontal offset of the shadow. [float]
+ android:shadowDy : Vertical offset of the shadow. [float]
+ android:shadowRadius : Radius of the shadow. [float]
+ android:autoLink : Controls whether links such as urls and email addresses are automatically found and converted to clickable links. [flag]
+ android:linksClickable : If set to false, keeps the movement method from being set to the link movement method even if autoLink causes links to be found. [boolean]
+ android:numeric : If set, specifies that this TextView has a numeric input method. * Deprecated: Use inputType instead. [flag]
+ android:digits : If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept. [string]
+ android:phoneNumber : If set, specifies that this TextView has a phone number input method. * Deprecated: Use inputType instead. [boolean]
+ android:inputMethod : If set, specifies that this TextView should use the specified input method (specified by fully-qualified class name). * Deprecated: Use inputType instead. [string]
+ android:capitalize : If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types. * Deprecated: Use inputType instead. [enum]
+ android:autoText : If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors. * Deprecated: Use inputType instead. [boolean]
+ android:editable : If set, specifies that this TextView has an input method. * Deprecated: Use inputType instead. [boolean]
+ android:freezesText : If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. [boolean]
+ android:ellipsize : If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle. [enum]
+ android:drawableTop : The drawable to be drawn above the text. [reference, color]
+ android:drawableBottom : The drawable to be drawn below the text. [reference, color]
+ android:drawableLeft : The drawable to be drawn to the left of the text. [reference, color]
+ android:drawableRight : The drawable to be drawn to the right of the text. [reference, color]
+ android:drawablePadding : The padding between the drawables and the text. [dimension]
+ android:lineSpacingExtra : Extra spacing between lines of text. [dimension]
+ android:lineSpacingMultiplier : Extra spacing between lines of text, as a multiplier. [float]
+ android:marqueeRepeatLimit : The number of times to repeat the marquee animation. [integer, enum]
+ android:inputType : The type of data being placed in a text field, used to help an input method decide how to let the user enter text. [flag]
+ android:imeOptions : Additional features you can enable in an IME associated with an editor to improve the integration with your application. [flag]
+ android:privateImeOptions : An addition content type description to supply to the input method attached to the text view, which is private to the implementation of the input method. [string]
+ android:imeActionLabel : Supply a value for EditorInfo.actionLabel used when an input method is connected to the text view. [string]
+ android:imeActionId : Supply a value for EditorInfo.actionId used when an input method is connected to the text view. [integer]
+ android:editorExtras : Reference to an "input-extras" XML resource containing additional data to supply to an input method, which is private to the implementation of the input method. [reference]
+ android:textSelectHandleLeft : Reference to a drawable that will be used to display a text selection anchor on the left side of a selection region. [reference]
+ android:textSelectHandleRight : Reference to a drawable that will be used to display a text selection anchor on the right side of a selection region. [reference]
+ android:textSelectHandle : Reference to a drawable that will be used to display a text selection anchor for positioning the cursor within text. [reference]
+ android:textEditPasteWindowLayout : The layout of the view that is displayed on top of the cursor to paste inside a TextEdit field. [reference]
+ android:textEditNoPasteWindowLayout : Variation of textEditPasteWindowLayout displayed when the clipboard is empty. [reference]
+ android:textEditSidePasteWindowLayout : Used instead of textEditPasteWindowLayout when the window is moved on the side of the insertion cursor because it would be clipped if it were positioned on top. [reference]
+ android:textEditSideNoPasteWindowLayout : Variation of textEditSidePasteWindowLayout displayed when the clipboard is empty. [reference]
+ android:textCursorDrawable : Reference to a drawable that will be drawn under the insertion cursor. [reference]
+ android:textIsSelectable : Indicates that the content of a non-editable text can be selected. [boolean]
+ android:id : Supply an identifier name for this view, to later retrieve it with View.findViewById() or Activity.findViewById(). [reference]
+ android:tag : Supply a tag for this view containing a String, to be retrieved later with View.getTag() or searched for with View.findViewWithTag() . [string]
+ android:scrollX : The initial horizontal scroll offset, in pixels. [dimension]
+ android:scrollY : The initial vertical scroll offset, in pixels. [dimension]
+ android:background : A drawable to use as the background. [reference, color]
+ android:padding : Sets the padding, in pixels, of all four edges. [dimension]
+ android:paddingLeft : Sets the padding, in pixels, of the left edge; see padding. [dimension]
+ android:paddingTop : Sets the padding, in pixels, of the top edge; see padding. [dimension]
+ android:paddingRight : Sets the padding, in pixels, of the right edge; see padding. [dimension]
+ android:paddingBottom : Sets the padding, in pixels, of the bottom edge; see padding. [dimension]
+ android:focusable : Boolean that controls whether a view can take focus. [boolean]
+ android:focusableInTouchMode : Boolean that controls whether a view can take focus while in touch mode. [boolean]
+ android:visibility : Controls the initial visibility of the view. [enum]
+ android:fitsSystemWindows : Boolean internal attribute to adjust view layout based on system windows such as the status bar. [boolean]
+ android:scrollbars : Defines which scrollbars should be displayed on scrolling or not. [flag]
+ android:scrollbarStyle : Controls the scrollbar style and position. [enum]
+ android:isScrollContainer : Set this if the view will serve as a scrolling container, meaing that it can be resized to shrink its overall window so that there will be space for an input method. [boolean]
+ android:fadeScrollbars : Defines whether to fade out scrollbars when they are not in use. [boolean]
+ android:scrollbarFadeDuration : Defines the delay in milliseconds that a scrollbar takes to fade out. [integer]
+ android:scrollbarDefaultDelayBeforeFade : Defines the delay in milliseconds that a scrollbar waits before fade out. [integer]
+ android:scrollbarSize : Sets the width of vertical scrollbars and height of horizontal scrollbars. [dimension]
+ android:scrollbarThumbHorizontal : Defines the horizontal scrollbar thumb drawable. [reference]
+ android:scrollbarThumbVertical : Defines the vertical scrollbar thumb drawable. [reference]
+ android:scrollbarTrackHorizontal : Defines the horizontal scrollbar track drawable. [reference]
+ android:scrollbarTrackVertical : Defines the vertical scrollbar track drawable. [reference]
+ android:scrollbarAlwaysDrawHorizontalTrack : Defines whether the horizontal scrollbar track should always be drawn. [boolean]
+ android:scrollbarAlwaysDrawVerticalTrack : Defines whether the vertical scrollbar track should always be drawn. [boolean]
+ android:fadingEdge : Defines which edges should be fadeded on scrolling. [flag]
+ android:fadingEdgeLength : Defines the length of the fading edges. [dimension]
+ android:nextFocusLeft : Defines the next view to give focus to when the next focus is FOCUS_LEFT. [reference]
+ android:nextFocusRight : Defines the next view to give focus to when the next focus is FOCUS_RIGHT If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+ android:nextFocusUp : Defines the next view to give focus to when the next focus is FOCUS_UP If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+ android:nextFocusDown : Defines the next view to give focus to when the next focus is FOCUS_DOWN If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+ android:nextFocusForward : Defines the next view to give focus to when the next focus is FOCUS_FORWARD If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+ android:clickable : Defines whether this view reacts to click events. [boolean]
+ android:longClickable : Defines whether this view reacts to long click events. [boolean]
+ android:saveEnabled : If unset, no state will be saved for this view when it is being frozen. [boolean]
+ android:filterTouchesWhenObscured : Specifies whether to filter touches when the view's window is obscured by another visible window. [boolean]
+ android:drawingCacheQuality : Defines the quality of translucent drawing caches. [enum]
+ android:keepScreenOn : Controls whether the view's window should keep the screen on while visible. [boolean]
+ android:duplicateParentState : When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself. [boolean]
+ android:minHeight : Defines the minimum height of the view.
+ android:minWidth : Defines the minimum width of the view.
+ android:soundEffectsEnabled : Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching. [boolean]
+ android:hapticFeedbackEnabled : Boolean that controls whether a view should have haptic feedback enabled for events such as long presses. [boolean]
+ android:contentDescription : Defines text that briefly describes content of the view. [string]
+ android:onClick : Name of the method in this View's context to invoke when the view is clicked. [string]
+ android:overScrollMode : Defines over-scrolling behavior. [enum]
+ android:alpha : alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque). [float]
+ android:translationX : translation in x of the view. [dimension]
+ android:translationY : translation in y of the view. [dimension]
+ android:transformPivotX : x location of the pivot point around which the view will rotate and scale. [dimension]
+ android:transformPivotY : y location of the pivot point around which the view will rotate and scale. [dimension]
+ android:rotation : rotation of the view, in degrees. [float]
+ android:rotationX : rotation of the view around the x axis, in degrees. [float]
+ android:rotationY : rotation of the view around the y axis, in degrees. [float]
+ android:scaleX : scale of the view in the x direction. [float]
+ android:scaleY : scale of the view in the y direction. [float]
+ android:verticalScrollbarPosition : Determines which side the vertical scroll bar should be placed on. [enum]
+ android:layerType : Specifies the type of layer backing this view. [enum]
+ android:layout_width : Specifies the basic width of the view. [dimension, enum]
+ android:layout_height : Specifies the basic height of the view. [dimension, enum]
+ android:layout_weight : [float]
+ android:layout_gravity : Standard gravity constant that a child can supply to its parent. [flag]
+ android:layout_margin : Specifies extra space on the left, top, right and bottom sides of this view. [dimension]
+ android:layout_marginLeft : Specifies extra space on the left side of this view. [dimension]
+ android:layout_marginTop : Specifies extra space on the top side of this view. [dimension]
+ android:layout_marginRight : Specifies extra space on the right side of this view. [dimension]
+ android:layout_marginBottom : Specifies extra space on the bottom side of this view. [dimension]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion4.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion4.txt
new file mode 100644
index 0000000..a9111eb
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion4.txt
@@ -0,0 +1,7 @@
+Code completion in completion1.xml for marginBottom="50^":
+50dp : <b>Density-independent Pixels</b> - an abstract unit that is based on the physical density of the screen.
+50sp : <b>Scale-independent Pixels</b> - this is like the dp unit, but it is also scaled by the user's font size preference.
+50pt : <b>Points</b> - 1/72 of an inch based on the physical size of the screen.
+50mm : <b>Millimeters</b> - based on the physical size of the screen.
+50in : <b>Inches</b> - based on the physical size of the screen.
+50px : <b>Pixels</b> - corresponds to actual pixels on the screen. Not recommended.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion5.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion5.txt
new file mode 100644
index 0000000..6b1c993
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion5.txt
@@ -0,0 +1,2 @@
+Code completion in completion1.xml for layout_marginLeft="50d^p":
+50dp : <b>Density-independent Pixels</b> - an abstract unit that is based on the physical density of the screen.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion6.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion6.txt
new file mode 100644
index 0000000..0853a83
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion6.txt
@@ -0,0 +1,22 @@
+Code completion in completion1.xml for style="@android:^style/Widget.Button":
+@android:style/
+@android:anim/
+@android:animator/
+@android:array/
+@android:bool/
+@android:color/
+@android:declare-styleable/
+@android:dimen/
+@android:drawable/
+@android:fraction/
+@android:id/
+@android:integer/
+@android:interpolator/
+@android:layout/
+@android:menu/
+@android:mipmap/
+@android:plurals/
+@android:public/
+@android:raw/
+@android:string/
+@android:xml/
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion7a.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion7a.txt
new file mode 100644
index 0000000..cf373ad
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion7a.txt
@@ -0,0 +1,2 @@
+Code completion in completion1.xml for android:gravity="l^eft|bottom":
+left
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion7b.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion7b.txt
new file mode 100644
index 0000000..66276d6
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion7b.txt
@@ -0,0 +1,2 @@
+Code completion in completion1.xml for android:gravity="left|b^ottom":
+bottom
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion8.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion8.txt
new file mode 100644
index 0000000..bee7f93
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion8.txt
@@ -0,0 +1,2 @@
+Code completion in completion1.xml for layout_width^="fill_parent":
+android:layout_width : Specifies the basic width of the view. [dimension, enum]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion9.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion9.txt
new file mode 100644
index 0000000..ab6a0d2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1-expected-completion9.txt
@@ -0,0 +1,4 @@
+Code completion in completion1.xml for layout_width=^"fill_parent":
+"fill_parent"
+"match_parent"
+"wrap_content"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1.xml
new file mode 100644
index 0000000..d523eeb
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion1.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
+<!--
+ This file deliberately contains errors - it represents partial keyboard
+ typing for interactive code completion
+-->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@android:dimen/app_icon_size"
+ android:layout_marginLeft="50dp"
+ android:layout_marginBottom="50"
+ android:textColor="#000000"
+ style="@android:style/Widget.Button"
+ android:gravity="left|bottom"
+ android:text="@string/hello"
+ android:hint="hint" />
+ <FrameLayout android:foreground="@android:drawable/btn_default"></FrameLayout>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13a.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13a.diff
new file mode 100644
index 0000000..13e224e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13a.diff
@@ -0,0 +1,4 @@
+Code completion in completion2.xml for gravity="left|bottom|^cen selecting fill_vertical:
+< <TextView android:gravity="left|bottom|^cen"></TextView>
+---
+> <TextView android:gravity="left|bottom|fill_vertical^"></TextView>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13b.diff
new file mode 100644
index 0000000..5d1b39e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13b.diff
@@ -0,0 +1,4 @@
+Code completion in completion2.xml for gravity="left|bottom|cen^ selecting center_horizontal:
+< <TextView android:gravity="left|bottom|cen^"></TextView>
+---
+> <TextView android:gravity="left|bottom|center_horizontal^"></TextView>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13c.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13c.diff
new file mode 100644
index 0000000..0c7e564
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-applyCompletion13c.diff
@@ -0,0 +1,4 @@
+Code completion in completion2.xml for gravity="left|bottom^|cen selecting bottom|fill_horizontal:
+< <TextView android:gravity="left|bottom^|cen"></TextView>
+---
+> <TextView android:gravity="left|bottom|fill_horizontal^"></TextView>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13a.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13a.txt
new file mode 100644
index 0000000..323bb78
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13a.txt
@@ -0,0 +1,13 @@
+Code completion in completion2.xml for gravity="left|bottom|^cen:
+top
+bottom
+left
+right
+center_vertical
+fill_vertical
+center_horizontal
+fill_horizontal
+center
+fill
+clip_vertical
+clip_horizontal
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13b.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13b.txt
new file mode 100644
index 0000000..8e6d4d8
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13b.txt
@@ -0,0 +1,4 @@
+Code completion in completion2.xml for gravity="left|bottom|cen^:
+center_vertical
+center_horizontal
+center
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13c.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13c.txt
new file mode 100644
index 0000000..3e292ce
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2-expected-completion13c.txt
@@ -0,0 +1,12 @@
+Code completion in completion2.xml for gravity="left|bottom^|cen:
+bottom
+bottom|top
+bottom|right
+bottom|center_vertical
+bottom|fill_vertical
+bottom|center_horizontal
+bottom|fill_horizontal
+bottom|center
+bottom|fill
+bottom|clip_vertical
+bottom|clip_horizontal
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2.xml
new file mode 100644
index 0000000..0921674
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion2.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Test multiple pipes in the flag value -->
+ <TextView android:gravity="left|bottom|cen"></TextView>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion17.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion17.diff
new file mode 100644
index 0000000..14bb9ac
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion17.diff
@@ -0,0 +1,4 @@
+Code completion in completion3.xml for <EditText ^/> selecting android:textColorHighlight:
+< <EditText ^/>
+---
+> <EditText android:textColorHighlight="^"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion18.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion18.diff
new file mode 100644
index 0000000..a751a3e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3-expected-applyCompletion18.diff
@@ -0,0 +1,4 @@
+Code completion in completion3.xml for <Button ^></Button> selecting android:paddingRight:
+< <Button ^></Button>
+---
+> <Button android:paddingRight="^"></Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3.xml
new file mode 100644
index 0000000..afb64b8
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion3.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
+ <EditText />
+ <Button ></Button>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion4-expected-completion22.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion4-expected-completion22.txt
new file mode 100644
index 0000000..c7170df
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion4-expected-completion22.txt
@@ -0,0 +1,2 @@
+Code completion in completion4.xml for <Button^:
+Button
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion4.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion4.xml
new file mode 100644
index 0000000..0047772
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion4.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <Button
+ android:text="@string/app_name"
+ android:layout_marginLeft="@android:dimen/app_icon_size"
+ android:id="@+id/button1"
+ ></Button>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion19.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion19.diff
new file mode 100644
index 0000000..16f42b2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion19.diff
@@ -0,0 +1,4 @@
+Code completion in completion5.xml for android:orientation='^' selecting horizontal:
+< android:orientation='^'
+---
+> android:orientation='horizontal'^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion20.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion20.diff
new file mode 100644
index 0000000..dd48af1
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion20.diff
@@ -0,0 +1,4 @@
+Code completion in completion5.xml for android:layout_marginTop='50^dp' selecting 50pt:
+< android:layout_marginTop='50^dp'
+---
+> android:layout_marginTop='50pt'^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion21.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion21.diff
new file mode 100644
index 0000000..40e5bb1
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion21.diff
@@ -0,0 +1,4 @@
+Code completion in completion5.xml for android:layout_width='^wrap_content' selecting match_parent:
+< android:layout_width='^wrap_content'
+---
+> android:layout_width='match_parent'^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion40.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion40.diff
new file mode 100644
index 0000000..00ffd0a
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-applyCompletion40.diff
@@ -0,0 +1,4 @@
+Code completion in completion5.xml for android:id='@+id/button2'^ selecting android:maxWidth:
+< android:id='@+id/button2'^
+---
+> android:id='@+id/button2' android:maxWidth="^"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-completion40.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-completion40.txt
new file mode 100644
index 0000000..0b5aa7e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5-expected-completion40.txt
@@ -0,0 +1,142 @@
+Code completion in completion5.xml for android:id='@+id/button2'^:
+ style : A reference to a custom style [reference]
+ android:bufferType : Determines the minimum type that getText() will return. [enum]
+ android:text : Text to display. [string]
+ android:hint : Hint text to display when the text is empty. [string]
+ android:textColor : Text color. [reference, color]
+ android:textColorHighlight : Color of the text selection highlight. [reference, color]
+ android:textColorHint : Color of the hint text. [reference, color]
+ android:textAppearance : Base text color, typeface, size, and style. [reference]
+ android:textSize : Size of the text. [dimension]
+ android:textScaleX : Sets the horizontal scaling factor for the text. [float]
+ android:typeface : Typeface (normal, sans, serif, monospace) for the text. [enum]
+ android:textStyle : Style (bold, italic, bolditalic) for the text. [flag]
+ android:textColorLink : Text color for links. [reference, color]
+ android:cursorVisible : Makes the cursor visible (the default) or invisible. [boolean]
+ android:maxLines : Makes the TextView be at most this many lines tall. [integer]
+ android:maxHeight : Makes the TextView be at most this many pixels tall. [dimension]
+ android:lines : Makes the TextView be exactly this many lines tall. [integer]
+ android:height : Makes the TextView be exactly this many pixels tall. [dimension]
+ android:minLines : Makes the TextView be at least this many lines tall. [integer]
+ android:minHeight : Makes the TextView be at least this many pixels tall. [dimension]
+ android:maxEms : Makes the TextView be at most this many ems wide. [integer]
+ android:maxWidth : Makes the TextView be at most this many pixels wide. [dimension]
+ android:ems : Makes the TextView be exactly this many ems wide. [integer]
+ android:width : Makes the TextView be exactly this many pixels wide. [dimension]
+ android:minEms : Makes the TextView be at least this many ems wide. [integer]
+ android:minWidth : Makes the TextView be at least this many pixels wide. [dimension]
+ android:gravity : Specifies how to align the text by the view's x- and/or y-axis when the text is smaller than the view. [flag]
+ android:scrollHorizontally : Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally). [boolean]
+ android:password : Whether the characters of the field are displayed as password dots instead of themselves. * Deprecated: Use inputType instead. [boolean]
+ android:singleLine : Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. * Deprecated: This attribute is deprecated and is replaced by the textMultiLine flag in the inputType attribute. Use caution when altering existing layouts, as the default value of singeLine is false (multi-line mode), but if you specify any value for inputType, the default is single-line mode. (If both singleLine and inputType attributes are found, the inputType flags will override the value of singleLine.). [boolean]
+ android:enabled : Specifies whether the TextView is enabled or not. * Deprecated: Use state_enabled instead. [boolean]
+ android:selectAllOnFocus : If the text is selectable, select it all when the view takes focus instead of moving the cursor to the start or end. [boolean]
+ android:includeFontPadding : Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. [boolean]
+ android:maxLength : Set an input filter to constrain the text length to the specified number. [integer]
+ android:shadowColor : Place a shadow of the specified color behind the text. [color]
+ android:shadowDx : Horizontal offset of the shadow. [float]
+ android:shadowDy : Vertical offset of the shadow. [float]
+ android:shadowRadius : Radius of the shadow. [float]
+ android:autoLink : Controls whether links such as urls and email addresses are automatically found and converted to clickable links. [flag]
+ android:linksClickable : If set to false, keeps the movement method from being set to the link movement method even if autoLink causes links to be found. [boolean]
+ android:numeric : If set, specifies that this TextView has a numeric input method. * Deprecated: Use inputType instead. [flag]
+ android:digits : If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept. [string]
+ android:phoneNumber : If set, specifies that this TextView has a phone number input method. * Deprecated: Use inputType instead. [boolean]
+ android:inputMethod : If set, specifies that this TextView should use the specified input method (specified by fully-qualified class name). * Deprecated: Use inputType instead. [string]
+ android:capitalize : If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types. * Deprecated: Use inputType instead. [enum]
+ android:autoText : If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors. * Deprecated: Use inputType instead. [boolean]
+ android:editable : If set, specifies that this TextView has an input method. * Deprecated: Use inputType instead. [boolean]
+ android:freezesText : If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. [boolean]
+ android:ellipsize : If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle. [enum]
+ android:drawableTop : The drawable to be drawn above the text. [reference, color]
+ android:drawableBottom : The drawable to be drawn below the text. [reference, color]
+ android:drawableLeft : The drawable to be drawn to the left of the text. [reference, color]
+ android:drawableRight : The drawable to be drawn to the right of the text. [reference, color]
+ android:drawablePadding : The padding between the drawables and the text. [dimension]
+ android:lineSpacingExtra : Extra spacing between lines of text. [dimension]
+ android:lineSpacingMultiplier : Extra spacing between lines of text, as a multiplier. [float]
+ android:marqueeRepeatLimit : The number of times to repeat the marquee animation. [integer, enum]
+ android:inputType : The type of data being placed in a text field, used to help an input method decide how to let the user enter text. [flag]
+ android:imeOptions : Additional features you can enable in an IME associated with an editor to improve the integration with your application. [flag]
+ android:privateImeOptions : An addition content type description to supply to the input method attached to the text view, which is private to the implementation of the input method. [string]
+ android:imeActionLabel : Supply a value for EditorInfo.actionLabel used when an input method is connected to the text view. [string]
+ android:imeActionId : Supply a value for EditorInfo.actionId used when an input method is connected to the text view. [integer]
+ android:editorExtras : Reference to an "input-extras" XML resource containing additional data to supply to an input method, which is private to the implementation of the input method. [reference]
+ android:textSelectHandleLeft : Reference to a drawable that will be used to display a text selection anchor on the left side of a selection region. [reference]
+ android:textSelectHandleRight : Reference to a drawable that will be used to display a text selection anchor on the right side of a selection region. [reference]
+ android:textSelectHandle : Reference to a drawable that will be used to display a text selection anchor for positioning the cursor within text. [reference]
+ android:textEditPasteWindowLayout : The layout of the view that is displayed on top of the cursor to paste inside a TextEdit field. [reference]
+ android:textEditNoPasteWindowLayout : Variation of textEditPasteWindowLayout displayed when the clipboard is empty. [reference]
+ android:textEditSidePasteWindowLayout : Used instead of textEditPasteWindowLayout when the window is moved on the side of the insertion cursor because it would be clipped if it were positioned on top. [reference]
+ android:textEditSideNoPasteWindowLayout : Variation of textEditSidePasteWindowLayout displayed when the clipboard is empty. [reference]
+ android:textCursorDrawable : Reference to a drawable that will be drawn under the insertion cursor. [reference]
+ android:textIsSelectable : Indicates that the content of a non-editable text can be selected. [boolean]
+ android:id : Supply an identifier name for this view, to later retrieve it with View.findViewById() or Activity.findViewById(). [reference]
+ android:tag : Supply a tag for this view containing a String, to be retrieved later with View.getTag() or searched for with View.findViewWithTag() . [string]
+ android:scrollX : The initial horizontal scroll offset, in pixels. [dimension]
+ android:scrollY : The initial vertical scroll offset, in pixels. [dimension]
+ android:background : A drawable to use as the background. [reference, color]
+ android:padding : Sets the padding, in pixels, of all four edges. [dimension]
+ android:paddingLeft : Sets the padding, in pixels, of the left edge; see padding. [dimension]
+ android:paddingTop : Sets the padding, in pixels, of the top edge; see padding. [dimension]
+ android:paddingRight : Sets the padding, in pixels, of the right edge; see padding. [dimension]
+ android:paddingBottom : Sets the padding, in pixels, of the bottom edge; see padding. [dimension]
+ android:focusable : Boolean that controls whether a view can take focus. [boolean]
+ android:focusableInTouchMode : Boolean that controls whether a view can take focus while in touch mode. [boolean]
+ android:visibility : Controls the initial visibility of the view. [enum]
+ android:fitsSystemWindows : Boolean internal attribute to adjust view layout based on system windows such as the status bar. [boolean]
+ android:scrollbars : Defines which scrollbars should be displayed on scrolling or not. [flag]
+ android:scrollbarStyle : Controls the scrollbar style and position. [enum]
+ android:isScrollContainer : Set this if the view will serve as a scrolling container, meaing that it can be resized to shrink its overall window so that there will be space for an input method. [boolean]
+ android:fadeScrollbars : Defines whether to fade out scrollbars when they are not in use. [boolean]
+ android:scrollbarFadeDuration : Defines the delay in milliseconds that a scrollbar takes to fade out. [integer]
+ android:scrollbarDefaultDelayBeforeFade : Defines the delay in milliseconds that a scrollbar waits before fade out. [integer]
+ android:scrollbarSize : Sets the width of vertical scrollbars and height of horizontal scrollbars. [dimension]
+ android:scrollbarThumbHorizontal : Defines the horizontal scrollbar thumb drawable. [reference]
+ android:scrollbarThumbVertical : Defines the vertical scrollbar thumb drawable. [reference]
+ android:scrollbarTrackHorizontal : Defines the horizontal scrollbar track drawable. [reference]
+ android:scrollbarTrackVertical : Defines the vertical scrollbar track drawable. [reference]
+ android:scrollbarAlwaysDrawHorizontalTrack : Defines whether the horizontal scrollbar track should always be drawn. [boolean]
+ android:scrollbarAlwaysDrawVerticalTrack : Defines whether the vertical scrollbar track should always be drawn. [boolean]
+ android:fadingEdge : Defines which edges should be fadeded on scrolling. [flag]
+ android:fadingEdgeLength : Defines the length of the fading edges. [dimension]
+ android:nextFocusLeft : Defines the next view to give focus to when the next focus is FOCUS_LEFT. [reference]
+ android:nextFocusRight : Defines the next view to give focus to when the next focus is FOCUS_RIGHT If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+ android:nextFocusUp : Defines the next view to give focus to when the next focus is FOCUS_UP If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+ android:nextFocusDown : Defines the next view to give focus to when the next focus is FOCUS_DOWN If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+ android:nextFocusForward : Defines the next view to give focus to when the next focus is FOCUS_FORWARD If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+ android:clickable : Defines whether this view reacts to click events. [boolean]
+ android:longClickable : Defines whether this view reacts to long click events. [boolean]
+ android:saveEnabled : If unset, no state will be saved for this view when it is being frozen. [boolean]
+ android:filterTouchesWhenObscured : Specifies whether to filter touches when the view's window is obscured by another visible window. [boolean]
+ android:drawingCacheQuality : Defines the quality of translucent drawing caches. [enum]
+ android:keepScreenOn : Controls whether the view's window should keep the screen on while visible. [boolean]
+ android:duplicateParentState : When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself. [boolean]
+ android:minHeight : Defines the minimum height of the view.
+ android:minWidth : Defines the minimum width of the view.
+ android:soundEffectsEnabled : Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching. [boolean]
+ android:hapticFeedbackEnabled : Boolean that controls whether a view should have haptic feedback enabled for events such as long presses. [boolean]
+ android:contentDescription : Defines text that briefly describes content of the view. [string]
+ android:onClick : Name of the method in this View's context to invoke when the view is clicked. [string]
+ android:overScrollMode : Defines over-scrolling behavior. [enum]
+ android:alpha : alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque). [float]
+ android:translationX : translation in x of the view. [dimension]
+ android:translationY : translation in y of the view. [dimension]
+ android:transformPivotX : x location of the pivot point around which the view will rotate and scale. [dimension]
+ android:transformPivotY : y location of the pivot point around which the view will rotate and scale. [dimension]
+ android:rotation : rotation of the view, in degrees. [float]
+ android:rotationX : rotation of the view around the x axis, in degrees. [float]
+ android:rotationY : rotation of the view around the y axis, in degrees. [float]
+ android:scaleX : scale of the view in the x direction. [float]
+ android:scaleY : scale of the view in the y direction. [float]
+ android:verticalScrollbarPosition : Determines which side the vertical scroll bar should be placed on. [enum]
+ android:layerType : Specifies the type of layer backing this view. [enum]
+ android:layout_width : Specifies the basic width of the view. [dimension, enum]
+ android:layout_height : Specifies the basic height of the view. [dimension, enum]
+ android:layout_weight : [float]
+ android:layout_gravity : Standard gravity constant that a child can supply to its parent. [flag]
+ android:layout_margin : Specifies extra space on the left, top, right and bottom sides of this view. [dimension]
+ android:layout_marginLeft : Specifies extra space on the left side of this view. [dimension]
+ android:layout_marginTop : Specifies extra space on the top side of this view. [dimension]
+ android:layout_marginRight : Specifies extra space on the right side of this view. [dimension]
+ android:layout_marginBottom : Specifies extra space on the bottom side of this view. [dimension]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5.xml
new file mode 100644
index 0000000..757be8b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion5.xml
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='utf-8'?>
+<LinearLayout
+ xmlns:android='http://schemas.android.com/apk/res/android'
+ android:layout_width='match_parent'
+ android:orientation=''
+ android:layout_height='match_parent'>
+ <Button
+ android:text="what's up doc?"
+ android:id='@+id/button1'
+ android:layout_marginTop='50dp'
+ android:layout_width='wrap_content'
+ android:layout_height='wrap_content'></Button>
+ <Button
+ android:text="quote='"
+ android:id='@+id/button2'
+ android:layout_width='wrap_content'
+ android:layout_height='wrap_content'></Button>
+ <Button
+ android:text='quote="'
+ android:id='@+id/button2'
+ android:layout_width='wrap_content'
+ android:layout_height='wrap_content'></Button>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6-expected-applyCompletion22.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6-expected-applyCompletion22.diff
new file mode 100644
index 0000000..8ea8837
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6-expected-applyCompletion22.diff
@@ -0,0 +1,4 @@
+Code completion in completion6.xml for android:orientation="^" selecting horizontal:
+< android:orientation="^"
+---
+> android:orientation="horizontal"^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6.xml
new file mode 100644
index 0000000..55bfa0c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion6.xml
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<LinearLayout
+ xmlns:android='http://schemas.android.com/apk/res/android'
+ android:layout_width='match_parent'
+ android:orientation=""
+ android:layout_height='match_parent'>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7-expected-applyCompletion23.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7-expected-applyCompletion23.diff
new file mode 100644
index 0000000..d874fc1
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7-expected-applyCompletion23.diff
@@ -0,0 +1,4 @@
+Code completion in completion7.xml for android:orientation="^ selecting horizontal:
+< android:orientation="^
+---
+> android:orientation="horizontal^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7.xml
new file mode 100644
index 0000000..30afbaf
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion7.xml
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<LinearLayout
+ xmlns:android='http://schemas.android.com/apk/res/android'
+ android:layout_width='match_parent'
+ android:orientation="
+ android:layout_height='match_parent'>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-applyCompletion41.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-applyCompletion41.diff
new file mode 100644
index 0000000..9a1b962
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-applyCompletion41.diff
@@ -0,0 +1,4 @@
+Code completion in completion8.xml for android:mar^="50dp" selecting android:layout_marginRight:
+< android:mar^="50dp"
+---
+> android:layout_marginRight^="50dp"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion41.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion41.txt
new file mode 100644
index 0000000..917d888
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion41.txt
@@ -0,0 +1,7 @@
+Code completion in completion8.xml for android:mar^="50dp":
+android:marqueeRepeatLimit : The number of times to repeat the marquee animation. [integer, enum]
+android:layout_margin : Specifies extra space on the left, top, right and bottom sides of this view. [dimension]
+android:layout_marginLeft : Specifies extra space on the left side of this view. [dimension]
+android:layout_marginTop : Specifies extra space on the top side of this view. [dimension]
+android:layout_marginRight : Specifies extra space on the right side of this view. [dimension]
+android:layout_marginBottom : Specifies extra space on the bottom side of this view. [dimension]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion42.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion42.txt
new file mode 100644
index 0000000..f51744d
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion42.txt
@@ -0,0 +1,4 @@
+Code completion in completion8.xml for android:w^i="100":
+android:width : Makes the TextView be exactly this many pixels wide. [dimension]
+android:layout_width : Specifies the basic width of the view. [dimension, enum]
+android:layout_weight : [float]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion43.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion43.txt
new file mode 100644
index 0000000..622a2ba
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion43.txt
@@ -0,0 +1,7 @@
+Code completion in completion8.xml for mar^="60dp":
+android:marqueeRepeatLimit : The number of times to repeat the marquee animation. [integer, enum]
+android:layout_margin : Specifies extra space on the left, top, right and bottom sides of this view. [dimension]
+android:layout_marginLeft : Specifies extra space on the left side of this view. [dimension]
+android:layout_marginTop : Specifies extra space on the top side of this view. [dimension]
+android:layout_marginRight : Specifies extra space on the right side of this view. [dimension]
+android:layout_marginBottom : Specifies extra space on the bottom side of this view. [dimension]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion44.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion44.txt
new file mode 100644
index 0000000..6f7f2d3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8-expected-completion44.txt
@@ -0,0 +1,10 @@
+Code completion in completion8.xml for android:layo^ut_width="fill_parent":
+android:layout_width : Specifies the basic width of the view. [dimension, enum]
+android:layout_height : Specifies the basic height of the view. [dimension, enum]
+android:layout_weight : [float]
+android:layout_gravity : Standard gravity constant that a child can supply to its parent. [flag]
+android:layout_margin : Specifies extra space on the left, top, right and bottom sides of this view. [dimension]
+android:layout_marginLeft : Specifies extra space on the left side of this view. [dimension]
+android:layout_marginTop : Specifies extra space on the top side of this view. [dimension]
+android:layout_marginRight : Specifies extra space on the right side of this view. [dimension]
+android:layout_marginBottom : Specifies extra space on the bottom side of this view. [dimension]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8.xml
new file mode 100644
index 0000000..3f9d6b5
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completion8.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:mar="50dp"
+ android:wi="100"
+ mar="60dp"
+ />
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24a.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24a.diff
new file mode 100644
index 0000000..4b88448
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24a.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for android:textS^ize selecting android:textSelectHandleLeft:
+< <item name="android:textS^ize">17sp</item>
+---
+> <item name="android:textSelectHandleLeft"^>17sp</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24b.diff
new file mode 100644
index 0000000..acfd3ab
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion24b.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for 17^sp selecting 17mm:
+< <item name="android:textSize">17^sp</item>
+---
+> <item name="android:textSize">17mm^</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion25.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion25.diff
new file mode 100644
index 0000000..ba7a1f2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion25.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for textColor">^@color/title_color</item> selecting @android::
+< <item name="android:textColor">^@color/title_color</item>
+---
+> <item name="android:textColor">@android:^</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion26.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion26.diff
new file mode 100644
index 0000000..491363b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion26.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="android:shadowColor">@an^</item> selecting @android::
+< <item name="android:shadowColor">@an^</item>
+---
+> <item name="android:shadowColor">@android:^</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion27.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion27.diff
new file mode 100644
index 0000000..1c999c7
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion27.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="android:gravity">^ </item> selecting center_vertical:
+< <item name="android:gravity">^ </item>
+---
+> <item name="android:gravity">center_vertical^</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion28.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion28.diff
new file mode 100644
index 0000000..fbfa7a8
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion28.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="android:gravity"> ^</item> selecting left:
+< <item name="android:gravity"> ^</item>
+---
+> <item name="android:gravity"> left^</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion29.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion29.diff
new file mode 100644
index 0000000..3e2cf0d
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion29.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="gr^"> selecting android:gravity:
+< <item name="gr^">@color/title_color</item>
+---
+> <item name="android:gravity"^>@color/title_color</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion30.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion30.diff
new file mode 100644
index 0000000..5f79eaf
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion30.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="an^"> selecting android:animateOnClick:
+< <item name="an^">@color/title_color</item>
+---
+> <item name="android:animateOnClick"^>@color/title_color</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion31.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion31.diff
new file mode 100644
index 0000000..8f83183
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion31.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item ^></item> selecting name:
+< <item ^></item>
+---
+> <item name="^"></item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion32.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion32.diff
new file mode 100644
index 0000000..1a68f13
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion32.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="^"></item> selecting android:background:
+< <item name="^"></item>
+---
+> <item name="android:background"^></item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion33.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion33.diff
new file mode 100644
index 0000000..1a61da3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion33.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="android:allowSingleTap">^</item> selecting true:
+< <item name="android:allowSingleTap">^</item>
+---
+> <item name="android:allowSingleTap">true^</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion34.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion34.diff
new file mode 100644
index 0000000..da4d30f
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion34.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="android:alwaysDrawnWithCache">^ false </item> selecting true:
+< <item name="android:alwaysDrawnWithCache">^ false </item>
+---
+> <item name="android:alwaysDrawnWithCache">true^</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion35.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion35.diff
new file mode 100644
index 0000000..4334c9f
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion35.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="android:alwaysDrawnWithCache"> ^false </item> selecting true:
+< <item name="android:alwaysDrawnWithCache"> ^false </item>
+---
+> <item name="android:alwaysDrawnWithCache"> true^</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion36.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion36.diff
new file mode 100644
index 0000000..2c9f547
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion36.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="android:alwaysDrawnWithCache"> f^alse </item> selecting false:
+< <item name="android:alwaysDrawnWithCache"> f^alse </item>
+---
+> <item name="android:alwaysDrawnWithCache"> false^</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion37.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion37.diff
new file mode 100644
index 0000000..195e159
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion37.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for <item name="android:orientation">h^</item> selecting horizontal:
+< <item name="android:orientation">h^</item>
+---
+> <item name="android:orientation">horizontal^</item>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion38.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion38.diff
new file mode 100644
index 0000000..0e81810
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-applyCompletion38.diff
@@ -0,0 +1,4 @@
+Code completion in completionvalues1.xml for c^ selecting center:
+< c^
+---
+> center^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion23.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion23.txt
new file mode 100644
index 0000000..28cc9ba
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion23.txt
@@ -0,0 +1,7 @@
+Code completion in completionvalues1.xml for android:textS^ize:
+android:textScaleX : Sets the horizontal scaling factor for the text. [float]
+android:textSelectHandle : Reference to a drawable that will be used to display a text selection anchor for positioning the cursor within text. [reference]
+android:textSelectHandleLeft : Reference to a drawable that will be used to display a text selection anchor on the left side of a selection region. [reference]
+android:textSelectHandleRight : Reference to a drawable that will be used to display a text selection anchor on the right side of a selection region. [reference]
+android:textSize : Size of the text. [dimension]
+android:textStyle : Style (bold, italic, bolditalic) for the text. [flag]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion24.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion24.txt
new file mode 100644
index 0000000..c1de9ec
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion24.txt
@@ -0,0 +1,7 @@
+Code completion in completionvalues1.xml for 17^sp:
+17dp : <b>Density-independent Pixels</b> - an abstract unit that is based on the physical density of the screen.
+17sp : <b>Scale-independent Pixels</b> - this is like the dp unit, but it is also scaled by the user's font size preference.
+17pt : <b>Points</b> - 1/72 of an inch based on the physical size of the screen.
+17mm : <b>Millimeters</b> - based on the physical size of the screen.
+17in : <b>Inches</b> - based on the physical size of the screen.
+17px : <b>Pixels</b> - corresponds to actual pixels on the screen. Not recommended.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion25.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion25.txt
new file mode 100644
index 0000000..06f5a99
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion25.txt
@@ -0,0 +1,6 @@
+Code completion in completionvalues1.xml for textColor">^@color/title_color</item>:
+@android:
+@drawable/
+@layout/
+@string/
+@style/
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion26.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion26.txt
new file mode 100644
index 0000000..b1c541c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion26.txt
@@ -0,0 +1,2 @@
+Code completion in completionvalues1.xml for <item name="android:shadowColor">@an^</item>:
+@android:
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion27.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion27.txt
new file mode 100644
index 0000000..5c870fe
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion27.txt
@@ -0,0 +1,13 @@
+Code completion in completionvalues1.xml for <item name="android:gravity">^ </item>:
+top
+bottom
+left
+right
+center_vertical
+fill_vertical
+center_horizontal
+fill_horizontal
+center
+fill
+clip_vertical
+clip_horizontal
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion28.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion28.txt
new file mode 100644
index 0000000..183a7aa
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion28.txt
@@ -0,0 +1,13 @@
+Code completion in completionvalues1.xml for <item name="android:gravity"> ^</item>:
+top
+bottom
+left
+right
+center_vertical
+fill_vertical
+center_horizontal
+fill_horizontal
+center
+fill
+clip_vertical
+clip_horizontal
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion29.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion29.txt
new file mode 100644
index 0000000..0ad8ad2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion29.txt
@@ -0,0 +1,3 @@
+Code completion in completionvalues1.xml for <item name="gr^">:
+android:gravity : Specifies how to place the content of an object, both on the x- and y-axis, within the object itself. [flag]
+android:groupIndicator : Indicator shown beside the group View. [reference]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion30.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion30.txt
new file mode 100644
index 0000000..1f18826
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion30.txt
@@ -0,0 +1,8 @@
+Code completion in completionvalues1.xml for <item name="an^">:
+android:
+android:animateFirstView : Defines whether to animate the current View when the ViewAnimation is first displayed. [boolean]
+android:animateLayoutChanges : Defines whether changes in layout (caused by adding and removing items) should cause a LayoutTransition to run. [boolean]
+android:animateOnClick : Indicates whether the drawer should be opened/closed with an animation when the user clicks the handle. [boolean]
+android:animationCache : Defines whether layout animations should create a drawing cache for their children. [boolean]
+android:animationDuration : Sets how long a transition animation should run (in milliseconds) when layout has changed. [integer]
+android:animationResolution : Timeout between frames of animation in milliseconds [integer]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion31.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion31.txt
new file mode 100644
index 0000000..9044164
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion31.txt
@@ -0,0 +1,2 @@
+Code completion in completionvalues1.xml for <item ^></item>:
+name : The mandatory name used in referring to this item.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion32.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion32.txt
new file mode 100644
index 0000000..0ca6e41
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion32.txt
@@ -0,0 +1,293 @@
+Code completion in completionvalues1.xml for <item name="^"></item>:
+android:
+android:addStatesFromChildren : Sets whether this ViewGroup's drawable states also include its children's drawable states. [boolean]
+android:adjustViewBounds : Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable. [boolean]
+android:allowSingleTap : Indicates whether the drawer can be opened/closed by a single tap on the handle. [boolean]
+android:alpha : alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque). [float]
+android:alwaysDrawnWithCache : Defines whether the ViewGroup should always draw its children using their drawing cache or not. [boolean]
+android:animateFirstView : Defines whether to animate the current View when the ViewAnimation is first displayed. [boolean]
+android:animateLayoutChanges : Defines whether changes in layout (caused by adding and removing items) should cause a LayoutTransition to run. [boolean]
+android:animateOnClick : Indicates whether the drawer should be opened/closed with an animation when the user clicks the handle. [boolean]
+android:animationCache : Defines whether layout animations should create a drawing cache for their children. [boolean]
+android:animationDuration : Sets how long a transition animation should run (in milliseconds) when layout has changed. [integer]
+android:animationResolution : Timeout between frames of animation in milliseconds [integer]
+android:autoLink : Controls whether links such as urls and email addresses are automatically found and converted to clickable links. [flag]
+android:autoStart : When true, automatically start animating [boolean]
+android:autoText : If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors. * Deprecated: Use inputType instead. [boolean]
+android:background : A drawable to use as the background. [reference, color]
+android:baseline : The offset of the baseline within this view. [dimension]
+android:baselineAlignBottom : If true, the image view will be baseline aligned with based on its bottom edge. [boolean]
+android:baselineAligned : When set to false, prevents the layout from aligning its children's baselines. [boolean]
+android:baselineAlignedChildIndex : When a linear layout is part of another layout that is baseline aligned, it can specify which of its children to baseline align to (that is, which child TextView). [integer]
+android:bottomOffset : Extra offset for the handle at the bottom of the SlidingDrawer. [dimension]
+android:bufferType : Determines the minimum type that getText() will return. [enum]
+android:button : Drawable used for the button graphic (e.g. checkbox, radio button, etc). [reference]
+android:cacheColorHint : Indicates that this list will always be drawn on top of solid, single-color opaque background. [color]
+android:calendarViewShown : Whether the calendar view is shown. [boolean]
+android:capitalize : If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types. * Deprecated: Use inputType instead. [enum]
+android:checkMark : Drawable used for the check mark graphic. [reference]
+android:checked : Indicates the initial checked state of this button. [boolean]
+android:checkedButton : The id of the child radio button that should be checked by default within this radio group. [integer]
+android:childDivider : Drawable or color that is used as a divider for children. [reference, color]
+android:childIndicator : Indicator shown beside the child View. [reference]
+android:childIndicatorLeft : The left bound for a child's indicator. [dimension]
+android:childIndicatorRight : The right bound for a child's indicator. [dimension]
+android:choiceMode : Defines the choice behavior for the view. [enum]
+android:clickable : Defines whether this view reacts to click events. [boolean]
+android:clipChildren : Defines whether a child is limited to draw inside of its bounds or not. [boolean]
+android:clipToPadding : Defines whether the ViewGroup will clip its drawing surface so as to exclude the padding area. [boolean]
+android:collapseColumns : The zero-based index of the columns to collapse. [string]
+android:columnWidth : Specifies the fixed width for each column. [dimension]
+android:completionHint : Defines the hint displayed in the drop down menu. [string]
+android:completionHintView : Defines the hint view displayed in the drop down menu. [reference]
+android:completionThreshold : Defines the number of characters that the user must type before completion suggestions are displayed in a drop down menu. [integer]
+android:content : Identifier for the child that represents the drawer's content. [reference]
+android:contentDescription : Defines text that briefly describes content of the view. [string]
+android:cropToPadding : If true, the image will be cropped to fit within its padding. [boolean]
+android:cursorVisible : Makes the cursor visible (the default) or invisible. [boolean]
+android:dateTextAppearance : The text appearance for the calendar dates. [reference]
+android:descendantFocusability : Defines the relationship between the ViewGroup and its descendants when looking for a View to take focus. [enum]
+android:dial : [reference]
+android:digits : If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept. [string]
+android:disabledAlpha : The alpha to apply to the indicator when disabled. [float]
+android:divider : Drawable to use as a vertical divider between buttons.
+android:dividerHeight : Height of the divider. [dimension]
+android:dividerPadding : Size of padding on either end of a divider. [dimension]
+android:drawSelectorOnTop : When set to true, the selector will be drawn over the selected item. [boolean]
+android:drawableBottom : The drawable to be drawn below the text. [reference, color]
+android:drawableLeft : The drawable to be drawn to the left of the text. [reference, color]
+android:drawablePadding : The padding between the drawables and the text. [dimension]
+android:drawableRight : The drawable to be drawn to the right of the text. [reference, color]
+android:drawableTop : The drawable to be drawn above the text. [reference, color]
+android:drawingCacheQuality : Defines the quality of translucent drawing caches. [enum]
+android:dropDownAnchor : View to anchor the auto-complete dropdown to. [reference]
+android:dropDownHeight : Specifies the basic height of the dropdown. [dimension, enum]
+android:dropDownHorizontalOffset : Horizontal offset from the spinner widget for positioning the dropdown in spinnerMode="dropdown". [dimension]
+android:dropDownSelector : List selector to use for spinnerMode="dropdown" display. [reference, color]
+android:dropDownVerticalOffset : Vertical offset from the spinner widget for positioning the dropdown in spinnerMode="dropdown". [dimension]
+android:dropDownWidth : Width of the dropdown in spinnerMode="dropdown". [dimension, enum]
+android:duplicateParentState : When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself. [boolean]
+android:editable : If set, specifies that this TextView has an input method. * Deprecated: Use inputType instead. [boolean]
+android:editorExtras : Reference to an "input-extras" XML resource containing additional data to supply to an input method, which is private to the implementation of the input method. [reference]
+android:ellipsize : If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle. [enum]
+android:ems : Makes the TextView be exactly this many ems wide. [integer]
+android:enabled : Specifies whether the TextView is enabled or not. * Deprecated: Use state_enabled instead. [boolean]
+android:endYear : The last year (inclusive), for example "2010". [integer]
+android:entries : Reference to an array resource that will populate the Spinner. [reference]
+android:eventsInterceptionEnabled : Defines whether the overlay should intercept the motion events when a gesture is recognized. [boolean]
+android:fadeDuration : Duration, in milliseconds, of the fade out effect after the user is done drawing a gesture. [integer]
+android:fadeEnabled : Defines whether the gesture will automatically fade out after being recognized. [boolean]
+android:fadeOffset : Time, in milliseconds, to wait before the gesture fades out after the user is done drawing it. [integer]
+android:fadeScrollbars : Defines whether to fade out scrollbars when they are not in use. [boolean]
+android:fadingEdge : Defines which edges should be fadeded on scrolling. [flag]
+android:fadingEdgeLength : Defines the length of the fading edges. [dimension]
+android:fastScrollAlwaysVisible : When set to true, the list will always show the fast scroll interface. [boolean]
+android:fastScrollEnabled : Enables the fast scroll thumb that can be dragged to quickly scroll through the list. [boolean]
+android:fillViewport : Defines whether the scrollview should stretch its content to fill the viewport. [boolean]
+android:filterTouchesWhenObscured : Specifies whether to filter touches when the view's window is obscured by another visible window. [boolean]
+android:firstDayOfWeek : The first day of week according to java.util.Calendar. [integer]
+android:fitsSystemWindows : Boolean internal attribute to adjust view layout based on system windows such as the status bar. [boolean]
+android:flingable : @hide Whether the number picker supports fligning. [boolean]
+android:flipInterval : [integer]
+android:focusable : Boolean that controls whether a view can take focus. [boolean]
+android:focusableInTouchMode : Boolean that controls whether a view can take focus while in touch mode. [boolean]
+android:focusedMonthDateColor : The color for the dates of the selected month. [reference, color]
+android:footerDividersEnabled : When set to false, the ListView will not draw the divider before each footer view. [boolean]
+android:foreground : Defines the drawable to draw over the content. [reference, color]
+android:foregroundGravity : Defines the gravity to apply to the foreground drawable. [flag]
+android:foregroundInsidePadding : Defines whether the foreground drawable should be drawn inside the padding. [boolean]
+android:format : Format string: if specified, the Chronometer will display this string, with the first "%s" replaced by the current timer value in "MM:SS" or "H:MM:SS" form. [string]
+android:freezesText : If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. [boolean]
+android:gestureColor : Color used to draw a gesture. [color]
+android:gestureStrokeAngleThreshold : Minimum curve angle a stroke must contain before it is recognized as a gesture. [float]
+android:gestureStrokeLengthThreshold : Minimum length of a stroke before it is recognized as a gesture. [float]
+android:gestureStrokeSquarenessThreshold : Squareness threshold of a stroke before it is recognized as a gesture. [float]
+android:gestureStrokeType : Defines the type of strokes that define a gesture. [enum]
+android:gestureStrokeWidth : Width of the stroke used to draw the gesture. [float]
+android:gravity : Specifies how to place the content of an object, both on the x- and y-axis, within the object itself. [flag]
+android:groupIndicator : Indicator shown beside the group View. [reference]
+android:hand_hour : [reference]
+android:hand_minute : [reference]
+android:handle : Identifier for the child that represents the drawer's handle. [reference]
+android:hapticFeedbackEnabled : Boolean that controls whether a view should have haptic feedback enabled for events such as long presses. [boolean]
+android:headerDividersEnabled : When set to false, the ListView will not draw the divider after each header view. [boolean]
+android:height : Makes the TextView be exactly this many pixels tall. [dimension]
+android:hint : Hint text to display when the text is empty. [string]
+android:horizontalSpacing : Defines the default horizontal spacing between columns. [dimension]
+android:iconifiedByDefault : The default state of the SearchView. [boolean]
+android:id : [reference]. * Required.
+android:ignoreGravity : Indicates what view should not be affected by gravity. [reference]
+android:imeActionId : Supply a value for EditorInfo.actionId used when an input method is connected to the text view. [integer]
+android:imeActionLabel : Supply a value for EditorInfo.actionLabel used when an input method is connected to the text view. [string]
+android:imeOptions : Additional features you can enable in an IME associated with an editor to improve the integration with your application. [flag]
+android:inAnimation : Identifier for the animation to use when a view is shown. [reference]
+android:includeFontPadding : Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. [boolean]
+android:indeterminate : Allows to enable the indeterminate mode. [boolean]
+android:indeterminateBehavior : Defines how the indeterminate mode should behave when the progress reaches max. [enum]
+android:indeterminateDrawable : Drawable used for the indeterminate mode. [reference]
+android:indeterminateDuration : Duration of the indeterminate animation. [integer]
+android:indeterminateOnly : Restricts to ONLY indeterminate mode (state-keeping progress mode will not work). [boolean]
+android:indicatorLeft : The left bound for an item's indicator. [dimension]
+android:indicatorRight : The right bound for an item's indicator. [dimension]
+android:inflatedId : Overrides the id of the inflated View with this value. [reference]
+android:inputMethod : If set, specifies that this TextView should use the specified input method (specified by fully-qualified class name). * Deprecated: Use inputType instead. [string]
+android:inputType : The type of data being placed in a text field, used to help an input method decide how to let the user enter text. [flag]
+android:interpolator : [reference]
+android:isIndicator : Whether this rating bar is an indicator (and non-changeable by the user). [boolean]
+android:isScrollContainer : Set this if the view will serve as a scrolling container, meaing that it can be resized to shrink its overall window so that there will be space for an input method. [boolean]
+android:keepScreenOn : Controls whether the view's window should keep the screen on while visible. [boolean]
+android:layerType : Specifies the type of layer backing this view. [enum]
+layout : [reference]. * Required.
+android:layoutAnimation : Defines the layout animation to use the first time the ViewGroup is laid out. [reference]
+android:lineSpacingExtra : Extra spacing between lines of text. [dimension]
+android:lineSpacingMultiplier : Extra spacing between lines of text, as a multiplier. [float]
+android:lines : Makes the TextView be exactly this many lines tall. [integer]
+android:linksClickable : If set to false, keeps the movement method from being set to the link movement method even if autoLink causes links to be found. [boolean]
+android:listSelector : Drawable used to indicate the currently selected item in the list. [reference, color]
+android:longClickable : Defines whether this view reacts to long click events. [boolean]
+android:loopViews : Defines whether the animator loops to the first view once it has reached the end of the list. [boolean]
+android:marqueeRepeatLimit : The number of times to repeat the marquee animation. [integer, enum]
+android:max : Defines the maximum value the progress can take. [integer]
+android:maxDate : The minimal date shown by this calendar view in mm/dd/yyyy format. [string]
+android:maxEms : Makes the TextView be at most this many ems wide. [integer]
+android:maxHeight : An optional argument to supply a maximum height for this view. [dimension]
+android:maxLength : Set an input filter to constrain the text length to the specified number. [integer]
+android:maxLines : Makes the TextView be at most this many lines tall. [integer]
+android:maxWidth : An optional argument to supply a maximum width for this view. [dimension]
+android:measureAllChildren : Determines whether to measure all children or just those in the VISIBLE or INVISIBLE state when measuring. [boolean]
+android:measureWithLargestChild : When set to true, all children with a weight will be considered having the minimum size of the largest child. [boolean]
+android:minDate : The minimal date shown by this calendar view in mm/dd/yyyy format. [string]
+android:minEms : Makes the TextView be at least this many ems wide. [integer]
+android:minHeight : Defines the minimum height of the view.
+android:minLines : Makes the TextView be at least this many lines tall. [integer]
+android:minWidth : Defines the minimum width of the view.
+android:mode : [enum]
+android:nextFocusDown : Defines the next view to give focus to when the next focus is FOCUS_DOWN If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+android:nextFocusForward : Defines the next view to give focus to when the next focus is FOCUS_FORWARD If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+android:nextFocusLeft : Defines the next view to give focus to when the next focus is FOCUS_LEFT. [reference]
+android:nextFocusRight : Defines the next view to give focus to when the next focus is FOCUS_RIGHT If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+android:nextFocusUp : Defines the next view to give focus to when the next focus is FOCUS_UP If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException will result when the reference is accessed. [reference]
+android:numColumns : Defines how many columns to show. [integer, enum]
+android:numStars : The number of stars (or rating items) to show. [integer]
+android:numeric : If set, specifies that this TextView has a numeric input method. * Deprecated: Use inputType instead. [flag]
+android:onClick : Name of the method in this View's context to invoke when the view is clicked. [string]
+android:orientation : Should the layout be a column or a row? Use "horizontal" for a row, "vertical" for a column. [enum]
+android:outAnimation : Identifier for the animation to use when a view is hidden. [reference]
+android:overScrollFooter : Drawable to draw below list content. [reference, color]
+android:overScrollHeader : Drawable to draw above list content. [reference, color]
+android:overScrollMode : Defines over-scrolling behavior. [enum]
+android:padding : Sets the padding, in pixels, of all four edges. [dimension]
+android:paddingBottom : Sets the padding, in pixels, of the bottom edge; see padding. [dimension]
+android:paddingLeft : Sets the padding, in pixels, of the left edge; see padding. [dimension]
+android:paddingRight : Sets the padding, in pixels, of the right edge; see padding. [dimension]
+android:paddingTop : Sets the padding, in pixels, of the top edge; see padding. [dimension]
+android:password : Whether the characters of the field are displayed as password dots instead of themselves. * Deprecated: Use inputType instead. [boolean]
+android:persistentDrawingCache : Defines the persistence of the drawing cache. [flag]
+android:phoneNumber : If set, specifies that this TextView has a phone number input method. * Deprecated: Use inputType instead. [boolean]
+android:popupBackground : Background drawable to use for the dropdown in spinnerMode="dropdown". [reference, color]
+android:popupPromptView : Reference to a layout to use for displaying a prompt in the dropdown for spinnerMode="dropdown". [reference]
+android:privateImeOptions : An addition content type description to supply to the input method attached to the text view, which is private to the implementation of the input method. [string]
+android:progress : Defines the default progress value, between 0 and max. [integer]
+android:progressDrawable : Drawable used for the progress mode. [reference]
+android:prompt : The prompt to display when the spinner's dialog is shown. [reference]
+android:queryHint : An optional query hint string to be displayed in the empty query field. [string]
+android:quickContactWindowSize : [enum]
+android:rating : The rating to set by default. [float]
+android:rotation : rotation of the view, in degrees. [float]
+android:rotationX : rotation of the view around the x axis, in degrees. [float]
+android:rotationY : rotation of the view around the y axis, in degrees. [float]
+android:saveEnabled : If unset, no state will be saved for this view when it is being frozen. [boolean]
+android:scaleType : Controls how the image should be resized or moved to match the size of this ImageView. [enum]
+android:scaleX : scale of the view in the x direction. [float]
+android:scaleY : scale of the view in the y direction. [float]
+android:scrollHorizontally : Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally). [boolean]
+android:scrollX : The initial horizontal scroll offset, in pixels. [dimension]
+android:scrollY : The initial vertical scroll offset, in pixels. [dimension]
+android:scrollbarAlwaysDrawHorizontalTrack : Defines whether the horizontal scrollbar track should always be drawn. [boolean]
+android:scrollbarAlwaysDrawVerticalTrack : Defines whether the vertical scrollbar track should always be drawn. [boolean]
+android:scrollbarDefaultDelayBeforeFade : Defines the delay in milliseconds that a scrollbar waits before fade out. [integer]
+android:scrollbarFadeDuration : Defines the delay in milliseconds that a scrollbar takes to fade out. [integer]
+android:scrollbarSize : Sets the width of vertical scrollbars and height of horizontal scrollbars. [dimension]
+android:scrollbarStyle : Controls the scrollbar style and position. [enum]
+android:scrollbarThumbHorizontal : Defines the horizontal scrollbar thumb drawable. [reference]
+android:scrollbarThumbVertical : Defines the vertical scrollbar thumb drawable. [reference]
+android:scrollbarTrackHorizontal : Defines the horizontal scrollbar track drawable. [reference]
+android:scrollbarTrackVertical : Defines the vertical scrollbar track drawable. [reference]
+android:scrollbars : Defines which scrollbars should be displayed on scrolling or not. [flag]
+android:scrollingCache : When set to true, the list uses a drawing cache during scrolling. [boolean]
+android:secondaryProgress : Defines the secondary progress value, between 0 and max. [integer]
+android:selectAllOnFocus : If the text is selectable, select it all when the view takes focus instead of moving the cursor to the start or end. [boolean]
+android:selectedDateVerticalBar : Drawable for the vertical bar shown at the beggining and at the end of a selected date. [reference]
+android:selectedWeekBackgroundColor : The background color for the selected week. [reference, color]
+android:selectionDivider : @hide The divider for making the selection area. [reference]
+android:selectionDividerHeight : @hide The height of the selection divider. [dimension]
+android:shadowColor : Place a shadow of the specified color behind the text. [color]
+android:shadowDx : Horizontal offset of the shadow. [float]
+android:shadowDy : Vertical offset of the shadow. [float]
+android:shadowRadius : Radius of the shadow. [float]
+android:showDividers : Setting for which dividers to show. [flag]
+android:showWeekNumber : Whether do show week numbers. [boolean]
+android:shownWeekCount : The number of weeks to be shown. [integer]
+android:shrinkColumns : The zero-based index of the columns to shrink. [string]
+android:singleLine : Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. * Deprecated: This attribute is deprecated and is replaced by the textMultiLine flag in the inputType attribute. Use caution when altering existing layouts, as the default value of singeLine is false (multi-line mode), but if you specify any value for inputType, the default is single-line mode. (If both singleLine and inputType attributes are found, the inputType flags will override the value of singleLine.). [boolean]
+android:smoothScrollbar : When set to true, the list will use a more refined calculation method based on the pixels height of the items visible on screen. [boolean]
+android:solidColor : @hide Color for the solid color background if such for optimized rendering. [reference, color]
+android:soundEffectsEnabled : Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching. [boolean]
+android:spacing : [dimension]
+android:spinnerMode : Display mode for spinner options. [enum]
+android:spinnersShown : Whether the spinners are shown. [boolean]
+android:splitMotionEvents : Sets whether this ViewGroup should split MotionEvents to separate child views during touch event dispatch. [boolean]
+android:src : Sets a drawable as the content of this ImageView. [reference, color]
+android:stackFromBottom : Used by ListView and GridView to stack their content from the bottom. [boolean]
+android:startYear : The first year (inclusive), for example "1940". [integer]
+android:stepSize : The step size of the rating. [float]
+android:stretchColumns : The zero-based index of the columns to stretch. [string]
+android:stretchMode : Defines how columns should stretch to fill the available empty space, if any. [enum]
+style : A reference to a custom style [reference]
+android:tabLayout : Layout used to organize each tab's content. [reference]
+android:tabStripEnabled : Determines whether the strip under the tab indicators is drawn or not. [boolean]
+android:tabStripLeft : Drawable used to draw the left part of the strip underneath the tabs. [reference]
+android:tabStripRight : Drawable used to draw the right part of the strip underneath the tabs. [reference]
+android:tag : Supply a tag for this view containing a String, to be retrieved later with View.getTag() or searched for with View.findViewWithTag() . [string]
+android:text : Text to display. [string]
+android:textAppearance : Base text color, typeface, size, and style. [reference]
+android:textColor : Text color. [reference, color]
+android:textColorHighlight : Color of the text selection highlight. [reference, color]
+android:textColorHint : Color of the hint text. [reference, color]
+android:textColorLink : Text color for links. [reference, color]
+android:textCursorDrawable : Reference to a drawable that will be drawn under the insertion cursor. [reference]
+android:textEditNoPasteWindowLayout : Variation of textEditPasteWindowLayout displayed when the clipboard is empty. [reference]
+android:textEditPasteWindowLayout : The layout of the view that is displayed on top of the cursor to paste inside a TextEdit field. [reference]
+android:textEditSideNoPasteWindowLayout : Variation of textEditSidePasteWindowLayout displayed when the clipboard is empty. [reference]
+android:textEditSidePasteWindowLayout : Used instead of textEditPasteWindowLayout when the window is moved on the side of the insertion cursor because it would be clipped if it were positioned on top. [reference]
+android:textFilterEnabled : When set to true, the list will filter results as the user types. [boolean]
+android:textIsSelectable : Indicates that the content of a non-editable text can be selected. [boolean]
+android:textOff : The text for the button when it is not checked. [string]
+android:textOn : The text for the button when it is checked. [string]
+android:textScaleX : Sets the horizontal scaling factor for the text. [float]
+android:textSelectHandle : Reference to a drawable that will be used to display a text selection anchor for positioning the cursor within text. [reference]
+android:textSelectHandleLeft : Reference to a drawable that will be used to display a text selection anchor on the left side of a selection region. [reference]
+android:textSelectHandleRight : Reference to a drawable that will be used to display a text selection anchor on the right side of a selection region. [reference]
+android:textSize : Size of the text. [dimension]
+android:textStyle : Style (bold, italic, bolditalic) for the text. [flag]
+android:thumb : Draws the thumb on a seekbar. [reference]
+android:thumbOffset : An offset for the thumb that allows it to extend out of the range of the track. [dimension]
+android:tint : Set a tinting color for the image. [color]
+android:topOffset : Extra offset for the handle at the top of the SlidingDrawer. [dimension]
+android:transcriptMode : Sets the transcript mode for the list. [enum]
+android:transformPivotX : x location of the pivot point around which the view will rotate and scale. [dimension]
+android:transformPivotY : y location of the pivot point around which the view will rotate and scale. [dimension]
+android:translationX : translation in x of the view. [dimension]
+android:translationY : translation in y of the view. [dimension]
+android:typeface : Typeface (normal, sans, serif, monospace) for the text. [enum]
+android:uncertainGestureColor : Color used to draw the user's strokes until we are sure it's a gesture. [color]
+android:unfocusedMonthDateColor : The color for the dates of an unfocused month. [reference, color]
+android:unselectedAlpha : Sets the alpha on the items that are not selected. [float]
+android:verticalScrollbarPosition : Determines which side the vertical scroll bar should be placed on. [enum]
+android:verticalSpacing : Defines the default vertical spacing between rows. [dimension]
+android:visibility : Controls the initial visibility of the view. [enum]
+android:weekDayTextAppearance : The text appearance for the week day abbreviation of the calendar header. [reference]
+android:weekNumberColor : The color for the week numbers. [reference, color]
+android:weekSeparatorLineColor : The color for the sepatator line between weeks. [reference, color]
+android:weightSum : Defines the maximum weight sum. [float]
+android:width : Makes the TextView be exactly this many pixels wide. [dimension]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion33.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion33.txt
new file mode 100644
index 0000000..f9c008d
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion33.txt
@@ -0,0 +1,3 @@
+Code completion in completionvalues1.xml for <item name="android:allowSingleTap">^</item>:
+true
+false
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion34.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion34.txt
new file mode 100644
index 0000000..861a413
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion34.txt
@@ -0,0 +1,3 @@
+Code completion in completionvalues1.xml for <item name="android:alwaysDrawnWithCache">^ false </item>:
+true
+false
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion35.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion35.txt
new file mode 100644
index 0000000..25e8a0b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion35.txt
@@ -0,0 +1,3 @@
+Code completion in completionvalues1.xml for <item name="android:alwaysDrawnWithCache"> ^false </item>:
+true
+false
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion36.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion36.txt
new file mode 100644
index 0000000..d85133f
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion36.txt
@@ -0,0 +1,2 @@
+Code completion in completionvalues1.xml for <item name="android:alwaysDrawnWithCache"> f^alse </item>:
+false
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion37.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion37.txt
new file mode 100644
index 0000000..1d41351
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion37.txt
@@ -0,0 +1,2 @@
+Code completion in completionvalues1.xml for <item name="android:orientation">h^</item>:
+horizontal
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion38.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion38.txt
new file mode 100644
index 0000000..8819bcd
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1-expected-completion38.txt
@@ -0,0 +1,6 @@
+Code completion in completionvalues1.xml for c^:
+center_vertical
+center_horizontal
+center
+clip_vertical
+clip_horizontal
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1.xml
new file mode 100644
index 0000000..89b5f46
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/completionvalues1.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <style name="stylename">
+ <item name="android:textSize">17sp</item>
+ <item name="android:textColor">@color/title_color</item>
+ <item name="android:shadowColor">@an</item>
+ <item name="android:gravity"> </item>
+ <item name="gr">@color/title_color</item>
+ <item name="an">@color/title_color</item>
+ <item ></item>
+ <item name=""></item>
+ <item name="android:allowSingleTap"></item>
+ <item name="android:alwaysDrawnWithCache"> false </item>
+ <item name="android:orientation">h</item>
+ <item name="android:gravity">
+ c
+ </item>
+ </style>
+</resources>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion47.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion47.txt
new file mode 100644
index 0000000..edf4892
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion47.txt
@@ -0,0 +1,13 @@
+Code completion in drawable1.xml for ^<layer-list:
+<animated-rotate />
+<animation-list /> : Drawable used to render several animated frames.
+<bitmap /> : Drawable used to draw bitmaps.
+<clip />
+<color /> : Drawable used to draw a single color.
+<inset />
+<layer-list ></layer-list> : Drawable used to render several drawables stacked on top of each other.
+<nine-patch /> : Drawable used to draw 9-patches.
+<rotate /> : Drawable used to rotate another drawable.
+<scale />
+<selector ></selector> : Drawable used to render several states.
+<shape ></shape> : Drawable used to render a geometric shape, with a gradient or a solid color.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion48.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion48.txt
new file mode 100644
index 0000000..f98bb4c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion48.txt
@@ -0,0 +1,3 @@
+Code completion in drawable1.xml for ^xmlns:android:
+android:opacity : Indicates the opacity of the layer. [enum]
+xmlns:android
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion49.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion49.txt
new file mode 100644
index 0000000..4d3dfe3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion49.txt
@@ -0,0 +1,7 @@
+Code completion in drawable1.xml for <item ^></item>:
+android:left : Left coordinate of the layer. [dimension]
+android:top : Top coordinate of the layer. [dimension]
+android:right : Right coordinate of the layer. [dimension]
+android:bottom : Bottom coordinate of the layer. [dimension]
+android:drawable : Drawable used to render the layer. [reference]
+android:id : Identifier of the layer. [reference]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion50.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion50.txt
new file mode 100644
index 0000000..90eab10
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1-expected-completion50.txt
@@ -0,0 +1,13 @@
+Code completion in drawable1.xml for <item >^</item>:
+<animated-rotate />
+<animation-list /> : Drawable used to render several animated frames.
+<bitmap /> : Drawable used to draw bitmaps.
+<clip />
+<color /> : Drawable used to draw a single color.
+<inset />
+<layer-list ></layer-list> : Drawable used to render several drawables stacked on top of each other.
+<nine-patch /> : Drawable used to draw 9-patches.
+<rotate /> : Drawable used to rotate another drawable.
+<scale />
+<selector ></selector> : Drawable used to render several states.
+<shape ></shape> : Drawable used to render a geometric shape, with a gradient or a solid color.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1.xml
new file mode 100644
index 0000000..9513f17
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable1.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item ></item>
+</layer-list>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2-expected-completion51.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2-expected-completion51.txt
new file mode 100644
index 0000000..1471845
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2-expected-completion51.txt
@@ -0,0 +1,10 @@
+Code completion in drawable2.xml for ^android:innerRadiusRatio="2":
+android:visible : Indicates whether the drawable should intially be visible. [boolean]
+android:dither : Enables or disables dithering. [boolean]
+android:shape : Indicates what shape to fill with a gradient. [enum]
+android:innerRadiusRatio : Inner radius of the ring expressed as a ratio of the ring's width. [float]
+android:thicknessRatio : Thickness of the ring expressed as a ratio of the ring's width. [float]
+android:innerRadius : Inner radius of the ring. [dimension]
+android:thickness : Thickness of the ring. [dimension]
+android:useLevel : Indicates whether the drawable's level affects the way the gradient is drawn.
+xmlns:android
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2-expected-completion52.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2-expected-completion52.txt
new file mode 100644
index 0000000..2a28533
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2-expected-completion52.txt
@@ -0,0 +1,7 @@
+Code completion in drawable2.xml for ^<gradient:
+<corners /> : Describes the corners for the rectangle shape of a GradientDrawable.
+<gradient /> : Used to describe the gradient used to fill the shape of a GradientDrawable.
+<padding /> : Used to specify the optional padding of a GradientDrawable.
+<size /> : Used to specify the size of the shape for GradientDrawable.
+<solid /> : Used to fill the shape of GradientDrawable with a solid color.
+<stroke /> : Used to describe the optional stroke of a GradientDrawable.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2.xml
new file mode 100644
index 0000000..c6a672f
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/drawable2.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:innerRadiusRatio="2">
+ <gradient />
+</shape>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1b.diff
new file mode 100644
index 0000000..d734ccf
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1b.diff
@@ -0,0 +1,3 @@
+< <Button android:text="Button"
+---
+> <Button style="@style/newstyle" android:text="Button"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1c.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1c.diff
new file mode 100644
index 0000000..2ebc91d
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1c.diff
@@ -0,0 +1,4 @@
+ android:layout_width="wrap_content" android:layout_height="fill_parent"
+< android:textColor="#FF00FF" android:textSize="20pt"
+ </FrameLayout>
+---
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1d.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1d.diff
new file mode 100644
index 0000000..ec560b3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract1d.diff
@@ -0,0 +1,6 @@
+< <Button android:text="Button"
+< android:layout_width="wrap_content" android:layout_height="fill_parent"
+< android:textColor="#FF00FF" android:textSize="20pt"
+---
+> <Button style="@style/newstyle" android:text="Button"
+> android:layout_width="wrap_content" android:layout_height="fill_parent"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract2.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract2.diff
new file mode 100644
index 0000000..ec560b3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract2.diff
@@ -0,0 +1,6 @@
+< <Button android:text="Button"
+< android:layout_width="wrap_content" android:layout_height="fill_parent"
+< android:textColor="#FF00FF" android:textSize="20pt"
+---
+> <Button style="@style/newstyle" android:text="Button"
+> android:layout_width="wrap_content" android:layout_height="fill_parent"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract3.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract3.diff
new file mode 100644
index 0000000..f7fd22b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract3.diff
@@ -0,0 +1,15 @@
+< <Button android:text="Button"
+< android:layout_width="wrap_content" android:layout_height="wrap_content"
+< android:textColor="#FF0000" android:textSize="20pt"
+< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button>
+< <Button android:text="Button"
+< android:layout_width="wrap_content" android:layout_height="fill_parent"
+< android:textColor="#FF00FF" android:textSize="20pt"
+< android:id="@+id/button2" android:layout_alignParentBottom="true"></Button>
+---
+> <Button style="@style/newstyle" android:text="Button"
+> android:layout_width="wrap_content" android:layout_height="wrap_content"
+> android:id="@+id/button1" android:layout_alignParentBottom="true"></Button>
+> <Button style="@style/newstyle" android:text="Button"
+> android:layout_width="wrap_content" android:layout_height="fill_parent"
+> android:textColor="#FF00FF" android:id="@+id/button2" android:layout_alignParentBottom="true"></Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract4.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract4.diff
new file mode 100644
index 0000000..a8e2af4
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract4.diff
@@ -0,0 +1,7 @@
+< <Button android:text="Button"
+< android:layout_width="wrap_content" android:layout_height="fill_parent"
+< android:textColor="#FF00FF" android:textSize="20pt"
+---
+> <Button style="@style/newstyle" android:text="Button"
+> android:layout_width="wrap_content" android:layout_height="fill_parent"
+> android:textSize="20pt"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract5.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract5.diff
new file mode 100644
index 0000000..bcaff2a
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract5.diff
@@ -0,0 +1,8 @@
+< <Button android:text="Button"
+< android:layout_width="wrap_content" android:layout_height="wrap_content"
+< android:textColor="#FF0000" android:textSize="20pt"
+< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button>
+---
+> <Button style="@style/newstyle" android:text="Button"
+> android:layout_width="wrap_content" android:layout_height="wrap_content"
+> android:textColor="#FF0000" android:id="@+id/button1" android:layout_alignParentBottom="true"></Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract6.diff
new file mode 100644
index 0000000..1db5e38
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract6.diff
@@ -0,0 +1,6 @@
+< <Button android:text="Button"
+< android:layout_width="wrap_content" android:layout_height="wrap_content"
+< android:textColor="#FF0000" android:textSize="20pt"
+< android:id="@+id/button1" android:layout_alignParentBottom="true"></Button>
+---
+> <Button style="@style/newstyle" android:id="@+id/button1" ></Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract8.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract8.diff
new file mode 100644
index 0000000..2ebc91d
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1-expected-extract8.diff
@@ -0,0 +1,4 @@
+ android:layout_width="wrap_content" android:layout_height="fill_parent"
+< android:textColor="#FF00FF" android:textSize="20pt"
+ </FrameLayout>
+---
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1.info
new file mode 100644
index 0000000..69f7739
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1.info
@@ -0,0 +1,3 @@
+android.widget.LinearLayout [0,36,140,320] <LinearLayout>
+ android.widget.Button [0,0,140,62] <Button>
+ android.widget.Button [0,62,140,284] <Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1.xml
new file mode 100644
index 0000000..64c49b2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle1.xml
@@ -0,0 +1,11 @@
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content" android:layout_height="match_parent">
+ <Button android:text="Button"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:textColor="#FF0000" android:textSize="20pt"
+ android:id="@+id/button1" android:layout_alignParentBottom="true"></Button>
+ <Button android:text="Button"
+ android:layout_width="wrap_content" android:layout_height="fill_parent"
+ android:textColor="#FF00FF" android:textSize="20pt"
+ android:id="@+id/button2" android:layout_alignParentBottom="true"></Button>
+</FrameLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2-expected-extract7.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2-expected-extract7.diff
new file mode 100644
index 0000000..84c2ad7
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2-expected-extract7.diff
@@ -0,0 +1,13 @@
+< <Button foo:text="Button"
+< foo:layout_width="wrap_content" foo:layout_height="wrap_content"
+< foo:textColor="#FF0000" foo:textSize="20pt"
+< foo:id="@+id/button1" foo:layout_alignParentBottom="true"></Button>
+< <Button foo:text="Button"
+< foo:layout_width="wrap_content" foo:layout_height="fill_parent"
+< foo:textColor="#00FF00" foo:textSize="20pt"
+---
+> <Button style="@style/newstyle" foo:text="Button"
+> foo:layout_width="wrap_content" foo:layout_height="wrap_content"
+> foo:textColor="#FF0000" foo:id="@+id/button1" foo:layout_alignParentBottom="true"></Button>
+> <Button style="@style/newstyle" foo:text="Button"
+> foo:layout_width="wrap_content" foo:layout_height="fill_parent"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2.info
new file mode 100644
index 0000000..69f7739
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2.info
@@ -0,0 +1,3 @@
+android.widget.LinearLayout [0,36,140,320] <LinearLayout>
+ android.widget.Button [0,0,140,62] <Button>
+ android.widget.Button [0,62,140,284] <Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2.xml
new file mode 100644
index 0000000..3cb966f
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/extractstyle2.xml
@@ -0,0 +1,11 @@
+<LinearLayout xmlns:foo="http://schemas.android.com/apk/res/android"
+ foo:layout_width="wrap_content" foo:layout_height="match_parent" foo:orientation="vertical">
+ <Button foo:text="Button"
+ foo:layout_width="wrap_content" foo:layout_height="wrap_content"
+ foo:textColor="#FF0000" foo:textSize="20pt"
+ foo:id="@+id/button1" foo:layout_alignParentBottom="true"></Button>
+ <Button foo:text="Button"
+ foo:layout_width="wrap_content" foo:layout_height="fill_parent"
+ foo:textColor="#00FF00" foo:textSize="20pt"
+ foo:id="@+id/button2" foo:layout_alignParentBottom="true"></Button>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion14.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion14.txt
new file mode 100644
index 0000000..478e435
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion14.txt
@@ -0,0 +1,10 @@
+Code completion in manifest.xml for android.permission.ACC^ESS_NETWORK_STATE:
+android.permission.ACCESS_CHECKIN_PROPERTIES
+android.permission.ACCESS_COARSE_LOCATION
+android.permission.ACCESS_FINE_LOCATION
+android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
+android.permission.ACCESS_MOCK_LOCATION
+android.permission.ACCESS_NETWORK_STATE
+android.permission.ACCESS_SURFACE_FLINGER
+android.permission.ACCESS_WIFI_STATE
+android.permission.ACCOUNT_MANAGER
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion15.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion15.txt
new file mode 100644
index 0000000..c6b3538
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion15.txt
@@ -0,0 +1,3 @@
+Code completion in manifest.xml for android.intent.category.L^AUNCHER:
+android.intent.category.LAUNCHER
+android.intent.category.LE_DESK_DOCK
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion16.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion16.txt
new file mode 100644
index 0000000..4795c5c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion16.txt
@@ -0,0 +1,14 @@
+Code completion in manifest.xml for <^application android:i:
+application : The "application" tag describes application-level components contained in the package, as well as general application attributes.
+compatible-screens
+instrumentation : Attributes that can be supplied in an AndroidManifest.xml "instrumentation" tag, a child of the root manifest tag.
+original-package : Private tag to declare the original package name that this package is based on.
+permission : The "permission" tag declares a security permission that can be used to control access from other packages to specific components or features in your package (or other packages).
+permission-group : The "permission-group" tag declares a logical grouping of related permissions.
+permission-tree : The "permission-tree" tag declares the base of a tree of permission values: it declares that this package has ownership of the given permission name, as well as all names underneath it (separated by '.').
+protected-broadcast : Private tag to declare system protected broadcast actions.
+supports-screens : The "supports-screens" specifies the screen dimensions an application supports.
+uses-configuration : The "uses-configuration" tag specifies a specific hardware configuration value used by the application.
+uses-feature : The "uses-feature" tag specifies a specific feature used by the application.
+uses-permission : The "uses-permission" tag requests a "permission" that the containing package must be granted in order for it to operate correctly.
+uses-sdk : The "uses-sdk" tag describes the SDK features that the containing package must be running on to operate correctly.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion17.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion17.txt
new file mode 100644
index 0000000..6d966da
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion17.txt
@@ -0,0 +1,7 @@
+Code completion in manifest.xml for ^android:versionCode="1":
+package : This attribute gives a unique name for the package, using a Java-style naming convention to avoid name collisions. For example, applications published by Google could have names of the form com.google.app.appname
+android:versionCode : Internal version code. [integer]
+android:versionName : The text shown to the user to indicate the version they have. [string]
+android:sharedUserId : Specify the name of a user ID that will be shared between multiple packages. [string]
+android:sharedUserLabel : Specify a label for the shared user UID of this package. [reference]
+android:installLocation : The default install location defined by an application. [enum]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion18.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion18.txt
new file mode 100644
index 0000000..6fd1096
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-completion18.txt
@@ -0,0 +1,27 @@
+Code completion in manifest.xml for <activity android:^name=".TestActivity":
+android:name : Required name of the class implementing the activity, deriving from android.app.Activity. [string]
+android:theme : The overall theme to use for an activity. [reference]
+android:label : A user-legible name for the given item. [string, reference]
+android:description : Descriptive text for the associated data. [reference]
+android:icon : A Drawable resource providing a graphical representation of its associated item. [reference]
+android:logo : A Drawable resource providing an extended graphical logo for its associated item. [reference]
+android:launchMode : Specify how an activity should be launched. [enum]
+android:screenOrientation : Specify the orientation an activity should be run in. [enum]
+android:configChanges : Specify one or more configuration changes that the activity will handle itself. [flag]
+android:permission : Specify a permission that a client is required to have in order to use the associated object. [string]
+android:multiprocess : Specify whether a component is allowed to have multiple instances of itself running in different processes. [boolean]
+android:process : Specify a specific process that the associated code is to run in. [string]
+android:taskAffinity : Specify a task name that activities have an "affinity" to. [string]
+android:allowTaskReparenting : Specify that an activity can be moved out of a task it is in to the task it has an affinity for when appropriate. [boolean]
+android:finishOnTaskLaunch : Specify whether an activity should be finished when its task is brought to the foreground by relaunching from the home screen. [boolean]
+android:finishOnCloseSystemDialogs : Specify whether an activity should be finished when a "close system windows" request has been made. [boolean]
+android:clearTaskOnLaunch : Specify whether an activity's task should be cleared when it is re-launched from the home screen. [boolean]
+android:noHistory : Specify whether an activity should be kept in its history stack. [boolean]
+android:alwaysRetainTaskState : Specify whether an acitivty's task state should always be maintained by the system, or if it is allowed to reset the task to its initial state in certain situations. [boolean]
+android:stateNotNeeded : Indicates that an Activity does not need to have its freeze state (as returned by onSaveInstanceState retained in order to be restarted. [boolean]
+android:excludeFromRecents : Indicates that an Activity should be excluded from the list of recently launched activities. [boolean]
+android:enabled : Specify whether the activity is enabled or not (that is, can be instantiated by the system). [boolean]
+android:exported : Flag indicating whether the given application component is available to other applications. [boolean]
+android:windowSoftInputMode : Specify the default soft-input mode for the main window of this activity. [flag]
+android:immersive : Flag declaring this activity to be 'immersive'; immersive activities should not be interrupted with other activities or notifications. [boolean]
+android:hardwareAccelerated : <p>Flag indicating whether the application's rendering should be hardware accelerated if possible. [boolean]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate10.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate10.txt
new file mode 100644
index 0000000..c745f54
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate10.txt
@@ -0,0 +1,6 @@
+Go To Declaration in manifest.xml for <uses-permission android:name="android.permission.AC^CESS_NETWORK_STATE" />:
+Open XML Declaration : [android.permission.ACCESS_NETWORK_STATE]
+
+
+After open, a browser is shown with this URL:
+ reference/android/Manifest.permission.html#ACCESS_NETWORK_STATE
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate11a.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate11a.txt
new file mode 100644
index 0000000..eaeddf9
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate11a.txt
@@ -0,0 +1,6 @@
+Go To Declaration in manifest.xml for <action android:name="android.intent.ac^tion.MAIN" />:
+Open XML Declaration : [android.intent.action.MAIN]
+
+
+After open, a browser is shown with this URL:
+ reference/android/content/Intent.html#ACTION_MAIN
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate11g.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate11g.txt
new file mode 100644
index 0000000..9acb330
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate11g.txt
@@ -0,0 +1,6 @@
+Go To Declaration in manifest.xml for <category android:name="android.intent.category.LA^UNCHER" />:
+Open XML Declaration : [android.intent.category.LAUNCHER]
+
+
+After open, a browser is shown with this URL:
+ reference/android/content/Intent.html#CATEGORY_LAUNCHER
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate9a.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate9a.txt
new file mode 100644
index 0000000..2221e37
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate9a.txt
@@ -0,0 +1,6 @@
+Go To Declaration in manifest.xml for <activity android:name=".Test^Activity":
+Open XML Declaration : [.TestActivity]
+
+
+After open, the selected text is:
+^<?xml version="1.0" encoding="utf-8"?>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest.xml
new file mode 100644
index 0000000..2c0024f
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="foo.bar"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <uses-sdk android:minSdkVersion="11" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+
+ <application android:icon="@drawable/icon" android:label="@string/app_name">
+ <activity android:name=".TestActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ </application>
+</manifest>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/metadata.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/metadata.xml
new file mode 100644
index 0000000..9262f97
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout android:id="@+id/LinearLayout1"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical" android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <ListView android:layout_width="match_parent" android:id="@+id/listView1"
+ android:layout_height="wrap_content">
+ </ListView>
+ <Button android:text="Button" android:id="@+id/button1"/>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate1.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate1.txt
new file mode 100644
index 0000000..7308a48
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate1.txt
@@ -0,0 +1,7 @@
+Go To Declaration in navigation1.xml for android:text="@string/app^_name":
+Open Declaration in values/strings.xml : [@string/app_name]
+ L/PROJECTNAME/res/values/strings.xml
+
+
+After open, the selected text is:
+ [^<string name="app_name">PROJECTNAME</string>]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate12.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate12.txt
new file mode 100644
index 0000000..23fa07e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate12.txt
@@ -0,0 +1,6 @@
+Go To Declaration in navigation1.xml for <my.Cust^omView></my.CustomView>:
+Open XML Declaration : [my.CustomView]
+
+
+After open, the selected text is:
+^<?xml version="1.0" encoding="utf-8"?>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate2.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate2.txt
new file mode 100644
index 0000000..f91e1f9
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate2.txt
@@ -0,0 +1,7 @@
+Go To Declaration in navigation1.xml for marginLeft="@android:dimen/app_ico^n_size":
+Open Declaration in values/dimens.xml : [@android:dimen/app_icon_size]
+ data/res/values/dimens.xml
+
+
+After open, the selected text is:
+ <dimen name="app_icon_size">^48dip</dimen>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate3.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate3.txt
new file mode 100644
index 0000000..53776a0
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate3.txt
@@ -0,0 +1,7 @@
+Go To Declaration in navigation1.xml for style="@android:style/Widget.B^utton":
+Open Declaration in values/styles.xml : [@android:style/Widget.Button]
+ data/res/values/styles.xml
+
+
+After open, the selected text is:
+ <style name="Widget.Button">^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate4.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate4.txt
new file mode 100644
index 0000000..ec5ee38
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate4.txt
@@ -0,0 +1,89 @@
+Go To Declaration in navigation1.xml for android:text="@android:st^ring/ok":
+Open Declaration in values-en-rGB/strings.xml : [@android:string/ok]
+ data/res/values-en-rGB/strings.xml
+Open Declaration in values/strings.xml : [@android:string/ok]
+ data/res/values/strings.xml
+Open Declaration in values-ar/strings.xml : [@android:string/ok]
+ data/res/values-ar/strings.xml
+Open Declaration in values-bg/strings.xml : [@android:string/ok]
+ data/res/values-bg/strings.xml
+Open Declaration in values-ca/strings.xml : [@android:string/ok]
+ data/res/values-ca/strings.xml
+Open Declaration in values-cs/strings.xml : [@android:string/ok]
+ data/res/values-cs/strings.xml
+Open Declaration in values-da/strings.xml : [@android:string/ok]
+ data/res/values-da/strings.xml
+Open Declaration in values-de/strings.xml : [@android:string/ok]
+ data/res/values-de/strings.xml
+Open Declaration in values-el/strings.xml : [@android:string/ok]
+ data/res/values-el/strings.xml
+Open Declaration in values-es/strings.xml : [@android:string/ok]
+ data/res/values-es/strings.xml
+Open Declaration in values-es-rUS/strings.xml : [@android:string/ok]
+ data/res/values-es-rUS/strings.xml
+Open Declaration in values-fa/strings.xml : [@android:string/ok]
+ data/res/values-fa/strings.xml
+Open Declaration in values-fi/strings.xml : [@android:string/ok]
+ data/res/values-fi/strings.xml
+Open Declaration in values-fr/strings.xml : [@android:string/ok]
+ data/res/values-fr/strings.xml
+Open Declaration in values-hr/strings.xml : [@android:string/ok]
+ data/res/values-hr/strings.xml
+Open Declaration in values-hu/strings.xml : [@android:string/ok]
+ data/res/values-hu/strings.xml
+Open Declaration in values-in/strings.xml : [@android:string/ok]
+ data/res/values-in/strings.xml
+Open Declaration in values-it/strings.xml : [@android:string/ok]
+ data/res/values-it/strings.xml
+Open Declaration in values-iw/strings.xml : [@android:string/ok]
+ data/res/values-iw/strings.xml
+Open Declaration in values-ja/strings.xml : [@android:string/ok]
+ data/res/values-ja/strings.xml
+Open Declaration in values-ko/strings.xml : [@android:string/ok]
+ data/res/values-ko/strings.xml
+Open Declaration in values-lt/strings.xml : [@android:string/ok]
+ data/res/values-lt/strings.xml
+Open Declaration in values-lv/strings.xml : [@android:string/ok]
+ data/res/values-lv/strings.xml
+Open Declaration in values-nb/strings.xml : [@android:string/ok]
+ data/res/values-nb/strings.xml
+Open Declaration in values-nl/strings.xml : [@android:string/ok]
+ data/res/values-nl/strings.xml
+Open Declaration in values-pl/strings.xml : [@android:string/ok]
+ data/res/values-pl/strings.xml
+Open Declaration in values-pt/strings.xml : [@android:string/ok]
+ data/res/values-pt/strings.xml
+Open Declaration in values-pt-rPT/strings.xml : [@android:string/ok]
+ data/res/values-pt-rPT/strings.xml
+Open Declaration in values-rm/strings.xml : [@android:string/ok]
+ data/res/values-rm/strings.xml
+Open Declaration in values-ro/strings.xml : [@android:string/ok]
+ data/res/values-ro/strings.xml
+Open Declaration in values-ru/strings.xml : [@android:string/ok]
+ data/res/values-ru/strings.xml
+Open Declaration in values-sk/strings.xml : [@android:string/ok]
+ data/res/values-sk/strings.xml
+Open Declaration in values-sl/strings.xml : [@android:string/ok]
+ data/res/values-sl/strings.xml
+Open Declaration in values-sr/strings.xml : [@android:string/ok]
+ data/res/values-sr/strings.xml
+Open Declaration in values-sv/strings.xml : [@android:string/ok]
+ data/res/values-sv/strings.xml
+Open Declaration in values-th/strings.xml : [@android:string/ok]
+ data/res/values-th/strings.xml
+Open Declaration in values-tl/strings.xml : [@android:string/ok]
+ data/res/values-tl/strings.xml
+Open Declaration in values-tr/strings.xml : [@android:string/ok]
+ data/res/values-tr/strings.xml
+Open Declaration in values-uk/strings.xml : [@android:string/ok]
+ data/res/values-uk/strings.xml
+Open Declaration in values-vi/strings.xml : [@android:string/ok]
+ data/res/values-vi/strings.xml
+Open Declaration in values-zh-rCN/strings.xml : [@android:string/ok]
+ data/res/values-zh-rCN/strings.xml
+Open Declaration in values-zh-rTW/strings.xml : [@android:string/ok]
+ data/res/values-zh-rTW/strings.xml
+
+
+After open, the selected text is:
+ <string name="ok" msgid="5970060430562524910">^"OK"</string>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1.xml
new file mode 100644
index 0000000..9c175fc
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <Button
+ android:text="@string/app_name"
+ android:layout_marginLeft="@android:dimen/app_icon_size"
+ style="@android:style/Widget.Button"
+ android:id="@+id/button1"
+ ></Button>
+ <my.CustomView></my.CustomView>
+ <EditText
+ android:text="@android:string/ok"
+ </EditText>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-extract2.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-extract2.diff
new file mode 100644
index 0000000..141180b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-extract2.diff
@@ -0,0 +1,6 @@
+---
+ </style>
+> <style name="newstyle">
+> <item name="android:textColor">#FF00FF</item>
+> <item name="android:textSize">20pt</item>
+ </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate5.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate5.txt
new file mode 100644
index 0000000..15c91d1
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate5.txt
@@ -0,0 +1,7 @@
+Go To Declaration in navigationstyles.xml for parent="android:Theme.Li^ght">:
+Open Declaration in values/themes.xml : [android:Theme.Light]
+ data/res/values/themes.xml
+
+
+After open, the selected text is:
+ <style name="Theme.Light">^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate6.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate6.txt
new file mode 100644
index 0000000..5a4f40a
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate6.txt
@@ -0,0 +1,7 @@
+Go To Declaration in navigationstyles.xml for parent="android:The^me.Light">:
+Open Declaration in values/themes.xml : [android:Theme]
+ data/res/values/themes.xml
+
+
+After open, the selected text is:
+ <style name="Theme">^
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate7.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate7.txt
new file mode 100644
index 0000000..8f7eb46
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate7.txt
@@ -0,0 +1,7 @@
+Go To Declaration in navigationstyles.xml for popupBackground">@android:drawable/spinner_dr^opdown_background</item>:
+Open Declaration in drawable/spinner_dropdown_background.xml : [@android:drawable/spinner_dropdown_background]
+ data/res/drawable/spinner_dropdown_background.xml
+
+
+After open, the selected text is:
+^<?xml version="1.0" encoding="utf-8"?>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate8.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate8.txt
new file mode 100644
index 0000000..b74c676
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate8.txt
@@ -0,0 +1,7 @@
+Go To Declaration in navigationstyles.xml for colorBackground"> @color/cust^om_theme_color </item>:
+Open Declaration in values/navigationstyles.xml : [@color/custom_theme_color]
+ L/PROJECTNAME/res/values/navigationstyles.xml
+
+
+After open, the selected text is:
+ [^<color name="custom_theme_color">#b0b0ff</color>]
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles.xml
new file mode 100644
index 0000000..da4bbf2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="custom_theme_color">#b0b0ff</color>
+ <style name="CustomTheme" parent="android:Theme.Light">
+ <item name="android:windowBackground">@color/custom_theme_color</item>
+ <item name="android:colorBackground"> @color/custom_theme_color </item>
+ </style>
+
+ <style name="BrowserTheme" parent="@android:Theme.Black">
+ <item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextView</item>
+ <item name="android:windowNoTitle">true</item>
+ </style>
+
+ <style name="AutoCompleteTextView">
+ <item name="android:focusable">true</item>
+ <item name="android:focusableInTouchMode">true</item>
+ <item name="android:clickable">true</item>
+ <item name="android:completionHintView">@android:layout/simple_dropdown_item_1line</item>
+ <item name="android:textAppearance">?android:attr/textAppearanceLargeInverse</item>
+ <item name="android:completionThreshold">2</item>
+ <item name="android:dropDownSelector">@android:drawable/list_selector_background</item>
+ <item name="android:popupBackground">@android:drawable/spinner_dropdown_background</item>
+ </style>
+
+ <style name="CustomTitle" parent="@android:Theme">
+ <item name="android:windowTitleSize">60dip</item>
+ </style>
+</resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout1-expected-extract1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout1-expected-extract1.xml
new file mode 100644
index 0000000..2a0e947
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout1-expected-extract1.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Button xmlns:android="http://schemas.android.com/apk/res/android" android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout2-expected-extract2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout2-expected-extract2.xml
new file mode 100644
index 0000000..b2d1789
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout2-expected-extract2.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+ <ImageView android:id="@+id/android_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_button" android:focusable="false" android:clickable="false" android:layout_weight="1.0" />
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+</merge>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract3.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract3.xml
new file mode 100644
index 0000000..6ba61c8
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract3.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Button xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:id="@+id/button3" android:layout_height="wrap_content" android:text="Button" ></Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract4.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract4.xml
new file mode 100644
index 0000000..ee8568e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract4.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/android_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_button" android:focusable="false" android:clickable="false" />
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract5.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract5.xml
new file mode 100644
index 0000000..be57066
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout3-expected-extract5.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <ImageView android:id="@+id/android_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_button" android:focusable="false" android:clickable="false" android:layout_weight="1.0" />
+</merge>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract6.diff
new file mode 100644
index 0000000..3a4c590
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newlayout6-expected-extract6.diff
@@ -0,0 +1,11 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent">
+> <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content">
+> <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content">
+> <!-- Comment -->
+> <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+> </LinearLayout>
+> </LinearLayout>
+> </LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles-expected-extract1.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles-expected-extract1.diff
new file mode 100644
index 0000000..d83eb49
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles-expected-extract1.diff
@@ -0,0 +1,9 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <resources xmlns:android="http://schemas.android.com/apk/res/android">
+> <style name="newstyle">
+> <item name="android:textColor">#FF00FF</item>
+> <item name="android:textSize">20pt</item>
+> </style>
+> </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles2-expected-extract1b.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles2-expected-extract1b.diff
new file mode 100644
index 0000000..d83eb49
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles2-expected-extract1b.diff
@@ -0,0 +1,9 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <resources xmlns:android="http://schemas.android.com/apk/res/android">
+> <style name="newstyle">
+> <item name="android:textColor">#FF00FF</item>
+> <item name="android:textSize">20pt</item>
+> </style>
+> </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract1c.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract1c.diff
new file mode 100644
index 0000000..d83eb49
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract1c.diff
@@ -0,0 +1,9 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <resources xmlns:android="http://schemas.android.com/apk/res/android">
+> <style name="newstyle">
+> <item name="android:textColor">#FF00FF</item>
+> <item name="android:textSize">20pt</item>
+> </style>
+> </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract8.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract8.diff
new file mode 100644
index 0000000..3b4d930
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles3-expected-extract8.diff
@@ -0,0 +1,9 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <resources xmlns:android="http://schemas.android.com/apk/res/android">
+> <style name="newstyle" parent="android:Widget.Button">
+> <item name="android:textColor">#FF00FF</item>
+> <item name="android:textSize">20pt</item>
+> </style>
+> </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract1d.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract1d.diff
new file mode 100644
index 0000000..d83eb49
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract1d.diff
@@ -0,0 +1,9 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <resources xmlns:android="http://schemas.android.com/apk/res/android">
+> <style name="newstyle">
+> <item name="android:textColor">#FF00FF</item>
+> <item name="android:textSize">20pt</item>
+> </style>
+> </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract3.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract3.diff
new file mode 100644
index 0000000..0685d94
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles4-expected-extract3.diff
@@ -0,0 +1,9 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <resources xmlns:android="http://schemas.android.com/apk/res/android">
+> <style name="newstyle">
+> <item name="android:textColor">#FF0000</item>
+> <item name="android:textSize">20pt</item>
+> </style>
+> </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles5-expected-extract4.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles5-expected-extract4.diff
new file mode 100644
index 0000000..f052485
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles5-expected-extract4.diff
@@ -0,0 +1,8 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <resources xmlns:android="http://schemas.android.com/apk/res/android">
+> <style name="newstyle">
+> <item name="android:textColor">#FF00FF</item>
+> </style>
+> </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles6-expected-extract5.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles6-expected-extract5.diff
new file mode 100644
index 0000000..ce1d4aa
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles6-expected-extract5.diff
@@ -0,0 +1,8 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <resources xmlns:android="http://schemas.android.com/apk/res/android">
+> <style name="newstyle">
+> <item name="android:textSize">20pt</item>
+> </style>
+> </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles7-expected-extract6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles7-expected-extract6.diff
new file mode 100644
index 0000000..51f0812
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles7-expected-extract6.diff
@@ -0,0 +1,13 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <resources xmlns:android="http://schemas.android.com/apk/res/android">
+> <style name="newstyle">
+> <item name="android:layout_alignParentBottom">true</item>
+> <item name="android:layout_height">wrap_content</item>
+> <item name="android:layout_width">wrap_content</item>
+> <item name="android:text">Button</item>
+> <item name="android:textColor">#FF0000</item>
+> <item name="android:textSize">20pt</item>
+> </style>
+> </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles8-expected-extract7.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles8-expected-extract7.diff
new file mode 100644
index 0000000..8f7ad98
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/newstyles8-expected-extract7.diff
@@ -0,0 +1,9 @@
+<
+---
+> <?xml version="1.0" encoding="utf-8"?>
+> <resources xmlns:android="http://schemas.android.com/apk/res/android">
+> <style name="newstyle">
+> <item name="android:textColor">#00FF00</item>
+> <item name="android:textSize">20pt</item>
+> </style>
+> </resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix1.xml
new file mode 100644
index 0000000..2ef716b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix1.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="hello">Hello World!</string>
+ <string name="app_name">PROJECTNAME</string>
+ <string name="firststring">[^TODO]</string>
+</resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix2.xml
new file mode 100644
index 0000000..a0d04fb
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix2.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <dimen name="testdimen">[^1dp]</dimen>
+</resources>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix3.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix3.xml
new file mode 100644
index 0000000..8773027
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1-expected-quickFix3.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ ^
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1.xml
new file mode 100644
index 0000000..927c8d1
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix1.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <Button android:text="@string/firststring"
+ android:id="@+id/button1"
+ android:layout_width="@dimen/testdimen"
+ android:layout_height="wrap_content">
+ </Button>
+
+ <include layout="@layout/testlayout" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2-expected-quickFix4.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2-expected-quickFix4.xml
new file mode 100644
index 0000000..025fa0a
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2-expected-quickFix4.xml
@@ -0,0 +1,3 @@
+< <color android:color="#0000000"/>
+---
+> <color android:color="#0000000" xmlns:android="http://schemas.android.com/apk/res/android"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2.xml
new file mode 100644
index 0000000..4f2a925
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/quickfix2.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+ <!--
+ Random comment here
+ -->
+<color android:color="#0000000"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant1.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant1.txt
new file mode 100644
index 0000000..457239f
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant1.txt
@@ -0,0 +1,3 @@
+Quick assistant in sample1a.xml for <Button android:text="Fir^stButton":
+Extract Android String : Initiates the given refactoring operation
+Extract Style : Initiates the given refactoring operation
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant2.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant2.txt
new file mode 100644
index 0000000..95187d3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant2.txt
@@ -0,0 +1,6 @@
+Quick assistant in sample1a.xml for <Bu^tton android:text:
+Wrap in Container : Initiates the given refactoring operation
+Change Widget Type : Initiates the given refactoring operation
+Change Layout : Initiates the given refactoring operation
+Extract Style : Initiates the given refactoring operation
+Extract as Include : Initiates the given refactoring operation
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant3.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant3.txt
new file mode 100644
index 0000000..8123be4
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant3.txt
@@ -0,0 +1,2 @@
+Quick assistant in sample1a.xml for <Button andr^oid:text="FirstButton":
+Extract Style : Initiates the given refactoring operation
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant4.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant4.txt
new file mode 100644
index 0000000..e0cb98b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-assistant4.txt
@@ -0,0 +1,2 @@
+Quick assistant in sample1a.xml for android:id="@+id/Linea^rLayout2":
+None found.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-changeLayout1a.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-changeLayout1a.xml
new file mode 100644
index 0000000..772f82a
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-changeLayout1a.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout android:id="@+id/RelativeLayout1" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <Button android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="FirstButton" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <Button android:layout_alignParentLeft="true" android:layout_alignBaseline="@+id/button2" android:layout_below="@+id/button1" android:layout_marginTop="2dp" android:text="SecondButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2"></Button>
+ <Button android:layout_toRightOf="@+id/button2" android:layout_alignBaseline="@+id/button2" android:layout_alignTop="@+id/button2" android:text="ThirdButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button3"></Button>
+ <CheckBox android:layout_toRightOf="@+id/button3" android:layout_alignBaseline="@+id/button2" android:layout_below="@+id/button1" android:id="@+id/checkBox1" android:text="CheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox>
+ <Button android:layout_alignParentLeft="true" android:layout_below="@+id/checkBox1" android:layout_height="wrap_content" android:text="FourthButton" android:id="@+id/button4" android:layout_width="match_parent"></Button>
+ <Button android:layout_alignParentLeft="true" android:layout_alignBaseline="@+id/button5" android:layout_below="@+id/button4" android:layout_gravity="right" android:id="@+id/button5" android:text="FifthButton" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button>
+ <Button android:layout_alignParentLeft="true" android:layout_alignBaseline="@+id/button6" android:layout_below="@+id/button5" android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+</RelativeLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-changeView1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-changeView1.xml
new file mode 100644
index 0000000..f4a08d0
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-changeView1.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout android:id="@+id/LinearLayout2" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <RadioButton android:text="FirstButton" android:id="@+id/RadioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content"></RadioButton>
+ <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:layout_height="wrap_content">
+ <Button android:text="SecondButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2"></Button>
+ <Button android:text="ThirdButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button3"></Button>
+ <CheckBox android:id="@+id/checkBox1" android:text="CheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox>
+ </LinearLayout>
+ <Button android:layout_height="wrap_content" android:text="FourthButton" android:id="@+id/button4" android:layout_width="match_parent"></Button>
+ <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout3" android:layout_width="match_parent">
+ <Button android:layout_gravity="right" android:id="@+id/button5" android:text="FifthButton" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button>
+ </LinearLayout>
+ <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent">
+ <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content">
+ <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content">
+ <RadioButton android:text="Button" android:id="@+id/RadioButton2" android:layout_width="wrap_content" android:layout_height="wrap_content"></RadioButton>
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract6.diff
new file mode 100644
index 0000000..c0ebd59
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a-expected-extract6.diff
@@ -0,0 +1,9 @@
+< <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent">
+< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content">
+< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content">
+< <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+< </LinearLayout>
+< </LinearLayout>
+< </LinearLayout>
+---
+> <include layout="@layout/newlayout6" android:id="@+id/linearLayout4_ref" android:layout_width="match_parent" android:layout_height="wrap_content"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a.info
new file mode 100644
index 0000000..20a23b0
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a.info
@@ -0,0 +1,13 @@
+android.widget.LinearLayout [0,36,240,320] <LinearLayout>
+ android.widget.Button [0,0,70,36] <Button>
+ android.widget.LinearLayout [0,36,240,72] <LinearLayout>
+ android.widget.Button [0,2,84,38] <Button>
+ android.widget.Button [84,2,158,38] <Button>
+ android.widget.CheckBox [158,0,238,36] <CheckBox>
+ android.widget.Button [0,72,240,108] <Button>
+ android.widget.LinearLayout [0,108,240,144] <LinearLayout>
+ android.widget.Button [0,0,71,36] <Button>
+ android.widget.LinearLayout [0,144,240,180] <LinearLayout>
+ android.widget.LinearLayout [0,0,49,36] <LinearLayout>
+ android.widget.LinearLayout [0,0,49,36] <LinearLayout>
+ android.widget.Button [0,0,49,36] <Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a.xml
new file mode 100644
index 0000000..9a94935
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1a.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout android:id="@+id/LinearLayout2" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <Button android:text="FirstButton" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:layout_height="wrap_content">
+ <Button android:text="SecondButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2"></Button>
+ <Button android:text="ThirdButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button3"></Button>
+ <CheckBox android:id="@+id/checkBox1" android:text="CheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox>
+ </LinearLayout>
+ <Button android:layout_height="wrap_content" android:text="FourthButton" android:id="@+id/button4" android:layout_width="match_parent"></Button>
+ <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout3" android:layout_width="match_parent">
+ <Button android:layout_gravity="right" android:id="@+id/button5" android:text="FifthButton" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button>
+ </LinearLayout>
+ <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent">
+ <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content">
+ <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content">
+ <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b-expected-changeLayout1b.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b-expected-changeLayout1b.xml
new file mode 100644
index 0000000..f47e9be
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b-expected-changeLayout1b.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+ android:id="@+id/RelativeLayout1"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <Button android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
+ android:text="FirstButton"
+ android:id="@+id/button1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></Button>
+ <Button android:layout_alignParentLeft="true" android:layout_alignBaseline="@+id/button2" android:layout_below="@+id/button1" android:layout_marginTop="2dp"
+ android:text="SecondButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/button2"></Button>
+ <Button android:layout_toRightOf="@+id/button2" android:layout_alignBaseline="@+id/button2" android:layout_alignTop="@+id/button2"
+ android:text="ThirdButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/button3"></Button>
+ <CheckBox android:layout_toRightOf="@+id/button3" android:layout_alignBaseline="@+id/button2" android:layout_below="@+id/button1"
+ android:id="@+id/checkBox1"
+ android:text="CheckBox"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></CheckBox>
+ <Button android:layout_alignParentLeft="true" android:layout_below="@+id/checkBox1"
+ android:layout_height="wrap_content"
+ android:text="FourthButton"
+ android:id="@+id/button4"
+ android:layout_width="match_parent"></Button>
+ <Button android:layout_alignParentLeft="true" android:layout_alignBaseline="@+id/button5" android:layout_below="@+id/button4"
+ android:layout_gravity="right"
+ android:id="@+id/button5"
+ android:text="FifthButton"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"></Button>
+ <Button android:layout_alignParentLeft="true" android:layout_alignBaseline="@+id/button6" android:layout_below="@+id/button5"
+ android:text="Button"
+ android:id="@+id/button6"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></Button>
+</RelativeLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b.info
new file mode 100644
index 0000000..7807227
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b.info
@@ -0,0 +1,14 @@
+android.widget.LinearLayout [0,36,240,320] <LinearLayout>
+ android.widget.Button [0,0,70,36] <Button>
+ android.widget.LinearLayout [0,36,240,72] <LinearLayout>
+ android.widget.Button [0,2,84,38] <Button>
+ android.widget.Button [84,2,158,38] <Button>
+ android.widget.CheckBox [158,0,238,36] <CheckBox>
+ android.widget.Button [0,72,240,108] <Button>
+ android.widget.LinearLayout [0,108,240,144] <LinearLayout>
+ android.widget.Button [0,0,71,36] <Button>
+ android.widget.LinearLayout [0,144,240,180] <LinearLayout>
+ android.widget.LinearLayout [0,0,49,36] <LinearLayout>
+ android.widget.LinearLayout [0,0,49,36] <LinearLayout>
+ android.widget.Button [0,0,49,36] <Button>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b.xml
new file mode 100644
index 0000000..6b800ae
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample1b.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ android:id="@+id/LinearLayout2"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <Button
+ android:text="FirstButton"
+ android:id="@+id/button1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></Button>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:id="@+id/linearLayout1"
+ android:layout_height="wrap_content">
+ <Button
+ android:text="SecondButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/button2"></Button>
+ <Button
+ android:text="ThirdButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/button3"></Button>
+ <CheckBox
+ android:id="@+id/checkBox1"
+ android:text="CheckBox"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></CheckBox>
+ </LinearLayout>
+ <Button
+ android:layout_height="wrap_content"
+ android:text="FourthButton"
+ android:id="@+id/button4"
+ android:layout_width="match_parent"></Button>
+ <LinearLayout
+ android:layout_height="wrap_content"
+ android:id="@+id/linearLayout3"
+ android:layout_width="match_parent">
+ <Button
+ android:layout_gravity="right"
+ android:id="@+id/button5"
+ android:text="FifthButton"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"></Button>
+ </LinearLayout>
+ <LinearLayout
+ android:layout_height="wrap_content"
+ android:id="@+id/linearLayout4"
+ android:layout_width="match_parent">
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:id="@+id/linearLayout5"
+ android:layout_width="wrap_content">
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:id="@+id/linearLayout6"
+ android:layout_width="wrap_content">
+ <Button
+ android:text="Button"
+ android:id="@+id/button6"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></Button>
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeLayout2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeLayout2.xml
new file mode 100644
index 0000000..cce3803
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeLayout2.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout android:id="@+id/RelativeLayout1" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <Button android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <Button android:layout_below="@+id/button1" android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:id="@+id/button2" android:layout_height="wrap_content" android:text="Button"></Button>
+ <Button android:layout_width="wrap_content" android:id="@+id/button3" android:layout_below="@+id/button2" android:layout_height="wrap_content" android:text="Button" android:layout_toRightOf="@+id/button2"></Button>
+ <Button android:layout_width="wrap_content" android:id="@+id/button4" android:layout_below="@+id/button3" android:layout_height="wrap_content" android:text="Button" android:layout_toRightOf="@+id/button3"></Button>
+ <CheckBox android:layout_width="wrap_content" android:layout_below="@+id/button4" android:id="@+id/checkBox1" android:layout_height="wrap_content" android:text="CheckBox" android:layout_toLeftOf="@+id/button4"></CheckBox>
+ <Button android:layout_alignTop="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" android:id="@+id/button5" android:layout_alignParentRight="true"></Button>
+</RelativeLayout>
+
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeView2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeView2.xml
new file mode 100644
index 0000000..5a55498
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-changeView2.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <RelativeLayout android:layout_height="match_parent" android:id="@+id/relativeLayout1" android:layout_width="match_parent">
+ <Button android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:id="@+id/button2" android:layout_height="wrap_content" android:text="Button"></Button>
+ <ImageButton android:layout_width="wrap_content" android:id="@+id/ImageButton1" android:layout_below="@+id/button2" android:layout_height="wrap_content" android:layout_toRightOf="@+id/button2"></ImageButton>
+ <Button android:layout_width="wrap_content" android:id="@+id/button4" android:layout_below="@+id/ImageButton1" android:layout_height="wrap_content" android:text="Button" android:layout_toRightOf="@+id/ImageButton1"></Button>
+ <CheckBox android:layout_width="wrap_content" android:layout_below="@+id/button4" android:id="@+id/checkBox1" android:layout_height="wrap_content" android:text="CheckBox" android:layout_toLeftOf="@+id/button4"></CheckBox>
+ <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ImageButton2" android:layout_alignParentRight="true"></ImageButton>
+ </RelativeLayout>
+</LinearLayout>
+
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-extract3.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-extract3.xml
new file mode 100644
index 0000000..e4ff731
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2-expected-extract3.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <RelativeLayout android:layout_height="match_parent" android:id="@+id/relativeLayout1" android:layout_width="match_parent">
+ <Button android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:id="@+id/button2" android:layout_height="wrap_content" android:text="Button"></Button>
+ <include layout="@layout/newlayout3" android:id="@+id/button3_ref" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/button2" android:layout_toRightOf="@+id/button2"/>
+ <Button android:layout_width="wrap_content" android:id="@+id/button4" android:layout_below="@+id/button3_ref" android:layout_height="wrap_content" android:text="Button" android:layout_toRightOf="@+id/button3_ref"></Button>
+ <CheckBox android:layout_width="wrap_content" android:layout_below="@+id/button4" android:id="@+id/checkBox1" android:layout_height="wrap_content" android:text="CheckBox" android:layout_toLeftOf="@+id/button4"></CheckBox>
+ <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" android:id="@+id/button5" android:layout_alignParentRight="true"></Button>
+ </RelativeLayout>
+</LinearLayout>
+
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2.info
new file mode 100644
index 0000000..44d3b62
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2.info
@@ -0,0 +1,9 @@
+android.widget.LinearLayout [0,36,240,320] <LinearLayout>
+ android.widget.Button [0,0,49,36] <Button>
+ android.widget.RelativeLayout [0,36,240,284] <RelativeLayout>
+ android.widget.Button [0,0,49,36] <Button>
+ android.widget.Button [49,36,98,72] <Button>
+ android.widget.Button [98,72,147,108] <Button>
+ android.widget.CheckBox [18,108,98,144] <CheckBox>
+ android.widget.Button [191,0,240,36] <Button>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2.xml
new file mode 100644
index 0000000..0697c64
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample2.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <RelativeLayout android:layout_height="match_parent" android:id="@+id/relativeLayout1" android:layout_width="match_parent">
+ <Button android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:id="@+id/button2" android:layout_height="wrap_content" android:text="Button"></Button>
+ <Button android:layout_width="wrap_content" android:id="@+id/button3" android:layout_below="@+id/button2" android:layout_height="wrap_content" android:text="Button" android:layout_toRightOf="@+id/button2"></Button>
+ <Button android:layout_width="wrap_content" android:id="@+id/button4" android:layout_below="@+id/button3" android:layout_height="wrap_content" android:text="Button" android:layout_toRightOf="@+id/button3"></Button>
+ <CheckBox android:layout_width="wrap_content" android:layout_below="@+id/button4" android:id="@+id/checkBox1" android:layout_height="wrap_content" android:text="CheckBox" android:layout_toLeftOf="@+id/button4"></CheckBox>
+ <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" android:id="@+id/button5" android:layout_alignParentRight="true"></Button>
+ </RelativeLayout>
+</LinearLayout>
+
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-changeLayout3.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-changeLayout3.xml
new file mode 100644
index 0000000..c5118b6
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-changeLayout3.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <ImageView android:layout_alignParentLeft="true" android:layout_below="@+id/button1" android:layout_above="@+id/button2" android:id="@+id/android_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_button" android:focusable="false" android:clickable="false" android:layout_weight="1.0" />
+ <Button android:layout_alignParentLeft="true" android:layout_alignParentBottom="true" android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+</RelativeLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract1.xml
new file mode 100644
index 0000000..70f576e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract1.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <ImageView android:id="@+id/android_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_button" android:focusable="false" android:clickable="false" android:layout_weight="1.0" />
+ <include layout="@layout/newlayout1" android:id="@+id/button2_ref" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract2.xml
new file mode 100644
index 0000000..9a30a96
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract2.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <include layout="@layout/newlayout2" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract4.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract4.xml
new file mode 100644
index 0000000..445f88a
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract4.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <include layout="@layout/newlayout3" android:id="@+id/android_logo_ref" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0"/>
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract5.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract5.xml
new file mode 100644
index 0000000..8df41ca
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-extract5.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <include layout="@layout/newlayout3" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn1.xml
new file mode 100644
index 0000000..5af18d6
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn1.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <ImageView android:id="@+id/android_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_button" android:focusable="false" android:clickable="false" android:layout_weight="1.0" />
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn2.xml
new file mode 100644
index 0000000..5d5fbfc
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn2.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.gesture.GestureOverlayView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <ImageView android:id="@+id/android_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_button" android:focusable="false" android:clickable="false" android:layout_weight="1.0" />
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ </LinearLayout>
+</android.gesture.GestureOverlayView>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn3.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn3.xml
new file mode 100644
index 0000000..efbeb18
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-expected-wrapIn3.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+ <ImageView android:id="@+id/android_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_button" android:focusable="false" android:clickable="false" android:layout_weight="1.0" />
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1-expected-extract4.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1-expected-extract4.xml
new file mode 100644
index 0000000..d616269
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1-expected-extract4.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <LinearLayout android:id="@+id/newlinear2" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <include layout="@layout/newlayout3" android:id="@+id/android_logo_ref" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0"/>
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1-expected-extract5.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1-expected-extract5.xml
new file mode 100644
index 0000000..b37e7be
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1-expected-extract5.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <LinearLayout android:id="@+id/newlinear2" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <include layout="@layout/newlayout3" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1.xml
new file mode 100644
index 0000000..9cf3c43
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation1.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <LinearLayout android:id="@+id/newlinear2" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_button"
+ android:focusable="false" android:clickable="false" android:layout_weight="1.0" android:id="@+id/android_logo" />
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2-expected-extract4.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2-expected-extract4.xml
new file mode 100644
index 0000000..40676ab
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2-expected-extract4.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:customprefix="http://schemas.android.com/apk/res/android" customprefix:id="@+id/newlinear" customprefix:orientation="vertical" customprefix:layout_width="match_parent" customprefix:layout_height="match_parent">
+ <include layout="@layout/newlayout3" customprefix:id="@+id/android_logo_ref" customprefix:layout_width="wrap_content" customprefix:layout_height="wrap_content" customprefix:layout_weight="1.0"/>
+ <Button customprefix:text="Button" customprefix:id="@+id/button1" customprefix:layout_width="wrap_content" customprefix:layout_height="wrap_content"></Button>
+ <Button customprefix:text="Button" customprefix:id="@+id/button2" customprefix:layout_width="wrap_content" customprefix:layout_height="wrap_content"></Button>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2-expected-extract5.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2-expected-extract5.xml
new file mode 100644
index 0000000..c51dc37
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2-expected-extract5.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:customprefix="http://schemas.android.com/apk/res/android" customprefix:id="@+id/newlinear" customprefix:orientation="vertical" customprefix:layout_width="match_parent" customprefix:layout_height="match_parent">
+ <include layout="@layout/newlayout3" customprefix:layout_width="wrap_content" customprefix:layout_height="wrap_content"/>
+ <Button customprefix:text="Button" customprefix:id="@+id/button2" customprefix:layout_width="wrap_content" customprefix:layout_height="wrap_content"></Button>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2.xml
new file mode 100644
index 0000000..48d4790
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3-variation2.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:customprefix="http://schemas.android.com/apk/res/android" customprefix:id="@+id/newlinear" customprefix:orientation="vertical" customprefix:layout_width="match_parent" customprefix:layout_height="match_parent">
+ <ImageView customprefix:id="@+id/android_logo" customprefix:layout_width="wrap_content"
+ customprefix:layout_height="wrap_content" customprefix:src="@drawable/android_button" customprefix:focusable="false" customprefix:clickable="false" customprefix:layout_weight="1.0" />
+ <Button customprefix:text="Button" customprefix:id="@+id/button1" customprefix:layout_width="wrap_content" customprefix:layout_height="wrap_content"></Button>
+ <Button customprefix:text="Button" customprefix:id="@+id/button2" customprefix:layout_width="wrap_content" customprefix:layout_height="wrap_content"></Button>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3.info
new file mode 100644
index 0000000..ef3324e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3.info
@@ -0,0 +1,5 @@
+android.widget.LinearLayout [0,36,240,320] <LinearLayout>
+ android.widget.Button [0,0,49,36] <Button>
+ android.widget.ImageView [0,36,128,248] <ImageView>
+ android.widget.Button [0,248,49,284] <Button>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3.xml
new file mode 100644
index 0000000..ddd136c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample3.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/newlinear" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <ImageView android:id="@+id/android_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_button" android:focusable="false" android:clickable="false" android:layout_weight="1.0" />
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4-expected-changeLayout4.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4-expected-changeLayout4.xml
new file mode 100644
index 0000000..2dd7ab7
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4-expected-changeLayout4.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout android:id="@+id/RelativeLayout1" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <CheckBox android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="CheckBox" android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox>
+ <Button android:layout_below="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" android:id="@+id/button5" android:layout_alignParentRight="true"></Button>
+</RelativeLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4.info
new file mode 100644
index 0000000..605c177
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4.info
@@ -0,0 +1,5 @@
+android.widget.LinearLayout [0,36,240,320] <LinearLayout>
+ android.widget.CheckBox [0,0,80,36] <CheckBox>
+ android.widget.RelativeLayout [0,36,240,284] <RelativeLayout>
+ android.widget.Button [191,0,240,36] <Button>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4.xml
new file mode 100644
index 0000000..a56f272
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample4.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <CheckBox android:text="CheckBox" android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox>
+ <RelativeLayout android:layout_height="match_parent" android:id="@+id/relativeLayout1" android:layout_width="match_parent">
+ <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" android:id="@+id/button5" android:layout_alignParentRight="true"></Button>
+ </RelativeLayout>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5-expected-changeLayout5.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5-expected-changeLayout5.xml
new file mode 100644
index 0000000..225476c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5-expected-changeLayout5.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout android:id="@+id/RelativeLayout1" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <Button android:layout_centerHorizontal="true" android:layout_alignParentTop="true" android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal"></Button>
+ <Button android:layout_centerHorizontal="true" android:layout_below="@+id/button1" android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"></Button>
+ <Button android:layout_alignParentRight="true" android:layout_below="@+id/button2" android:text="Button" android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right"></Button>
+ <Button android:layout_alignParentLeft="true" android:layout_alignBaseline="@+id/button4" android:layout_below="@+id/button3" android:layout_marginTop="70dp" android:layout_height="wrap_content" android:layout_gravity="center" android:text="Button" android:id="@+id/button4" android:layout_width="wrap_content"></Button>
+ <Button android:layout_toRightOf="@+id/button4" android:layout_alignBaseline="@+id/button4" android:layout_alignTop="@+id/button4" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Button" android:id="@+id/button5" android:layout_width="wrap_content"></Button>
+ <Button android:layout_toRightOf="@+id/button5" android:layout_alignParentBottom="true" android:layout_height="wrap_content" android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_gravity="bottom"></Button>
+</RelativeLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5.info
new file mode 100644
index 0000000..fce532e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5.info
@@ -0,0 +1,9 @@
+android.widget.LinearLayout [0,36,240,320] <LinearLayout>
+ android.widget.Button [95,0,144,36] <Button>
+ android.widget.Button [95,36,144,72] <Button>
+ android.widget.Button [191,72,240,108] <Button>
+ android.widget.LinearLayout [0,108,240,284] <LinearLayout>
+ android.widget.Button [0,70,49,106] <Button>
+ android.widget.Button [49,70,98,106] <Button>
+ android.widget.Button [98,140,147,176] <Button>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5.xml
new file mode 100644
index 0000000..afc1938
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample5.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal"></Button>
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"></Button>
+ <Button android:text="Button" android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right"></Button>
+ <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent">
+ <Button android:layout_height="wrap_content" android:layout_gravity="center" android:text="Button" android:id="@+id/button4" android:layout_width="wrap_content"></Button>
+ <Button android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Button" android:id="@+id/button5" android:layout_width="wrap_content"></Button>
+ <Button android:layout_height="wrap_content" android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_gravity="bottom"></Button>
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6-expected-changeLayout6.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6-expected-changeLayout6.xml
new file mode 100644
index 0000000..045d2ce
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6-expected-changeLayout6.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="true">
+ <Button android:layout_alignParentLeft="true" android:layout_alignBaseline="@+id/button2" android:layout_alignParentTop="true" android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <RadioButton android:layout_toRightOf="@+id/button1" android:layout_alignBaseline="@+id/button2" android:layout_alignParentTop="true" android:text="RadioButton" android:id="@+id/radioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content"></RadioButton>
+ <Button android:layout_toRightOf="@+id/radioButton1" android:layout_alignBaseline="@+id/button2" android:layout_alignParentTop="true" android:layout_width="wrap_content" android:id="@+id/button2" android:text="Button" android:layout_height="150dip"></Button>
+</RelativeLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6.info
new file mode 100644
index 0000000..7a7a44a
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6.info
@@ -0,0 +1,5 @@
+android.widget.LinearLayout [0,36,240,320] <LinearLayout>
+ android.widget.Button [0,38,49,74] <Button>
+ android.widget.RadioButton [49,36,143,72] <RadioButton>
+ android.widget.Button [143,0,192,113] <Button>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6.xml
new file mode 100644
index 0000000..5cdc824
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample6.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="true">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <RadioButton android:text="RadioButton" android:id="@+id/radioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content"></RadioButton>
+ <Button android:layout_width="wrap_content" android:id="@+id/button2" android:text="Button" android:layout_height="150dip"></Button>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract6.diff
new file mode 100644
index 0000000..636e301
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7-expected-extract6.diff
@@ -0,0 +1,10 @@
+< <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent">
+< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content">
+< <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content">
+< <!-- Comment -->
+< <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+< </LinearLayout>
+< </LinearLayout>
+< </LinearLayout>
+---
+> <include layout="@layout/newlayout6" android:id="@+id/linearLayout4_ref" android:layout_width="match_parent" android:layout_height="wrap_content"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7.info
new file mode 100644
index 0000000..134234c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7.info
@@ -0,0 +1,11 @@
+android.widget.LinearLayout [0,0,240,320] <LinearLayout>
+ android.widget.Button [0,0,101,36] <Button>
+ android.widget.LinearLayout [0,36,240,72] <LinearLayout>
+ android.widget.LinearLayout [0,0,73,36] <LinearLayout>
+ android.widget.LinearLayout [0,0,73,36] <LinearLayout>
+ android.widget.Button [0,0,73,36] <Button>
+ android.widget.LinearLayout [0,72,240,192] <LinearLayout>
+ android.widget.Button [0,0,117,36] <Button>
+ android.widget.Button [117,0,223,36] <Button>
+ android.widget.CheckBox [223,10,240,130] <CheckBox>
+ android.widget.Button [0,192,240,228] <Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7.xml
new file mode 100644
index 0000000..0445bbf
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample7.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout android:id="@+id/LinearLayout2" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
+ <Button android:text="FirstButton" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent">
+ <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="wrap_content">
+ <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout6" android:layout_width="wrap_content">
+ <!-- Comment -->
+ <Button android:text="Button" android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+ <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout9" android:layout_height="wrap_content">
+ <Button android:text="SecondButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2"></Button>
+ <Button android:text="ThirdButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button3"></Button>
+ <CheckBox android:id="@+id/checkBox1" android:text="CheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox>
+ </LinearLayout>
+ <Button android:layout_height="wrap_content" android:text="FourthButton" android:id="@+id/button4" android:layout_width="match_parent"></Button>
+</LinearLayout>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract6.diff b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract6.diff
new file mode 100644
index 0000000..024141a
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8-expected-extract6.diff
@@ -0,0 +1,15 @@
+< <LinearLayout android:layout_height="wrap_content"
+< android:id="@+id/linearLayout4" android:layout_width="match_parent">
+< <LinearLayout android:layout_height="match_parent"
+< android:layout_width="wrap_content" android:id="@+id/linearLayout5">
+< <LinearLayout android:layout_height="match_parent"
+< android:id="@+id/linearLayout6"
+< android:layout_width="wrap_content">
+< <Button android:text="Button" android:id="@+id/button6"
+< android:layout_width="wrap_content"
+< android:layout_height="wrap_content"></Button>
+< </LinearLayout>
+< </LinearLayout>
+< </LinearLayout>
+---
+> <include layout="@layout/newlayout6" android:id="@+id/linearLayout4_ref" android:layout_width="match_parent" android:layout_height="wrap_content"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8.info b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8.info
new file mode 100644
index 0000000..ca294ba
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8.info
@@ -0,0 +1,12 @@
+android.widget.LinearLayout [0,0,240,320] <LinearLayout>
+ android.widget.Button [0,0,101,36] <Button>
+ android.widget.FrameLayout [0,36,240,72] <FrameLayout>
+ android.widget.LinearLayout [0,0,240,36] <LinearLayout>
+ android.widget.LinearLayout [0,0,73,36] <LinearLayout>
+ android.widget.LinearLayout [0,0,73,36] <LinearLayout>
+ android.widget.Button [0,0,73,36] <Button>
+ android.widget.FrameLayout [0,72,240,108] <FrameLayout>
+ android.widget.LinearLayout [0,0,240,36] <LinearLayout>
+ android.widget.LinearLayout [0,0,73,36] <LinearLayout>
+ android.widget.LinearLayout [0,0,73,36] <LinearLayout>
+ android.widget.Button [0,0,73,36] <Button>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8.xml b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8.xml
new file mode 100644
index 0000000..c798469
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/sample8.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout android:id="@+id/LinearLayout2"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:orientation="vertical">
+ <Button android:text="FirstButton" android:id="@+id/button1"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <FrameLayout android:id="@+id/outer"
+ android:layout_width="match_parent" android:layout_height="wrap_content">
+ <LinearLayout android:layout_height="wrap_content"
+ android:id="@+id/linearLayout4" android:layout_width="match_parent">
+ <LinearLayout android:layout_height="match_parent"
+ android:layout_width="wrap_content" android:id="@+id/linearLayout5">
+ <LinearLayout android:layout_height="match_parent"
+ android:id="@+id/linearLayout6"
+ android:layout_width="wrap_content">
+ <Button android:text="Button" android:id="@+id/button6"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></Button>
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+ </FrameLayout>
+ <FrameLayout android:id="@+id/outer"
+ android:layout_width="match_parent" android:layout_height="wrap_content">
+ <LinearLayout android:layout_height="wrap_content"
+ android:id="@+id/linearLayout4" android:layout_width="match_parent">
+ <LinearLayout android:layout_height="match_parent"
+ android:layout_width="wrap_content" android:id="@+id/linearLayout5">
+ <LinearLayout android:layout_height="match_parent"
+ android:id="@+id/linearLayout6"
+ android:layout_width="wrap_content">
+ <Button android:text="Button" android:id="@+id/button6"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></Button>
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+ </FrameLayout>
+</LinearLayout>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java
new file mode 100644
index 0000000..5eba812
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfoTest.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.manifest;
+
+import static com.android.resources.ScreenSize.LARGE;
+import static com.android.resources.ScreenSize.NORMAL;
+import static com.android.resources.ScreenSize.XLARGE;
+
+import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest;
+import com.android.ide.eclipse.adt.internal.resources.ResourceHelper;
+import com.android.sdklib.AndroidVersion;
+import com.android.sdklib.IAndroidTarget;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Map;
+
+public class ManifestInfoTest extends AdtProjectTest {
+ @Override
+ protected boolean testCaseNeedsUniqueProject() {
+ return true;
+ }
+
+ public void testGetActivityThemes1() throws Exception {
+ ManifestInfo info = getManifestInfo(
+ "<manifest xmlns:android='http://schemas.android.com/apk/res/android'\n" +
+ " package='com.android.unittest'>\n" +
+ " <uses-sdk android:minSdkVersion='3' android:targetSdkVersion='4'/>\n" +
+ "</manifest>\n");
+ Map<String, String> map = info.getActivityThemes();
+ assertEquals(map.toString(), 0, map.size());
+ assertEquals("com.android.unittest", info.getPackage());
+ assertEquals("Theme", ResourceHelper.styleToTheme(info.getDefaultTheme(null, NORMAL)));
+ assertEquals("@android:style/Theme", info.getDefaultTheme(null, null));
+ assertEquals("Theme", ResourceHelper.styleToTheme(info.getDefaultTheme(null, XLARGE)));
+ }
+
+ public void testGetActivityThemes2() throws Exception {
+ ManifestInfo info = getManifestInfo(
+ "<manifest xmlns:android='http://schemas.android.com/apk/res/android'\n" +
+ " package='com.android.unittest'>\n" +
+ " <uses-sdk android:minSdkVersion='3' android:targetSdkVersion='11'/>\n" +
+ "</manifest>\n");
+ Map<String, String> map = info.getActivityThemes();
+ assertEquals(map.toString(), 0, map.size());
+ assertEquals("com.android.unittest", info.getPackage());
+ assertEquals("Theme.Holo", ResourceHelper.styleToTheme(info.getDefaultTheme(null,
+ XLARGE)));
+ assertEquals("Theme", ResourceHelper.styleToTheme(info.getDefaultTheme(null, LARGE)));
+ }
+
+ public void testGetActivityThemes3() throws Exception {
+ ManifestInfo info = getManifestInfo(
+ "<manifest xmlns:android='http://schemas.android.com/apk/res/android'\n" +
+ " package='com.android.unittest'>\n" +
+ " <uses-sdk android:minSdkVersion='11'/>\n" +
+ "</manifest>\n");
+ Map<String, String> map = info.getActivityThemes();
+ assertEquals(map.toString(), 0, map.size());
+ assertEquals("com.android.unittest", info.getPackage());
+ assertEquals("Theme.Holo", ResourceHelper.styleToTheme(info.getDefaultTheme(null,
+ XLARGE)));
+ assertEquals("Theme", ResourceHelper.styleToTheme(info.getDefaultTheme(null, NORMAL)));
+ }
+
+ public void testGetActivityThemes4() throws Exception {
+ ManifestInfo info = getManifestInfo(
+ "<manifest xmlns:android='http://schemas.android.com/apk/res/android'\n" +
+ " package='com.android.unittest'>\n" +
+ " <application\n" +
+ " android:label='@string/app_name'\n" +
+ " android:name='.app.TestApp' android:icon='@drawable/app_icon'>\n" +
+ "\n" +
+ " <activity\n" +
+ " android:name='.prefs.PrefsActivity'\n" +
+ " android:label='@string/prefs_title' />\n" +
+ "\n" +
+ " <activity\n" +
+ " android:name='.app.IntroActivity'\n" +
+ " android:label='@string/intro_title'\n" +
+ " android:theme='@android:style/Theme.Dialog' />\n" +
+ " </application>\n" +
+ " <uses-sdk android:minSdkVersion='3' android:targetSdkVersion='4'/>\n" +
+ "</manifest>\n" +
+ ""
+ );
+ assertEquals("com.android.unittest", info.getPackage());
+ assertEquals("Theme", ResourceHelper.styleToTheme(info.getDefaultTheme(null, XLARGE)));
+
+ Map<String, String> map = info.getActivityThemes();
+ assertEquals(map.toString(), 1, map.size());
+ assertNull(map.get("com.android.unittest.prefs.PrefsActivity"));
+ assertEquals("@android:style/Theme.Dialog",
+ map.get("com.android.unittest.app.IntroActivity"));
+ }
+
+ public void testGetActivityThemes5() throws Exception {
+ ManifestInfo info = getManifestInfo(
+ "<manifest xmlns:android='http://schemas.android.com/apk/res/android'\n" +
+ " package='com.android.unittest'" +
+ " android:theme='@style/NoBackground'>\n" +
+ " <application\n" +
+ " android:label='@string/app_name'\n" +
+ " android:name='.app.TestApp' android:icon='@drawable/app_icon'>\n" +
+ "\n" +
+ " <activity\n" +
+ " android:name='.prefs.PrefsActivity'\n" +
+ " android:label='@string/prefs_title' />\n" +
+ "\n" +
+ " <activity\n" +
+ " android:name='.app.IntroActivity'\n" +
+ " android:label='@string/intro_title'\n" +
+ " android:theme='@android:style/Theme.Dialog' />\n" +
+ " </application>\n" +
+ " <uses-sdk android:minSdkVersion='3' android:targetSdkVersion='4'/>\n" +
+ "</manifest>\n" +
+ ""
+ );
+
+ assertEquals("@style/NoBackground", info.getDefaultTheme(null, XLARGE));
+ assertEquals("@style/NoBackground", info.getDefaultTheme(null, NORMAL));
+ assertEquals("NoBackground", ResourceHelper.styleToTheme(info.getDefaultTheme(null,
+ NORMAL)));
+
+ Map<String, String> map = info.getActivityThemes();
+ assertEquals(map.toString(), 1, map.size());
+ assertNull(map.get("com.android.unittest.prefs.PrefsActivity"));
+ assertEquals("@android:style/Theme.Dialog",
+ map.get("com.android.unittest.app.IntroActivity"));
+ }
+
+ public void testGetActivityThemes6() throws Exception {
+ // Ensures that when the *rendering* target is less than version 11, we don't
+ // use Holo even though the manifest SDK version calls for it.
+ ManifestInfo info = getManifestInfo(
+ "<manifest xmlns:android='http://schemas.android.com/apk/res/android'\n" +
+ " package='com.android.unittest'>\n" +
+ " <uses-sdk android:minSdkVersion='3' android:targetSdkVersion='11'/>\n" +
+ "</manifest>\n");
+ Map<String, String> map = info.getActivityThemes();
+ assertEquals(map.toString(), 0, map.size());
+ assertEquals("com.android.unittest", info.getPackage());
+ assertEquals("Theme.Holo", ResourceHelper.styleToTheme(info.getDefaultTheme(null,
+ XLARGE)));
+
+ // Here's the check
+ IAndroidTarget olderVersion = new TestAndroidTarget(4);
+ assertEquals("Theme", ResourceHelper.styleToTheme(info.getDefaultTheme(olderVersion,
+ XLARGE)));
+
+ }
+
+ public void testGetApplicationLabelAndIcon() throws Exception {
+ ManifestInfo info = getManifestInfo(
+ "<manifest xmlns:android='http://schemas.android.com/apk/res/android'\n" +
+ " package='com.android.unittest'>\n" +
+ " <application android:icon=\"@drawable/icon\"\n" +
+ " android:label=\"@string/app_name\">\n" +
+ " </application>\n" +
+ "" +
+ "</manifest>\n");
+ Map<String, String> map = info.getActivityThemes();
+ assertEquals(map.toString(), 0, map.size());
+ assertEquals("com.android.unittest", info.getPackage());
+
+ assertEquals("Theme", ResourceHelper.styleToTheme(info.getDefaultTheme(null, NORMAL)));
+ assertEquals("@drawable/icon", info.getApplicationIcon());
+ assertEquals("@string/app_name", info.getApplicationLabel());
+ }
+
+ public void testGetApplicationNoLabelOrIcon() throws Exception {
+ ManifestInfo info = getManifestInfo(
+ "<manifest xmlns:android='http://schemas.android.com/apk/res/android'\n" +
+ " package='com.android.unittest'>\n" +
+ " <application>\n" +
+ " </application>\n" +
+ "" +
+ "</manifest>\n");
+ Map<String, String> map = info.getActivityThemes();
+ assertEquals(map.toString(), 0, map.size());
+ assertEquals("com.android.unittest", info.getPackage());
+
+ assertEquals("Theme", ResourceHelper.styleToTheme(info.getDefaultTheme(null, NORMAL)));
+ assertNull(info.getApplicationIcon());
+ assertNull(info.getApplicationLabel());
+ }
+
+ private ManifestInfo getManifestInfo(String manifestContents) throws Exception {
+ InputStream bstream = new ByteArrayInputStream(
+ manifestContents.getBytes("UTF-8")); //$NON-NLS-1$
+
+ IFile file = getProject().getFile("AndroidManifest.xml");
+ if (file.exists()) {
+ file.setContents(bstream, IFile.FORCE, new NullProgressMonitor());
+ } else {
+ file.create(bstream, false /* force */, new NullProgressMonitor());
+ }
+ return ManifestInfo.get(getProject());
+ }
+
+ private static class TestAndroidTarget implements IAndroidTarget {
+ private final int mApiLevel;
+
+ public TestAndroidTarget(int apiLevel) {
+ mApiLevel = apiLevel;
+ }
+
+ public boolean canRunOn(IAndroidTarget target) {
+ return false;
+ }
+
+ public String[] getAbiList() {
+ return null;
+ }
+
+ public String getClasspathName() {
+ return null;
+ }
+
+ public String getDefaultSkin() {
+ return null;
+ }
+
+ public String getDescription() {
+ return null;
+ }
+
+ public String getFullName() {
+ return null;
+ }
+
+ public String getImagePath(String abiType) {
+ return null;
+ }
+
+ public String getLocation() {
+ return null;
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public IOptionalLibrary[] getOptionalLibraries() {
+ return null;
+ }
+
+ public IAndroidTarget getParent() {
+ return null;
+ }
+
+ public String getPath(int pathId) {
+ return null;
+ }
+
+ public String[] getPlatformLibraries() {
+ return null;
+ }
+
+ public Map<String, String> getProperties() {
+ return null;
+ }
+
+ public String getProperty(String name) {
+ return null;
+ }
+
+ public Integer getProperty(String name, Integer defaultValue) {
+ return null;
+ }
+
+ public Boolean getProperty(String name, Boolean defaultValue) {
+ return null;
+ }
+
+ public int getRevision() {
+ return 0;
+ }
+
+ public String[] getSkins() {
+ return null;
+ }
+
+ public int getUsbVendorId() {
+ return 0;
+ }
+
+ public String getVendor() {
+ return null;
+ }
+
+ public AndroidVersion getVersion() {
+ return new AndroidVersion(mApiLevel, null);
+ }
+
+ public String getVersionName() {
+ return null;
+ }
+
+ public String hashString() {
+ return null;
+ }
+
+ public boolean isPlatform() {
+ return false;
+ }
+
+ public int compareTo(IAndroidTarget o) {
+ return 0;
+ }
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java
new file mode 100644
index 0000000..57ca80f
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java
@@ -0,0 +1,281 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.xml;
+
+import com.android.ide.common.resources.ResourceFile;
+import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
+import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest;
+import com.android.ide.eclipse.adt.internal.editors.xml.Hyperlinks.ResourceLink;
+import com.android.ide.eclipse.adt.internal.editors.xml.Hyperlinks.XmlResolver;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.internal.ErrorEditorPart;
+import org.eclipse.ui.internal.browser.WebBrowserEditor;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
+import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+@SuppressWarnings("restriction")
+public class HyperlinksTest extends AdtProjectTest {
+ @Override
+ protected boolean testCaseNeedsUniqueProject() {
+ return true;
+ }
+
+ public void testFqnRegexp() throws Exception {
+ assertTrue(Hyperlinks.CLASS_PATTERN.matcher("com.android.Foo").matches());
+ assertTrue(Hyperlinks.CLASS_PATTERN.matcher("com.android.pk_g.Foo_Bar1").
+ matches());
+ assertTrue(Hyperlinks.CLASS_PATTERN.matcher("com.android.Foo$Inner").matches());
+
+ // Should we allow non-standard packages and class names?
+ // For now, we're allowing it -- see how this works out in practice.
+ //assertFalse(XmlHyperlinkResolver.CLASS_PATTERN.matcher("Foo.bar").matches());
+ assertTrue(Hyperlinks.CLASS_PATTERN.matcher("Foo.bar").matches());
+
+ assertFalse(Hyperlinks.CLASS_PATTERN.matcher("LinearLayout").matches());
+ assertFalse(Hyperlinks.CLASS_PATTERN.matcher(".").matches());
+ assertFalse(Hyperlinks.CLASS_PATTERN.matcher(".F").matches());
+ assertFalse(Hyperlinks.CLASS_PATTERN.matcher("f.").matches());
+ assertFalse(Hyperlinks.CLASS_PATTERN.matcher("Foo").matches());
+ assertFalse(Hyperlinks.CLASS_PATTERN.matcher("com.android.1Foo").matches());
+ assertFalse(Hyperlinks.CLASS_PATTERN.matcher("1com.Foo").matches());
+ }
+
+ public void testNavigate1() throws Exception {
+ // Check navigating to a local resource
+ checkXmlNavigation("navigation1.xml", "res/layout/navigation1.xml",
+ "android:text=\"@string/app^_name\"");
+ }
+
+ public void testNavigate2() throws Exception {
+ // Check navigating to a framework resource
+ checkXmlNavigation("navigation1.xml", "res/layout/navigation1.xml",
+ "marginLeft=\"@android:dimen/app_ico^n_size\"");
+ }
+
+ public void testNavigate3() throws Exception {
+ // Check navigating to a style
+ checkXmlNavigation("navigation1.xml", "res/layout/navigation1.xml",
+ "style=\"@android:style/Widget.B^utton\"");
+ }
+
+ public void testNavigate4() throws Exception {
+ // Check navigating to resource with many resolutions
+ checkXmlNavigation("navigation1.xml", "res/layout/navigation1.xml",
+ "android:text=\"@android:st^ring/ok\"");
+ }
+
+ public void testNavigate5() throws Exception {
+ // Check navigating to styles
+ checkXmlNavigation("navigationstyles.xml", "res/values/navigationstyles.xml",
+ "parent=\"android:Theme.Li^ght\">");
+ }
+
+ public void testNavigate6() throws Exception {
+ // Check navigating to a portion of a style (this should pick android:Theme, not
+ // android:Theme.Light
+ checkXmlNavigation("navigationstyles.xml", "res/values/navigationstyles.xml",
+ "parent=\"android:The^me.Light\">");
+ }
+
+ public void testNavigate7() throws Exception {
+ // Check navigating to a resource inside text content
+ checkXmlNavigation("navigationstyles.xml", "res/values/navigationstyles.xml",
+ "popupBackground\">@android:drawable/spinner_dr^opdown_background</item>");
+ }
+
+ public void testNavigate8() throws Exception {
+ // Check navigating to a resource inside text content where there is space around
+ // the URL
+ checkXmlNavigation("navigationstyles.xml", "res/values/navigationstyles.xml",
+ "colorBackground\"> @color/cust^om_theme_color </item>");
+ }
+
+ public void testNavigate9a() throws Exception {
+ // Check navigating to a an activity
+ checkXmlNavigation("manifest.xml", "AndroidManifest.xml",
+ "<activity android:name=\".Test^Activity\"");
+ }
+
+ /* Not yet implemented
+ public void testNavigate9b() throws Exception {
+ // Check navigating to a an activity - clicking on the activity element should
+ // work too
+ checkXmlNavigation("manifest.xml", "AndroidManifest.xml",
+ "<acti^vity android:name=\".TestActivity\"");
+ }
+ */
+
+ public void testNavigate10() throws Exception {
+ // Check navigating to a permission
+ checkXmlNavigation("manifest.xml", "AndroidManifest.xml",
+ "<uses-permission android:name=\"android.permission.AC^CESS_NETWORK_STATE\" />");
+ }
+
+ public void testNavigate11a() throws Exception {
+ // Check navigating to an intent
+ checkXmlNavigation("manifest.xml", "AndroidManifest.xml",
+ "<action android:name=\"android.intent.ac^tion.MAIN\" />");
+ }
+
+ public void testNavigate11g() throws Exception {
+ // Check navigating to an intent
+ checkXmlNavigation("manifest.xml", "AndroidManifest.xml",
+ "<category android:name=\"android.intent.category.LA^UNCHER\" />");
+ }
+
+ public void testNavigate12() throws Exception {
+ // Check navigating to a custom view class
+ checkXmlNavigation("navigation1.xml", "res/layout/navigation1.xml",
+ "<my.Cust^omView></my.CustomView>");
+ }
+
+ // Left to test:
+ // onClick handling
+ // class attributes
+ // Test that the correct file is actually opened!
+
+ private void checkXmlNavigation(String basename, String targetPath,
+ String caretLocation) throws Exception {
+ IFile file = getTestDataFile(getProject(), basename, targetPath, true);
+
+ // Determine the offset
+ int offset = getCaretOffset(file, caretLocation);
+
+ // Open file
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ assertNotNull(page);
+ IEditorPart editor = IDE.openEditor(page, file);
+ assertTrue(editor.getClass().getName(), editor instanceof AndroidXmlEditor);
+ AndroidXmlEditor layoutEditor = (AndroidXmlEditor) editor;
+ ISourceViewer viewer = layoutEditor.getStructuredSourceViewer();
+
+ XmlResolver resolver = new Hyperlinks.XmlResolver();
+ IHyperlink[] links = resolver.detectHyperlinks(viewer, new Region(offset, 0), true);
+ assertNotNull(links);
+
+ StringBuilder sb = new StringBuilder(1000);
+ sb.append("Go To Declaration in " + basename + " for " + caretLocation + ":\n");
+ for (IHyperlink link : links) {
+ sb.append(link.getHyperlinkText());
+ sb.append(" : ");
+ sb.append(" [");
+ IRegion region = link.getHyperlinkRegion();
+ sb.append(viewer.getDocument().get(region.getOffset(), region.getLength()));
+ sb.append("]");
+ if (link instanceof Hyperlinks.ResourceLink) {
+ Hyperlinks.ResourceLink resourceLink = (ResourceLink) link;
+ sb.append("\n ");
+ ResourceFile resourceFile = resourceLink.getFile();
+ String desc = resourceFile.toString();
+ desc = desc.replace('\\', '/');
+ // For files in the SDK folder, strip out file prefix
+ int dataRes = desc.indexOf("data/res");
+ if (dataRes != -1) {
+ desc = desc.substring(dataRes);
+ }
+ desc = removeSessionData(desc);
+ sb.append(desc);
+ }
+ sb.append('\n');
+ }
+
+ // Open the first link
+ IHyperlink link = links[0];
+ link.open();
+ IEditorPart newEditor = Hyperlinks.getEditor();
+ // Ensure that this isn't an invalid file (e.g. opening the SDK platform files
+ // with incorrect content binding could cause this)
+ assertTrue(!(newEditor instanceof ErrorEditorPart));
+
+ IDocument document = null;
+ Point selection = null;
+
+ if (newEditor instanceof AndroidXmlEditor) {
+ AndroidXmlEditor xmlEditor = (AndroidXmlEditor) newEditor;
+ document = xmlEditor.getStructuredSourceViewer().getDocument();
+ selection = xmlEditor.getStructuredSourceViewer().getSelectedRange();
+ } else if (newEditor instanceof XMLMultiPageEditorPart) {
+ XMLMultiPageEditorPart xmlEditor = (XMLMultiPageEditorPart) newEditor;
+ Field field = xmlEditor.getClass().getDeclaredField("fTextEditor");
+ field.setAccessible(true);
+ StructuredTextEditor ste = (StructuredTextEditor) field.get(newEditor);
+ if (ste == null) {
+ Method method = xmlEditor.getClass().getMethod("getTextEditor", new Class[0]);
+ ste = (StructuredTextEditor) method.invoke(newEditor, new Object[0]);
+ }
+ StructuredTextViewer textViewer = ste.getTextViewer();
+ document = textViewer.getDocument();
+ selection = textViewer.getSelectedRange();
+ } else if (newEditor instanceof WebBrowserEditor) {
+ WebBrowserEditor browser = (WebBrowserEditor) newEditor;
+ Field field = browser.getClass().getDeclaredField("initialURL");
+ field.setAccessible(true);
+ String initialUrl = (String) field.get(newEditor);
+ int index = initialUrl.indexOf("reference");
+ if (index != -1) {
+ initialUrl = initialUrl.substring(index);
+ }
+ initialUrl = initialUrl.replace('\\', '/');
+ sb.append("\n\nAfter open, a browser is shown with this URL:\n");
+ sb.append(" ");
+ sb.append(initialUrl);
+ sb.append("\n");
+ } else {
+ fail("Unhandled editor type: " + newEditor.getClass().getName());
+ return;
+ }
+
+ if (document != null && selection != null) {
+ int lineStart = document.getLineInformationOfOffset(selection.x).getOffset();
+ IRegion lineEndInfo = document.getLineInformationOfOffset(selection.x + selection.y);
+ int lineEnd = lineEndInfo.getOffset() + lineEndInfo.getLength();
+ String text = document.get(lineStart, lineEnd - lineStart);
+ int selectionStart = selection.x - lineStart;
+ int selectionEnd = selectionStart + selection.y;
+ if (selectionEnd > selectionStart) {
+ // Selection range
+ text = text.substring(0, selectionStart) + "[^" +
+ text.substring(selectionStart, selectionEnd) + "]" +
+ text.substring(selectionEnd);
+ } else {
+ text = text.substring(0, selectionStart) + "^" +
+ text.substring(selectionStart);
+ }
+ text = removeSessionData(text);
+
+ sb.append("\n\nAfter open, the selected text is:\n");
+ sb.append(text);
+ sb.append("\n");
+ }
+
+ assertEqualsGolden(basename, sb.toString(), "txt");
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectCreationPage.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectCreationPage.java
index 0ed9ed4..f524d7f 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectCreationPage.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectCreationPage.java
@@ -1,12 +1,12 @@
/*
* Copyright (C) 2008 The Android Open Source Project
- *
+ *
* Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
+ *
* 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
@@ -20,6 +20,7 @@ import com.android.sdklib.IAndroidTarget;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.ui.IWorkingSet;
/**
* Stub class for project creation page.
@@ -87,6 +88,10 @@ public class StubProjectCreationPage extends NewProjectCreationPage {
public boolean useDefaultLocation() {
return false;
}
+
+ public IWorkingSet[] getSelectedWorkingSets() {
+ return new IWorkingSet[0];
+ }
};
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java
index 281170e..b4420e4 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java
@@ -15,7 +15,9 @@
*/
package com.android.ide.eclipse.tests;
-import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.AdtConstants;
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.sdklib.SdkConstants;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
@@ -36,6 +38,10 @@ public class AdtTestData {
private static AdtTestData sInstance = null;
private static final Logger sLogger = Logger.getLogger(AdtTestData.class.getName());
+ /** The prefered directory separator to use. */
+ private static final String DIR_SEP_STR = "/";
+ private static final char DIR_SEP_CHAR = '/';
+
/** The absolute file path to the plugin's contents. */
private String mOsRootDataPath;
@@ -54,6 +60,20 @@ public class AdtTestData {
sLogger.info("Running as an Eclipse Plug-in JUnit test, using FileLocator");
try {
mOsRootDataPath = FileLocator.resolve(url).getFile();
+ if (SdkConstants.currentPlatform() == SdkConstants.PLATFORM_WINDOWS) {
+ // Fix the path returned by the URL resolver
+ // so that it actually works on Windows.
+
+ // First, Windows paths don't start with a / especially
+ // if they contain a drive spec such as C:/...
+ int pos = mOsRootDataPath.indexOf(':');
+ if (pos > 0 && mOsRootDataPath.charAt(0) == '/') {
+ mOsRootDataPath = mOsRootDataPath.substring(1);
+ }
+
+ // Looking for "." probably inserted a /./, so clean it up
+ mOsRootDataPath = mOsRootDataPath.replace("/./", "/");
+ }
} catch (IOException e) {
sLogger.warning("IOException while using FileLocator, reverting to url");
mOsRootDataPath = url.getFile();
@@ -64,13 +84,18 @@ public class AdtTestData {
}
}
- if (mOsRootDataPath.equals(AndroidConstants.WS_SEP)) {
+ if (mOsRootDataPath.equals(AdtConstants.WS_SEP)) {
sLogger.warning("Resource data not found using class loader!, Defaulting to no path");
}
- if (!mOsRootDataPath.endsWith(File.separator)) {
+ if (File.separatorChar == '\\') {
+ // On Windows, uniformize all separators to use the / convention
+ mOsRootDataPath.replace('\\', DIR_SEP_CHAR);
+ }
+
+ if (!mOsRootDataPath.endsWith(File.separator) && !mOsRootDataPath.endsWith(DIR_SEP_STR)) {
sLogger.info("Fixing test_data env variable (does not end with path separator)");
- mOsRootDataPath = mOsRootDataPath.concat(File.separator);
+ mOsRootDataPath += DIR_SEP_STR;
}
}
@@ -91,6 +116,20 @@ public class AdtTestData {
* @return absolute OS path to test file
*/
public String getTestFilePath(String osRelativePath) {
- return mOsRootDataPath + osRelativePath;
+ File path = new File(mOsRootDataPath, osRelativePath);
+
+ if (!path.exists()) {
+ // On Windows at least this ends up using the wrong plugin path.
+ String pkgAdt = AdtPlugin .class.getPackage().getName();
+ String pkgTests = AdtTestData.class.getPackage().getName();
+
+ if (mOsRootDataPath.contains(pkgAdt)) {
+ path = new File(mOsRootDataPath.replace(pkgAdt, pkgTests), osRelativePath);
+ }
+
+ assert path.exists();
+ }
+
+ return path.getAbsolutePath();
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java
index 2774557..d8692ae 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java
@@ -17,6 +17,7 @@ package com.android.ide.eclipse.tests;
import com.android.ide.common.sdk.LoadStatus;
import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.sdklib.IAndroidTarget;
@@ -60,6 +61,13 @@ public abstract class SdkTestCase extends TestCase {
return null;
}
+ // We'll never break out of the SDK load-wait-loop if the AdtPlugin doesn't
+ // actually have a valid SDK location because it won't have started an async load:
+ String sdkLocation = AdtPrefs.getPrefs().getOsSdkFolder();
+ assertTrue("No valid SDK installation is set; for tests you typically need to set the"
+ + " environment variable ADT_TEST_SDK_PATH to point to an SDK folder",
+ sdkLocation != null && sdkLocation.length() > 0);
+
Object sdkLock = Sdk.getLock();
LoadStatus loadStatus = LoadStatus.LOADING;
// wait for ADT to load the SDK on a separate thread
@@ -85,6 +93,10 @@ public abstract class SdkTestCase extends TestCase {
return sdk;
}
+ protected boolean validateSdk(IAndroidTarget target) {
+ return true;
+ }
+
/**
* Checks that the provided sdk contains one or more valid targets.
* @param sdk the {@link Sdk} to validate.
@@ -92,6 +104,9 @@ public abstract class SdkTestCase extends TestCase {
private void validateSdk(Sdk sdk) {
assertTrue("sdk has no targets", sdk.getTargets().length > 0);
for (IAndroidTarget target : sdk.getTargets()) {
+ if (!validateSdk(target)) {
+ continue;
+ }
IStatus status = new AndroidTargetParser(target).run(new NullProgressMonitor());
if (status.getCode() != IStatus.OK) {
fail("Failed to parse targets data");
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
index f18ec36..8b71c5a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
@@ -16,29 +16,34 @@
package com.android.ide.eclipse.tests.functests.layoutRendering;
+import com.android.AndroidConstants;
import com.android.ide.common.rendering.LayoutLibrary;
+import com.android.ide.common.rendering.api.AdapterBinding;
import com.android.ide.common.rendering.api.ILayoutPullParser;
import com.android.ide.common.rendering.api.IProjectCallback;
import com.android.ide.common.rendering.api.RenderSession;
+import com.android.ide.common.rendering.api.ResourceReference;
import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.common.rendering.api.SessionParams;
import com.android.ide.common.rendering.api.SessionParams.RenderingMode;
+import com.android.ide.common.resources.ResourceRepository;
import com.android.ide.common.resources.ResourceResolver;
+import com.android.ide.common.resources.configuration.FolderConfiguration;
+import com.android.ide.common.resources.configuration.KeyboardStateQualifier;
+import com.android.ide.common.resources.configuration.NavigationMethodQualifier;
+import com.android.ide.common.resources.configuration.PixelDensityQualifier;
+import com.android.ide.common.resources.configuration.ScreenDimensionQualifier;
+import com.android.ide.common.resources.configuration.ScreenOrientationQualifier;
+import com.android.ide.common.resources.configuration.ScreenRatioQualifier;
+import com.android.ide.common.resources.configuration.ScreenSizeQualifier;
+import com.android.ide.common.resources.configuration.TextInputMethodQualifier;
+import com.android.ide.common.resources.configuration.TouchScreenQualifier;
import com.android.ide.common.sdk.LoadStatus;
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenDimensionQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenRatioQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenSizeQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.TextInputMethodQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.TouchScreenQualifier;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
import com.android.ide.eclipse.tests.SdkTestCase;
+import com.android.io.FolderWrapper;
import com.android.resources.Density;
import com.android.resources.Keyboard;
import com.android.resources.KeyboardState;
@@ -50,7 +55,6 @@ import com.android.resources.ScreenSize;
import com.android.resources.TouchScreen;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
-import com.android.sdklib.io.FolderWrapper;
import com.android.util.Pair;
import org.kxml2.io.KXmlParser;
@@ -125,6 +129,21 @@ public class ApiDemosRenderingTest extends SdkTestCase {
return null;
}
+ public ILayoutPullParser getParser(String layoutName) {
+ return null;
+ }
+
+ public Object getAdapterItemValue(ResourceReference adapterView, Object adapterCookie,
+ ResourceReference itemRef, int fullPosition, int typePosition,
+ int fullChildPosition, int typeChildPosition,
+ ResourceReference viewRef, ViewAttribute viewAttribute, Object defaultValue) {
+ return null;
+ }
+
+ public AdapterBinding getAdapterBinding(ResourceReference adapterView,
+ Object adapterCookie, Object viewObject) {
+ return null;
+ }
}
public void testApiDemos() throws IOException, XmlPullParserException {
@@ -168,13 +187,13 @@ public class ApiDemosRenderingTest extends SdkTestCase {
}
// look for the layout folder
- File layoutFolder = new File(resFolder, SdkConstants.FD_LAYOUT);
+ File layoutFolder = new File(resFolder, AndroidConstants.FD_RES_LAYOUT);
if (layoutFolder.isDirectory() == false) {
fail("Sample project has no layout folder!");
}
// first load the project's target framework resource
- ProjectResources framework = ResourceManager.getInstance().loadFrameworkResources(target);
+ ResourceRepository framework = ResourceManager.getInstance().loadFrameworkResources(target);
// now load the project resources
ProjectResources project = new ProjectResources(null /*project*/);
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/AbsoluteLayoutRuleTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/AbsoluteLayoutRuleTest.java
index f4092eb..62725b8 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/AbsoluteLayoutRuleTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/AbsoluteLayoutRuleTest.java
@@ -60,8 +60,8 @@ public class AbsoluteLayoutRuleTest extends LayoutTestBase {
// Drop preview
"useStyle(DROP_PREVIEW), drawRect(Rect[30,-10,105,80])");
- assertEquals("30dip", inserted.getStringAttr(ANDROID_URI, "layout_x"));
- assertEquals("-10dip", inserted.getStringAttr(ANDROID_URI, "layout_y"));
+ assertEquals("30dp", inserted.getStringAttr(ANDROID_URI, "layout_x"));
+ assertEquals("-10dp", inserted.getStringAttr(ANDROID_URI, "layout_y"));
// Without drag bounds we should just draw guide lines instead
inserted = dragInto(new Rect(0, 0, 0, 0), new Point(30, -10), 4, -1,
@@ -70,8 +70,8 @@ public class AbsoluteLayoutRuleTest extends LayoutTestBase {
"useStyle(GUIDELINE), drawLine(30,0,30,480), drawLine(0,-10,240,-10)",
// Drop preview
"useStyle(DROP_PREVIEW), drawLine(30,-10,240,-10), drawLine(30,-10,30,480)");
- assertEquals("30dip", inserted.getStringAttr(ANDROID_URI, "layout_x"));
- assertEquals("-10dip", inserted.getStringAttr(ANDROID_URI, "layout_y"));
+ assertEquals("30dp", inserted.getStringAttr(ANDROID_URI, "layout_x"));
+ assertEquals("-10dp", inserted.getStringAttr(ANDROID_URI, "layout_y"));
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/LayoutTestBase.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/LayoutTestBase.java
index 5b79ac3..18d985e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/LayoutTestBase.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/LayoutTestBase.java
@@ -39,7 +39,7 @@ import junit.framework.TestCase;
/**
* Common layout helpers from LayoutRule tests
*/
-public abstract class LayoutTestBase extends TestCase {
+public class LayoutTestBase extends TestCase {
/**
* Helper function used by tests to drag a button into a canvas containing
* the given children.
@@ -244,6 +244,15 @@ public abstract class LayoutTestBase extends TestCase {
fail("Not supported in tests yet");
return null;
}
+
+ public String displayIncludeSourceInput() {
+ fail("Not supported in tests yet");
+ return null;
+ }
+
+ public void select(Collection<INode> nodes) {
+ fail("Not supported in tests yet");
+ }
}
public void testDummy() {
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/TestNode.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/TestNode.java
index 14430a5..d5f1ae9 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/TestNode.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/TestNode.java
@@ -154,6 +154,13 @@ public class TestNode implements INode {
return child;
}
+ public void removeChild(INode node) {
+ int index = mChildren.indexOf(node);
+ if (index != -1) {
+ removeChild(index);
+ }
+ }
+
public boolean setAttribute(String uri, String localName, String value) {
mAttributes.put(uri + localName, new TestAttribute(uri, localName, value));
return true;
@@ -164,4 +171,5 @@ public class TestNode implements INode {
return "TestNode [fqn=" + mFqcn + ", infos=" + mAttributeInfos
+ ", attributes=" + mAttributes + ", bounds=" + mBounds + "]";
}
+
} \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtilsTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtilsTest.java
index 5ccb494..580fbaa 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtilsTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtilsTest.java
@@ -65,6 +65,7 @@ public class DescriptorsUtilsTest extends TestCase {
assertEquals("Capital", DescriptorsUtils.capitalize("Capital"));
assertEquals("CamelCase", DescriptorsUtils.capitalize("camelCase"));
assertEquals("", DescriptorsUtils.capitalize(""));
+ assertSame("Foo", DescriptorsUtils.capitalize("Foo"));
}
public void testFormatTooltip() {
@@ -240,15 +241,9 @@ public class DescriptorsUtilsTest extends TestCase {
}
}
- public void testToXmlAttributeValue() throws Exception {
- assertEquals("", DescriptorsUtils.toXmlAttributeValue(""));
- assertEquals("foo", DescriptorsUtils.toXmlAttributeValue("foo"));
- assertEquals("foo<bar", DescriptorsUtils.toXmlAttributeValue("foo<bar"));
-
- assertEquals("&quot;", DescriptorsUtils.toXmlAttributeValue("\""));
- assertEquals("&apos;", DescriptorsUtils.toXmlAttributeValue("'"));
- assertEquals("foo&quot;b&apos;&apos;ar",
- DescriptorsUtils.toXmlAttributeValue("foo\"b''ar"));
+ public void testGetBasename() {
+ assertEquals("Foo", DescriptorsUtils.getBasename("Foo"));
+ assertEquals("Foo", DescriptorsUtils.getBasename("foo.Foo"));
+ assertEquals("String", DescriptorsUtils.getBasename("java.util.String"));
}
-
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfoTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfoTest.java
index a240f90..2df472e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfoTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfoTest.java
@@ -17,6 +17,7 @@
package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
import com.android.ide.common.rendering.api.Capability;
+import com.android.ide.common.rendering.api.DataBindingItem;
import com.android.ide.common.rendering.api.MergeCookie;
import com.android.ide.common.rendering.api.ViewInfo;
import com.android.ide.eclipse.adt.internal.editors.descriptors.AttributeDescriptor;
@@ -40,7 +41,7 @@ import junit.framework.TestCase;
public class CanvasViewInfoTest extends TestCase {
- private static ViewElementDescriptor createDesc(String name, String fqn, boolean hasChildren) {
+ public static ViewElementDescriptor createDesc(String name, String fqn, boolean hasChildren) {
if (hasChildren) {
return new ViewElementDescriptor(name, name, fqn, "", "", new AttributeDescriptor[0],
new AttributeDescriptor[0], new ElementDescriptor[1], false);
@@ -49,7 +50,7 @@ public class CanvasViewInfoTest extends TestCase {
}
}
- private static UiViewElementNode createNode(UiViewElementNode parent, String fqn,
+ public static UiViewElementNode createNode(UiViewElementNode parent, String fqn,
boolean hasChildren) {
String name = fqn.substring(fqn.lastIndexOf('.') + 1);
ViewElementDescriptor descriptor = createDesc(name, fqn, hasChildren);
@@ -60,11 +61,20 @@ public class CanvasViewInfoTest extends TestCase {
return (UiViewElementNode) parent.appendNewUiChild(descriptor);
}
- private static UiViewElementNode createNode(String fqn, boolean hasChildren) {
+ public static UiViewElementNode createNode(String fqn, boolean hasChildren) {
return createNode(null, fqn, hasChildren);
}
public void testNormalCreate() throws Exception {
+ normal(true);
+ }
+
+ public void testNormalCreateLayoutLib5() throws Exception {
+ normal(false);
+ }
+
+ private void normal(boolean layoutlib5) {
+
// Normal view hierarchy, no null keys anywhere
UiViewElementNode rootNode = createNode("android.widget.LinearLayout", true);
@@ -75,7 +85,7 @@ public class CanvasViewInfoTest extends TestCase {
ViewInfo child2 = new ViewInfo("Button", child2Node, 0, 20, 70, 25);
root.setChildren(Arrays.asList(child1, child2));
- CanvasViewInfo rootView = CanvasViewInfo.create(root).getFirst();
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, layoutlib5).getFirst();
assertNotNull(rootView);
assertEquals("LinearLayout", rootView.getName());
assertEquals(new Rectangle(10, 10, 89, 89), rootView.getAbsRect());
@@ -100,6 +110,15 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testShowIn() throws Exception {
+ showIn(false);
+ }
+
+ public void testShowInLayoutLib5() throws Exception {
+ showIn(true);
+ }
+
+ public void showIn(boolean layoutlib5) throws Exception {
+
// Test rendering of "Show Included In" (included content rendered
// within an outer content that has null keys)
@@ -112,7 +131,7 @@ public class CanvasViewInfoTest extends TestCase {
ViewInfo child21 = new ViewInfo("RadioButton", child21Node, 0, 20, 70, 25);
child2.setChildren(Arrays.asList(child21));
- CanvasViewInfo rootView = CanvasViewInfo.create(root).getFirst();
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, layoutlib5).getFirst();
assertNotNull(rootView);
assertEquals("LinearLayout", rootView.getName());
assertEquals(new Rectangle(10, 10, 89, 89), rootView.getAbsRect());
@@ -137,6 +156,8 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testIncludeTag() throws Exception {
+ boolean layoutlib5 = true;
+
// Test rendering of included views on layoutlib 5+ (e.g. has <include> tag)
UiViewElementNode rootNode = createNode("android.widget.LinearLayout", true);
@@ -149,7 +170,7 @@ public class CanvasViewInfoTest extends TestCase {
ViewInfo child21 = new ViewInfo("RadioButton", null, 0, 20, 70, 25);
child2.setChildren(Arrays.asList(child21));
- CanvasViewInfo rootView = CanvasViewInfo.create(root).getFirst();
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, layoutlib5).getFirst();
assertNotNull(rootView);
assertEquals("LinearLayout", rootView.getName());
assertEquals(new Rectangle(10, 10, 89, 89), rootView.getAbsRect());
@@ -176,9 +197,10 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testNoIncludeTag() throws Exception {
+ boolean layoutlib5 = false;
+
// Test rendering of included views on layoutlib 4- (e.g. no <include> tag cookie
- // in
- // view info)
+ // in view info)
UiViewElementNode rootNode = createNode("android.widget.LinearLayout", true);
ViewInfo root = new ViewInfo("LinearLayout", rootNode, 10, 10, 100, 100);
@@ -190,7 +212,7 @@ public class CanvasViewInfoTest extends TestCase {
ViewInfo child21 = new ViewInfo("RadioButton", null, 0, 20, 70, 25);
child2.setChildren(Arrays.asList(child21));
- CanvasViewInfo rootView = CanvasViewInfo.create(root).getFirst();
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, layoutlib5).getFirst();
assertNotNull(rootView);
assertEquals("LinearLayout", rootView.getName());
assertEquals(new Rectangle(10, 10, 89, 89), rootView.getAbsRect());
@@ -217,6 +239,8 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testMergeMatching() throws Exception {
+ boolean layoutlib5 = false;
+
// Test rendering of MULTIPLE included views or when there is no simple match
// between view info and ui element node children
@@ -232,7 +256,7 @@ public class CanvasViewInfoTest extends TestCase {
ViewInfo child21 = new ViewInfo("RadioButton", null, 0, 20, 70, 25);
child2.setChildren(Arrays.asList(child21));
- CanvasViewInfo rootView = CanvasViewInfo.create(root).getFirst();
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, layoutlib5).getFirst();
assertNotNull(rootView);
assertEquals("LinearLayout", rootView.getName());
assertEquals(new Rectangle(10, 10, 89, 89), rootView.getAbsRect());
@@ -272,6 +296,8 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testMerge() throws Exception {
+ boolean layoutlib5 = false;
+
// Test rendering of MULTIPLE included views or when there is no simple match
// between view info and ui element node children
@@ -286,7 +312,7 @@ public class CanvasViewInfoTest extends TestCase {
ViewInfo child21 = new ViewInfo("RadioButton", null, 0, 20, 70, 25);
child2.setChildren(Arrays.asList(child21));
- CanvasViewInfo rootView = CanvasViewInfo.create(root).getFirst();
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, layoutlib5).getFirst();
assertNotNull(rootView);
assertEquals("LinearLayout", rootView.getName());
assertEquals(new Rectangle(10, 10, 89, 89), rootView.getAbsRect());
@@ -313,6 +339,8 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testInsertMerge() throws Exception {
+ boolean layoutlib5 = false;
+
// Test rendering of MULTIPLE included views or when there is no simple match
// between view info and ui element node children
@@ -320,7 +348,7 @@ public class CanvasViewInfoTest extends TestCase {
UiViewElementNode rootNode = createNode(mergeNode, "android.widget.Button", false);
ViewInfo root = new ViewInfo("Button", rootNode, 10, 10, 100, 100);
- CanvasViewInfo rootView = CanvasViewInfo.create(root).getFirst();
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, layoutlib5).getFirst();
assertNotNull(rootView);
assertEquals("merge", rootView.getName());
assertSame(rootView.getUiViewNode(), mergeNode);
@@ -340,6 +368,8 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testUnmatchedMissing() throws Exception {
+ boolean layoutlib5 = false;
+
UiViewElementNode rootNode = createNode("android.widget.LinearLayout", true);
ViewInfo root = new ViewInfo("LinearLayout", rootNode, 0, 0, 100, 100);
List<ViewInfo> children = new ArrayList<ViewInfo>();
@@ -387,7 +417,7 @@ public class CanvasViewInfoTest extends TestCase {
}
root.setChildren(children);
- CanvasViewInfo rootView = CanvasViewInfo.create(root).getFirst();
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, layoutlib5).getFirst();
assertNotNull(rootView);
// dump(root, 0);
@@ -412,6 +442,8 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testMergeCookies() throws Exception {
+ boolean layoutlib5 = true;
+
UiViewElementNode rootNode = createNode("android.widget.LinearLayout", true);
ViewInfo root = new ViewInfo("LinearLayout", rootNode, 0, 0, 100, 100);
@@ -431,7 +463,7 @@ public class CanvasViewInfoTest extends TestCase {
}
root.setChildren(children);
- CanvasViewInfo rootView = CanvasViewInfo.create(root).getFirst();
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, layoutlib5).getFirst();
assertNotNull(rootView);
assertEquals("LinearLayout", rootView.getName());
@@ -446,6 +478,8 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testMergeCookies2() throws Exception {
+ boolean layoutlib5 = true;
+
UiViewElementNode rootNode = createNode("android.widget.LinearLayout", true);
ViewInfo root = new ViewInfo("LinearLayout", rootNode, 0, 0, 100, 100);
@@ -460,12 +494,13 @@ public class CanvasViewInfoTest extends TestCase {
ArrayList<ViewInfo> children = new ArrayList<ViewInfo>();
for (int i = 0; i < 10; i++) {
Object cookie = (i % 2) == 0 ? cookie1 : cookie2;
- ViewInfo childView = new ViewInfo("childView" + i, cookie, 0, i * 20, 50, (i + 1) * 20);
+ ViewInfo childView = new ViewInfo("childView" + i, cookie, 0, i * 20, 50,
+ (i + 1) * 20);
children.add(childView);
}
root.setChildren(children);
- Pair<CanvasViewInfo, List<Rectangle>> result = CanvasViewInfo.create(root);
+ Pair<CanvasViewInfo, List<Rectangle>> result = CanvasViewInfo.create(root, layoutlib5);
CanvasViewInfo rootView = result.getFirst();
List<Rectangle> bounds = result.getSecond();
assertNull(bounds);
@@ -495,6 +530,8 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testIncludeBounds() throws Exception {
+ boolean layoutlib5 = true;
+
UiViewElementNode rootNode = createNode("android.widget.LinearLayout", true);
ViewInfo root = new ViewInfo("included", null, 0, 0, 100, 100);
@@ -509,12 +546,13 @@ public class CanvasViewInfoTest extends TestCase {
ArrayList<ViewInfo> children = new ArrayList<ViewInfo>();
for (int i = 0; i < 10; i++) {
Object cookie = (i % 2) == 0 ? cookie1 : cookie2;
- ViewInfo childView = new ViewInfo("childView" + i, cookie, 0, i * 20, 50, (i + 1) * 20);
+ ViewInfo childView = new ViewInfo("childView" + i, cookie, 0, i * 20, 50,
+ (i + 1) * 20);
children.add(childView);
}
root.setChildren(children);
- Pair<CanvasViewInfo, List<Rectangle>> result = CanvasViewInfo.create(root);
+ Pair<CanvasViewInfo, List<Rectangle>> result = CanvasViewInfo.create(root, layoutlib5);
CanvasViewInfo rootView = result.getFirst();
List<Rectangle> bounds = result.getSecond();
assertNotNull(rootView);
@@ -548,21 +586,27 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testIncludeBounds2() throws Exception {
+ includeBounds2(false);
+ }
+
+ public void testIncludeBounds2LayoutLib5() throws Exception {
+ includeBounds2(true);
+ }
+
+ public void includeBounds2(boolean layoutlib5) throws Exception {
+
UiViewElementNode rootNode = createNode("android.widget.LinearLayout", true);
ViewInfo root = new ViewInfo("included", null, 0, 0, 100, 100);
UiViewElementNode node1 = createNode(rootNode, "childNode1", false);
UiViewElementNode node2 = createNode(rootNode, "childNode2", false);
- // Sets alternating merge cookies and checks whether the node sibling lists are
- // okay and merged correctly
-
ViewInfo childView1 = new ViewInfo("childView1", node1, 0, 20, 50, 40);
ViewInfo childView2 = new ViewInfo("childView2", node2, 0, 40, 50, 60);
root.setChildren(Arrays.asList(childView1, childView2));
- Pair<CanvasViewInfo, List<Rectangle>> result = CanvasViewInfo.create(root);
+ Pair<CanvasViewInfo, List<Rectangle>> result = CanvasViewInfo.create(root, layoutlib5);
CanvasViewInfo rootView = result.getFirst();
List<Rectangle> bounds = result.getSecond();
assertNotNull(rootView);
@@ -580,6 +624,8 @@ public class CanvasViewInfoTest extends TestCase {
}
public void testGestureOverlayView() throws Exception {
+ boolean layoutlib5 = true;
+
// Test rendering of included views on layoutlib 5+ (e.g. has <include> tag)
UiViewElementNode rootNode = createNode("android.gesture.GestureOverlayView", true);
@@ -590,7 +636,7 @@ public class CanvasViewInfoTest extends TestCase {
root.setChildren(Collections.singletonList(child));
ViewInfo grandChild = new ViewInfo("Button", grandChildNode, 0, 20, 70, 25);
child.setChildren(Collections.singletonList(grandChild));
- CanvasViewInfo rootView = CanvasViewInfo.create(root).getFirst();
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, layoutlib5).getFirst();
assertNotNull(rootView);
assertEquals("GestureOverlayView", rootView.getName());
@@ -611,6 +657,46 @@ public class CanvasViewInfoTest extends TestCase {
assertFalse(grandChildView.isRoot());
}
+ public void testListView() throws Exception {
+ // For ListViews we get AdapterItemReferences as cookies. Ensure that this
+ // works properly.
+ //
+ // android.widget.FrameLayout [0,50,320,480] <FrameLayout>
+ // android.widget.ListView [0,0,320,430] <ListView>
+ // android.widget.LinearLayout [0,0,320,17] SessionParams$AdapterItemReference
+ // android.widget.TextView [0,0,73,17]
+ // android.widget.LinearLayout [0,18,320,35] SessionParams$AdapterItemReference
+ // android.widget.TextView [0,0,73,17]
+ // android.widget.LinearLayout [0,36,320,53] SessionParams$AdapterItemReference
+ // android.widget.TextView [0,0,73,17]
+ // ...
+
+ UiViewElementNode rootNode = createNode("FrameLayout", true);
+ UiViewElementNode childNode = createNode(rootNode, "ListView", false);
+ /*UiViewElementNode grandChildNode =*/ createNode(childNode, "LinearLayout", false);
+ /*UiViewElementNode greatGrandChildNode =*/ createNode(childNode, "TextView", false);
+ DataBindingItem dataBindingItem = new DataBindingItem("foo");
+
+ ViewInfo root = new ViewInfo("FrameLayout", rootNode, 0, 50, 320, 480);
+ ViewInfo child = new ViewInfo("ListView", childNode, 0, 0, 320, 430);
+ root.setChildren(Collections.singletonList(child));
+ ViewInfo grandChild = new ViewInfo("LinearLayout", dataBindingItem, 0, 0, 320, 17);
+ child.setChildren(Collections.singletonList(grandChild));
+ ViewInfo greatGrandChild = new ViewInfo("Button", null, 0, 0, 73, 17);
+ grandChild.setChildren(Collections.singletonList(greatGrandChild));
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, true /*layoutlib5*/).getFirst();
+ assertNotNull(rootView);
+
+ assertEquals("FrameLayout", rootView.getName());
+ assertEquals(1, rootView.getChildren().size());
+ assertSame(rootNode, rootView.getUiViewNode());
+
+ CanvasViewInfo childView = rootView.getChildren().get(0);
+ assertEquals("ListView", childView.getName());
+ assertEquals(0, childView.getChildren().size());
+ assertSame(childNode, childView.getUiViewNode());
+ }
+
/**
* Dumps out the given {@link ViewInfo} hierarchy to standard out.
* Useful during development.
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DomUtilitiesTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DomUtilitiesTest.java
new file mode 100644
index 0000000..049e1cc
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DomUtilitiesTest.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.gle2;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import java.util.Arrays;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import junit.framework.TestCase;
+
+public class DomUtilitiesTest extends TestCase {
+
+ public void testToXmlAttributeValue() throws Exception {
+ assertEquals("", DomUtilities.toXmlAttributeValue(""));
+ assertEquals("foo", DomUtilities.toXmlAttributeValue("foo"));
+ assertEquals("foo<bar", DomUtilities.toXmlAttributeValue("foo<bar"));
+
+ assertEquals("&quot;", DomUtilities.toXmlAttributeValue("\""));
+ assertEquals("&apos;", DomUtilities.toXmlAttributeValue("'"));
+ assertEquals("foo&quot;b&apos;&apos;ar",
+ DomUtilities.toXmlAttributeValue("foo\"b''ar"));
+ }
+
+ public void testIsEquivalent() throws Exception {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setValidating(false);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document document1 = builder.newDocument();
+ Document document2 = builder.newDocument();
+ document1.appendChild(document1.createElement("root"));
+ document2.appendChild(document2.createElement("root"));
+
+ assertFalse(DomUtilities.isEquivalent(null, null));
+ Element root1 = document1.getDocumentElement();
+ assertFalse(DomUtilities.isEquivalent(null, root1));
+ Element root2 = document2.getDocumentElement();
+ assertFalse(DomUtilities.isEquivalent(root2, null));
+ assertTrue(DomUtilities.isEquivalent(root1, root2));
+
+ root1.appendChild(document1.createTextNode(" "));
+ // Differences in text are NOT significant!
+ assertTrue(DomUtilities.isEquivalent(root1, root2));
+ root2.appendChild(document2.createTextNode(" "));
+ assertTrue(DomUtilities.isEquivalent(root1, root2));
+
+ Element foo1 = document1.createElement("foo");
+ Element foo2 = document2.createElement("foo");
+ root1.appendChild(foo1);
+ assertFalse(DomUtilities.isEquivalent(root1, root2));
+ root2.appendChild(foo2);
+ assertTrue(DomUtilities.isEquivalent(root1, root2));
+
+ root1.appendChild(document1.createElement("bar"));
+ assertFalse(DomUtilities.isEquivalent(root1, root2));
+ root2.appendChild(document2.createElement("bar"));
+ assertTrue(DomUtilities.isEquivalent(root1, root2));
+
+ // Add attributes in opposite order
+ foo1.setAttribute("attribute1", "value1");
+ foo1.setAttribute("attribute2", "value2");
+ assertFalse(DomUtilities.isEquivalent(root1, root2));
+ foo2.setAttribute("attribute2", "value2");
+ foo2.setAttribute("attribute1", "valueWrong");
+ assertFalse(DomUtilities.isEquivalent(root1, root2));
+ foo2.setAttribute("attribute1", "value1");
+ assertTrue(DomUtilities.isEquivalent(root1, root2));
+
+ // TODO - test different tag names
+ // TODO - test different name spaces!
+ }
+
+ public void testIsContiguous() throws Exception {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setValidating(false);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document document = builder.newDocument();
+ document.appendChild(document.createElement("root"));
+ Element root = document.getDocumentElement();
+ root.appendChild(document.createTextNode(" "));
+ Element foo = document.createElement("foo");
+ root.appendChild(foo);
+ root.appendChild(document.createTextNode(" "));
+ Element bar = document.createElement("bar");
+ root.appendChild(bar);
+ Element baz = document.createElement("baz");
+ root.appendChild(baz);
+
+ assertTrue(DomUtilities.isContiguous(Arrays.asList(foo)));
+ assertTrue(DomUtilities.isContiguous(Arrays.asList(foo, bar)));
+ assertTrue(DomUtilities.isContiguous(Arrays.asList(foo, bar, baz)));
+ assertTrue(DomUtilities.isContiguous(Arrays.asList(foo, bar, baz)));
+ assertTrue(DomUtilities.isContiguous(Arrays.asList(bar, baz, foo)));
+ assertTrue(DomUtilities.isContiguous(Arrays.asList(baz, bar, foo)));
+ assertTrue(DomUtilities.isContiguous(Arrays.asList(baz, foo, bar)));
+
+ assertFalse(DomUtilities.isContiguous(Arrays.asList(foo, baz)));
+ assertFalse(DomUtilities.isContiguous(Arrays.asList(root, baz)));
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PointTestCases.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PointTestCases.java
index 5e86d69..91d0e13 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PointTestCases.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PointTestCases.java
@@ -29,7 +29,7 @@ import junit.framework.TestCase;
* Common utilities for the point tests {@link LayoutPointTest} and
* {@link ControlPointTest}
*/
-public abstract class PointTestCases extends TestCase {
+public class PointTestCases extends TestCase {
LayoutCanvas mCanvas = new TestLayoutCanvas();
protected MouseEvent canvasMouseEvent(int x, int y, int stateMask) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionManagerTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionManagerTest.java
new file mode 100644
index 0000000..b29f9f3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionManagerTest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.editors.layout.gle2;
+
+import com.android.ide.common.rendering.api.ViewInfo;
+import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode;
+
+import org.eclipse.swt.widgets.Shell;
+
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+public class SelectionManagerTest extends TestCase {
+ private SelectionManager createManager() {
+ LayoutCanvas canvas = new LayoutCanvas(null, null, new Shell(), 0);
+ return new SelectionManager(canvas);
+ }
+
+ public void testEmpty() {
+ SelectionManager manager = createManager();
+
+ assertNotNull(manager.getSelections());
+ assertEquals(0, manager.getSelections().size());
+ assertFalse(manager.hasMultiSelection());
+ assertTrue(manager.isEmpty());
+ }
+
+ public void testBasic() {
+ SelectionManager manager = createManager();
+ assertTrue(manager.isEmpty());
+
+ UiViewElementNode rootNode = CanvasViewInfoTest.createNode("android.widget.LinearLayout",
+ true);
+ ViewInfo root = new ViewInfo("LinearLayout", rootNode, 10, 10, 100, 100);
+ UiViewElementNode child1Node = CanvasViewInfoTest.createNode(rootNode,
+ "android.widget.Button", false);
+ ViewInfo child1 = new ViewInfo("Button1", child1Node, 0, 0, 50, 20);
+ UiViewElementNode child2Node = CanvasViewInfoTest.createNode(rootNode,
+ "android.widget.Button", false);
+ ViewInfo child2 = new ViewInfo("Button2", child2Node, 0, 20, 70, 25);
+ root.setChildren(Arrays.asList(child1, child2));
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, true /* layoutlib5 */).getFirst();
+ assertNotNull(rootView);
+
+ manager.selectMultiple(Arrays.asList(rootView, rootView.getChildren().get(0), rootView
+ .getChildren().get(1)));
+ assertEquals(3, manager.getSelections().size());
+ assertFalse(manager.isEmpty());
+ assertTrue(manager.hasMultiSelection());
+
+ // Expect read-only result; ensure that's the case
+ try {
+ manager.getSelections().remove(0);
+ fail("Result should be read only collection");
+ } catch (Exception e) {
+ ; //ok, what we expected
+ }
+
+ manager.selectNone();
+ assertEquals(0, manager.getSelections().size());
+ assertTrue(manager.isEmpty());
+
+ manager.selectSingle(rootView);
+ assertEquals(1, manager.getSelections().size());
+ assertFalse(manager.isEmpty());
+ assertSame(rootView, manager.getSelections().get(0).getViewInfo());
+
+ manager.selectMultiple(Arrays.asList(rootView, rootView.getChildren().get(0), rootView
+ .getChildren().get(1)));
+ assertEquals(3, manager.getSelections().size());
+
+ manager.deselect(rootView.getChildren().get(0));
+ assertEquals(2, manager.getSelections().size());
+ manager.deselect(rootView);
+ assertEquals(1, manager.getSelections().size());
+ assertSame(rootView.getChildren().get(1), manager.getSelections().get(0).getViewInfo());
+ }
+
+ public void testSelectParent() {
+ SelectionManager manager = createManager();
+ assertTrue(manager.isEmpty());
+
+ UiViewElementNode rootNode = CanvasViewInfoTest.createNode("android.widget.LinearLayout",
+ true);
+ ViewInfo root = new ViewInfo("LinearLayout", rootNode, 10, 10, 100, 100);
+ UiViewElementNode child1Node = CanvasViewInfoTest.createNode(rootNode,
+ "android.widget.Button", false);
+ ViewInfo child1 = new ViewInfo("Button1", child1Node, 0, 0, 50, 20);
+ UiViewElementNode child2Node = CanvasViewInfoTest.createNode(rootNode,
+ "android.widget.Button", false);
+ ViewInfo child2 = new ViewInfo("Button2", child2Node, 0, 20, 70, 25);
+ root.setChildren(Arrays.asList(child1, child2));
+ CanvasViewInfo rootView = CanvasViewInfo.create(root, true /* layoutlib5 */).getFirst();
+ assertNotNull(rootView);
+
+ manager.selectMultiple(Arrays.asList(rootView.getChildren().get(0)));
+ assertEquals(1, manager.getSelections().size());
+ assertFalse(manager.isEmpty());
+ assertSame(rootView.getChildren().get(0), manager.getSelections().get(0).getViewInfo());
+
+ manager.selectParent();
+ assertEquals(1, manager.getSelections().size());
+ assertFalse(manager.isEmpty());
+ assertSame(rootView, manager.getSelections().get(0).getViewInfo());
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SwtUtilsTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SwtUtilsTest.java
index 5561e52..de7999c 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SwtUtilsTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SwtUtilsTest.java
@@ -240,18 +240,27 @@ public class SwtUtilsTest extends TestCase {
scale, alpha);
assertNotNull(result);
- ImageData data = result.getImageData();
- byte[] alphaData = data.alphaData;
- assertNotNull(alphaData);
- assertEquals(20, data.width);
- assertEquals(20, data.height);
+ ImageData outData = result.getImageData();
+ assertEquals(20, outData.width);
+ assertEquals(20, outData.height);
+
+ PaletteData outPalette = outData.palette;
+ assertNotNull(outPalette);
+
+ byte[] outAlphaData = outData.alphaData;
+ assertNotNull(outAlphaData);
+
for (int y = 0; y < 20; y++) {
for (int x = 0; x < 20; x++) {
int r = y + 60;
int g = x + 30;
- int expected = r << 16 | g << 8;
- assertEquals(expected, data.getPixel(x, y));
- assertEquals(alpha, alphaData[y*20+x]);
+
+ RGB expected = new RGB(r, g, 0);
+ RGB actual = outPalette.getRGB(outData.getPixel(x, y));
+ assertEquals(expected, actual);
+
+ byte actualAlpha = outAlphaData[y*20+x];
+ assertEquals(alpha, actualAlpha);
}
}
}
@@ -270,30 +279,41 @@ public class SwtUtilsTest extends TestCase {
scale, alpha);
assertNotNull(result);
- ImageData data = result.getImageData();
- byte[] alphaData = data.alphaData;
- assertNotNull(alphaData);
- assertEquals(120, data.width);
- assertEquals(90, data.height);
+ ImageData outData = result.getImageData();
+ assertEquals(120, outData.width);
+ assertEquals(90, outData.height);
+
+ PaletteData outPalette = outData.palette;
+ assertNotNull(outPalette);
+
+ byte[] outAlphaData = outData.alphaData;
+ assertNotNull(outAlphaData);
+
for (int y = 0; y < 20; y++) {
for (int x = 0; x < 20; x++) {
int r = y + 10;
int g = x + 10;
- int expected = r << 16 | g << 8;
- assertEquals(expected, data.getPixel(x, y));
- assertEquals(alpha, alphaData[y*120+x]);
+
+ RGB expected = new RGB(r, g, 0);
+ RGB actual = outPalette.getRGB(outData.getPixel(x, y));
+ assertEquals(expected, actual);
+
+ assertEquals(alpha, outAlphaData[y*120+x]);
}
}
for (int y = 70; y < 90; y++) {
for (int x = 100; x < 120; x++) {
int r = y + 10;
int g = x + 10;
- int expected = r << 16 | g << 8;
- assertEquals(expected, data.getPixel(x, y));
- assertEquals(alpha, alphaData[y*120+x]);
+
+ RGB expected = new RGB(r, g, 0);
+ RGB actual = outPalette.getRGB(outData.getPixel(x, y));
+ assertEquals(expected, actual);
+
+ assertEquals(alpha, outAlphaData[y*120+x]);
}
}
- assertEquals(0, alphaData[40]);
+ assertEquals(0, outAlphaData[40]);
}
/**
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java
index 277089f..9f670cc 100755
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java
@@ -48,7 +48,7 @@ public class NodeFactoryTest extends TestCase {
ViewElementDescriptor ved = new ViewElementDescriptor("xml", "com.example.MyJavaClass");
UiViewElementNode uiv = new UiViewElementNode(ved);
ViewInfo lvi = new ViewInfo("name", uiv, 10, 12, 110, 120);
- CanvasViewInfo cvi = CanvasViewInfo.create(lvi).getFirst();
+ CanvasViewInfo cvi = CanvasViewInfo.create(lvi, true /* layoutlib5 */).getFirst();
// Create a NodeProxy.
NodeProxy proxy = m.create(cvi);
@@ -95,7 +95,7 @@ public class NodeFactoryTest extends TestCase {
ViewElementDescriptor ved = new ViewElementDescriptor("xml", "com.example.MyJavaClass");
UiViewElementNode uiv = new UiViewElementNode(ved);
ViewInfo lvi = new ViewInfo("name", uiv, 10, 12, 110, 120);
- CanvasViewInfo cvi = CanvasViewInfo.create(lvi).getFirst();
+ CanvasViewInfo cvi = CanvasViewInfo.create(lvi, true /* layoutlib5 */).getFirst();
// NodeProxies are cached. Creating the same one twice returns the same proxy.
NodeProxy proxy1 = m.create(cvi);
@@ -107,7 +107,7 @@ public class NodeFactoryTest extends TestCase {
ViewElementDescriptor ved = new ViewElementDescriptor("xml", "com.example.MyJavaClass");
UiViewElementNode uiv = new UiViewElementNode(ved);
ViewInfo lvi = new ViewInfo("name", uiv, 10, 12, 110, 120);
- CanvasViewInfo cvi = CanvasViewInfo.create(lvi).getFirst();
+ CanvasViewInfo cvi = CanvasViewInfo.create(lvi, true /* layoutlib5 */).getFirst();
// NodeProxies are cached. Creating the same one twice returns the same proxy.
NodeProxy proxy1 = m.create(cvi);
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/ViewMetadataRepositoryTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/ViewMetadataRepositoryTest.java
index d18967d..5921e85 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/ViewMetadataRepositoryTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/ViewMetadataRepositoryTest.java
@@ -16,6 +16,7 @@
package com.android.ide.eclipse.adt.internal.editors.layout.gre;
import com.android.ide.common.api.IViewMetadata.FillPreference;
+import com.android.ide.eclipse.adt.internal.editors.layout.gre.ViewMetadataRepository.RenderMode;
import junit.framework.TestCase;
@@ -32,4 +33,31 @@ public class ViewMetadataRepositoryTest extends TestCase {
assertEquals(FillPreference.NONE,
repository.getFillPreference("foo.bar"));
}
+
+ // Ensure that all basenames referenced in the metadata refer to other views in the file
+ // (e.g. no typos)
+ public void testRelatedTo() throws Exception {
+ // Make sure unit tests are run with assertions on
+ boolean assertionsEnabled = false;
+ assert assertionsEnabled = true; // Intentional assignment
+ assertTrue("This unit test must be run with assertions enabled (-ea)", assertionsEnabled);
+
+ ViewMetadataRepository repository = ViewMetadataRepository.get();
+ for (String fqcn : repository.getAllFqcns()) {
+ repository.getRelatedTo(fqcn);
+ }
+ }
+
+ public void testSkip() throws Exception {
+ ViewMetadataRepository repository = ViewMetadataRepository.get();
+ assertTrue(repository.getSkip("merge"));
+ assertFalse(repository.getSkip("android.widget.Button"));
+ }
+
+ public void testRenderMode() throws Exception {
+ ViewMetadataRepository repository = ViewMetadataRepository.get();
+ assertEquals(RenderMode.NORMAL, repository.getRenderMode("android.widget.Button"));
+ assertEquals(RenderMode.SKIP, repository.getRenderMode("android.widget.LinearLayout"));
+ assertEquals(RenderMode.ALONE, repository.getRenderMode("android.widget.TabHost"));
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiElementNodeTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiElementNodeTest.java
index 30f709c..ccf4e83 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiElementNodeTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiElementNodeTest.java
@@ -16,15 +16,24 @@
package com.android.ide.eclipse.adt.internal.editors.manifest.model;
+import static com.android.ide.common.layout.LayoutConstants.ANDROID_URI;
+
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
+import com.android.ide.eclipse.adt.internal.editors.descriptors.XmlnsAttributeDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor.Mandatory;
import com.android.ide.eclipse.adt.internal.editors.mock.MockXmlNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
import java.util.Iterator;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
import junit.framework.TestCase;
public class UiElementNodeTest extends TestCase {
@@ -252,4 +261,30 @@ public class UiElementNodeTest extends TestCase {
}
+ public void testlookupNamespacePrefix() throws Exception {
+ // Setup
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setValidating(false);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document document = builder.newDocument();
+ Element rootElement = document.createElement("root");
+ Attr attr = document.createAttributeNS(XmlnsAttributeDescriptor.XMLNS_URI,
+ "xmlns:customPrefix");
+ attr.setValue(ANDROID_URI);
+ rootElement.getAttributes().setNamedItemNS(attr);
+ document.appendChild(rootElement);
+ Element root = document.getDocumentElement();
+ root.appendChild(document.createTextNode(" "));
+ Element foo = document.createElement("foo");
+ root.appendChild(foo);
+ root.appendChild(document.createTextNode(" "));
+ Element bar = document.createElement("bar");
+ root.appendChild(bar);
+ Element baz = document.createElement("baz");
+ root.appendChild(baz);
+
+ String prefix = UiElementNode.lookupNamespacePrefix(baz, ANDROID_URI);
+ assertEquals("customPrefix", prefix);
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/CountryCodeQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/CountryCodeQualifierTest.java
deleted file mode 100644
index e0fe013..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/CountryCodeQualifierTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.CountryCodeQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-
-import junit.framework.TestCase;
-
-public class CountryCodeQualifierTest extends TestCase {
-
- private CountryCodeQualifier mccq;
- private FolderConfiguration config;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mccq = new CountryCodeQualifier();
- config = new FolderConfiguration();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- mccq = null;
- config = null;
- }
-
- public void testCheckAndSet() {
- assertEquals(true, mccq.checkAndSet("mcc123", config));//$NON-NLS-1$
- assertTrue(config.getCountryCodeQualifier() != null);
- assertEquals(123, config.getCountryCodeQualifier().getCode());
- assertEquals("mcc123", config.getCountryCodeQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFailures() {
- assertEquals(false, mccq.checkAndSet("", config));//$NON-NLS-1$
- assertEquals(false, mccq.checkAndSet("mcc", config));//$NON-NLS-1$
- assertEquals(false, mccq.checkAndSet("MCC123", config));//$NON-NLS-1$
- assertEquals(false, mccq.checkAndSet("123", config));//$NON-NLS-1$
- assertEquals(false, mccq.checkAndSet("mccsdf", config));//$NON-NLS-1$
- }
-
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/DockModeQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/DockModeQualifierTest.java
deleted file mode 100644
index de05f7e..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/DockModeQualifierTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.DockModeQualifier;
-import com.android.resources.DockMode;
-
-import junit.framework.TestCase;
-
-public class DockModeQualifierTest extends TestCase {
-
- private DockModeQualifier mCarQualifier;
- private DockModeQualifier mDeskQualifier;
- private DockModeQualifier mNoneQualifier;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mCarQualifier = new DockModeQualifier(DockMode.CAR);
- mDeskQualifier = new DockModeQualifier(DockMode.DESK);
- mNoneQualifier = new DockModeQualifier(DockMode.NONE);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- mCarQualifier = null;
- mDeskQualifier = null;
- mNoneQualifier = null;
- }
-
- public void testIsBetterMatchThan() {
- assertTrue(mNoneQualifier.isBetterMatchThan(mCarQualifier, mDeskQualifier));
- assertFalse(mNoneQualifier.isBetterMatchThan(mDeskQualifier, mDeskQualifier));
- assertTrue(mNoneQualifier.isBetterMatchThan(mDeskQualifier, mCarQualifier));
- assertFalse(mNoneQualifier.isBetterMatchThan(mCarQualifier, mCarQualifier));
-
- assertTrue(mDeskQualifier.isBetterMatchThan(mCarQualifier, mDeskQualifier));
- assertFalse(mDeskQualifier.isBetterMatchThan(mCarQualifier, mCarQualifier));
-
- assertTrue(mCarQualifier.isBetterMatchThan(mDeskQualifier, mCarQualifier));
- assertFalse(mCarQualifier.isBetterMatchThan(mDeskQualifier, mDeskQualifier));
- }
-
- public void testIsMatchFor() {
- assertTrue(mNoneQualifier.isMatchFor(mCarQualifier));
- assertTrue(mNoneQualifier.isMatchFor(mDeskQualifier));
- assertTrue(mCarQualifier.isMatchFor(mCarQualifier));
- assertTrue(mDeskQualifier.isMatchFor(mDeskQualifier));
-
- assertFalse(mCarQualifier.isMatchFor(mNoneQualifier));
- assertFalse(mCarQualifier.isMatchFor(mDeskQualifier));
- assertFalse(mDeskQualifier.isMatchFor(mCarQualifier));
- assertFalse(mDeskQualifier.isMatchFor(mNoneQualifier));
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/KeyboardStateQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/KeyboardStateQualifierTest.java
deleted file mode 100644
index b97d1f8..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/KeyboardStateQualifierTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier;
-import com.android.resources.KeyboardState;
-
-import junit.framework.TestCase;
-
-public class KeyboardStateQualifierTest extends TestCase {
-
- private KeyboardStateQualifier ksq;
- private FolderConfiguration config;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- ksq = new KeyboardStateQualifier();
- config = new FolderConfiguration();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- ksq = null;
- config = null;
- }
-
- public void testExposed() {
- assertEquals(true, ksq.checkAndSet("keysexposed", config)); //$NON-NLS-1$
- assertTrue(config.getKeyboardStateQualifier() != null);
- assertEquals(KeyboardState.EXPOSED, config.getKeyboardStateQualifier().getValue());
- assertEquals("keysexposed", config.getKeyboardStateQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testHidden() {
- assertEquals(true, ksq.checkAndSet("keyshidden", config)); //$NON-NLS-1$
- assertTrue(config.getKeyboardStateQualifier() != null);
- assertEquals(KeyboardState.HIDDEN, config.getKeyboardStateQualifier().getValue());
- assertEquals("keyshidden", config.getKeyboardStateQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFailures() {
- assertEquals(false, ksq.checkAndSet("", config));//$NON-NLS-1$
- assertEquals(false, ksq.checkAndSet("KEYSEXPOSED", config));//$NON-NLS-1$
- assertEquals(false, ksq.checkAndSet("other", config));//$NON-NLS-1$
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/LanguageQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/LanguageQualifierTest.java
deleted file mode 100644
index e4a9312..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/LanguageQualifierTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.LanguageQualifier;
-
-import junit.framework.TestCase;
-
-public class LanguageQualifierTest extends TestCase {
-
- private FolderConfiguration config;
- private LanguageQualifier lq;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- config = new FolderConfiguration();
- lq = new LanguageQualifier();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- config = null;
- lq = null;
- }
-
- public void testCheckAndSet() {
- assertEquals(true, lq.checkAndSet("en", config)); //$NON-NLS-1$
- assertTrue(config.getLanguageQualifier() != null);
- assertEquals("en", config.getLanguageQualifier().toString()); //$NON-NLS-1$
-
- }
-
- public void testFailures() {
- assertEquals(false, lq.checkAndSet("", config)); //$NON-NLS-1$
- assertEquals(false, lq.checkAndSet("EN", config)); //$NON-NLS-1$
- assertEquals(false, lq.checkAndSet("abc", config)); //$NON-NLS-1$
- }
-}
-
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/NavigationMethodQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/NavigationMethodQualifierTest.java
deleted file mode 100644
index ebc34ad..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/NavigationMethodQualifierTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier;
-import com.android.resources.Navigation;
-
-import junit.framework.TestCase;
-
-public class NavigationMethodQualifierTest extends TestCase {
-
- private FolderConfiguration config;
- private NavigationMethodQualifier nmq;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- config = new FolderConfiguration();
- nmq = new NavigationMethodQualifier();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- config = null;
- nmq = null;
- }
-
- public void testDPad() {
- assertEquals(true, nmq.checkAndSet("dpad", config)); //$NON-NLS-1$
- assertTrue(config.getNavigationMethodQualifier() != null);
- assertEquals(Navigation.DPAD, config.getNavigationMethodQualifier().getValue());
- assertEquals("dpad", config.getNavigationMethodQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testTrackball() {
- assertEquals(true, nmq.checkAndSet("trackball", config)); //$NON-NLS-1$
- assertTrue(config.getNavigationMethodQualifier() != null);
- assertEquals(Navigation.TRACKBALL, config.getNavigationMethodQualifier().getValue());
- assertEquals("trackball", config.getNavigationMethodQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testWheel() {
- assertEquals(true, nmq.checkAndSet("wheel", config)); //$NON-NLS-1$
- assertTrue(config.getNavigationMethodQualifier() != null);
- assertEquals(Navigation.WHEEL, config.getNavigationMethodQualifier().getValue());
- assertEquals("wheel", config.getNavigationMethodQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFailures() {
- assertEquals(false, nmq.checkAndSet("", config));//$NON-NLS-1$
- assertEquals(false, nmq.checkAndSet("WHEEL", config));//$NON-NLS-1$
- assertEquals(false, nmq.checkAndSet("other", config));//$NON-NLS-1$
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/NetworkCodeQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/NetworkCodeQualifierTest.java
deleted file mode 100644
index 7512305..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/NetworkCodeQualifierTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.NetworkCodeQualifier;
-
-import junit.framework.TestCase;
-
-public class NetworkCodeQualifierTest extends TestCase {
-
- private NetworkCodeQualifier mncq;
- private FolderConfiguration config;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mncq = new NetworkCodeQualifier();
- config = new FolderConfiguration();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- mncq = null;
- config = null;
- }
-
- public void testCheckAndSet() {
- assertEquals(true, mncq.checkAndSet("mnc123", config));//$NON-NLS-1$
- assertTrue(config.getNetworkCodeQualifier() != null);
- assertEquals(123, config.getNetworkCodeQualifier().getCode());
- assertEquals("mnc123", config.getNetworkCodeQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFailures() {
- assertEquals(false, mncq.checkAndSet("", config));//$NON-NLS-1$
- assertEquals(false, mncq.checkAndSet("mnc", config));//$NON-NLS-1$
- assertEquals(false, mncq.checkAndSet("MNC123", config));//$NON-NLS-1$
- assertEquals(false, mncq.checkAndSet("123", config));//$NON-NLS-1$
- assertEquals(false, mncq.checkAndSet("mncsdf", config));//$NON-NLS-1$
- }
-
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/PixelDensityQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/PixelDensityQualifierTest.java
deleted file mode 100644
index 747e6d7..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/PixelDensityQualifierTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
-import com.android.resources.Density;
-
-import junit.framework.TestCase;
-
-public class PixelDensityQualifierTest extends TestCase {
-
- private PixelDensityQualifier pdq;
- private FolderConfiguration config;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- pdq = new PixelDensityQualifier();
- config = new FolderConfiguration();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- pdq = null;
- config = null;
- }
-
- public void testCheckAndSet() {
- assertEquals(true, pdq.checkAndSet("ldpi", config));//$NON-NLS-1$
- assertTrue(config.getPixelDensityQualifier() != null);
- assertEquals(Density.LOW, config.getPixelDensityQualifier().getValue());
- assertEquals("ldpi", config.getPixelDensityQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFailures() {
- assertEquals(false, pdq.checkAndSet("", config));//$NON-NLS-1$
- assertEquals(false, pdq.checkAndSet("dpi", config));//$NON-NLS-1$
- assertEquals(false, pdq.checkAndSet("123dpi", config));//$NON-NLS-1$
- assertEquals(false, pdq.checkAndSet("123", config));//$NON-NLS-1$
- assertEquals(false, pdq.checkAndSet("sdfdpi", config));//$NON-NLS-1$
- }
-
- public void testIsBetterMatchThan() {
- PixelDensityQualifier ldpi = new PixelDensityQualifier(Density.LOW);
- PixelDensityQualifier mdpi = new PixelDensityQualifier(Density.MEDIUM);
- PixelDensityQualifier hdpi = new PixelDensityQualifier(Density.HIGH);
- PixelDensityQualifier xhdpi = new PixelDensityQualifier(Density.XHIGH);
-
- // first test that each Q is a better match than all other Qs when the ref is the same Q.
- assertTrue(ldpi.isBetterMatchThan(mdpi, ldpi));
- assertTrue(ldpi.isBetterMatchThan(hdpi, ldpi));
- assertTrue(ldpi.isBetterMatchThan(xhdpi, ldpi));
-
- assertTrue(mdpi.isBetterMatchThan(ldpi, mdpi));
- assertTrue(mdpi.isBetterMatchThan(hdpi, mdpi));
- assertTrue(mdpi.isBetterMatchThan(xhdpi, mdpi));
-
- assertTrue(hdpi.isBetterMatchThan(ldpi, hdpi));
- assertTrue(hdpi.isBetterMatchThan(mdpi, hdpi));
- assertTrue(hdpi.isBetterMatchThan(xhdpi, hdpi));
-
- assertTrue(xhdpi.isBetterMatchThan(ldpi, xhdpi));
- assertTrue(xhdpi.isBetterMatchThan(mdpi, xhdpi));
- assertTrue(xhdpi.isBetterMatchThan(hdpi, xhdpi));
-
- // now test that the highest dpi is always preferable if there's no exact match
-
- // looking for ldpi:
- assertTrue(hdpi.isBetterMatchThan(mdpi, ldpi));
- assertTrue(xhdpi.isBetterMatchThan(mdpi, ldpi));
- assertTrue(xhdpi.isBetterMatchThan(hdpi, ldpi));
- // the other way around
- assertFalse(mdpi.isBetterMatchThan(hdpi, ldpi));
- assertFalse(mdpi.isBetterMatchThan(xhdpi, ldpi));
- assertFalse(hdpi.isBetterMatchThan(xhdpi, ldpi));
-
- // looking for mdpi
- assertTrue(hdpi.isBetterMatchThan(ldpi, mdpi));
- assertTrue(xhdpi.isBetterMatchThan(ldpi, mdpi));
- assertTrue(xhdpi.isBetterMatchThan(hdpi, mdpi));
- // the other way around
- assertFalse(ldpi.isBetterMatchThan(hdpi, mdpi));
- assertFalse(ldpi.isBetterMatchThan(xhdpi, mdpi));
- assertFalse(hdpi.isBetterMatchThan(xhdpi, mdpi));
-
- // looking for hdpi
- assertTrue(mdpi.isBetterMatchThan(ldpi, hdpi));
- assertTrue(xhdpi.isBetterMatchThan(ldpi, hdpi));
- assertTrue(xhdpi.isBetterMatchThan(mdpi, hdpi));
- // the other way around
- assertFalse(ldpi.isBetterMatchThan(mdpi, hdpi));
- assertFalse(ldpi.isBetterMatchThan(xhdpi, hdpi));
- assertFalse(mdpi.isBetterMatchThan(xhdpi, hdpi));
-
- // looking for xhdpi
- assertTrue(mdpi.isBetterMatchThan(ldpi, xhdpi));
- assertTrue(hdpi.isBetterMatchThan(ldpi, xhdpi));
- assertTrue(hdpi.isBetterMatchThan(mdpi, xhdpi));
- // the other way around
- assertFalse(ldpi.isBetterMatchThan(mdpi, xhdpi));
- assertFalse(ldpi.isBetterMatchThan(hdpi, xhdpi));
- assertFalse(mdpi.isBetterMatchThan(hdpi, xhdpi));
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/RegionQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/RegionQualifierTest.java
deleted file mode 100644
index a70a04b..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/RegionQualifierTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.RegionQualifier;
-
-import junit.framework.TestCase;
-
-public class RegionQualifierTest extends TestCase {
-
- private RegionQualifier rq;
- private FolderConfiguration config;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- rq = new RegionQualifier();
- config = new FolderConfiguration();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- rq = null;
- config = null;
- }
-
- public void testCheckAndSet() {
- assertEquals(true, rq.checkAndSet("rUS", config));//$NON-NLS-1$
- assertTrue(config.getRegionQualifier() != null);
- assertEquals("US", config.getRegionQualifier().getValue()); //$NON-NLS-1$
- assertEquals("rUS", config.getRegionQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFailures() {
- assertEquals(false, rq.checkAndSet("", config));//$NON-NLS-1$
- assertEquals(false, rq.checkAndSet("rus", config));//$NON-NLS-1$
- assertEquals(false, rq.checkAndSet("rUSA", config));//$NON-NLS-1$
- assertEquals(false, rq.checkAndSet("abc", config));//$NON-NLS-1$
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenDimensionQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenDimensionQualifierTest.java
deleted file mode 100644
index b25fb76..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenDimensionQualifierTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenDimensionQualifier;
-
-import junit.framework.TestCase;
-
-public class ScreenDimensionQualifierTest extends TestCase {
-
- private ScreenDimensionQualifier sdq;
- private FolderConfiguration config;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- sdq = new ScreenDimensionQualifier();
- config = new FolderConfiguration();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- sdq = null;
- config = null;
- }
-
- public void testCheckAndSet() {
- assertEquals(true, sdq.checkAndSet("400x200", config));//$NON-NLS-1$
- assertTrue(config.getScreenDimensionQualifier() != null);
- assertEquals(400, config.getScreenDimensionQualifier().getValue1());
- assertEquals(200, config.getScreenDimensionQualifier().getValue2());
- assertEquals("400x200", config.getScreenDimensionQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFailures() {
- assertEquals(false, sdq.checkAndSet("", config));//$NON-NLS-1$
- assertEquals(false, sdq.checkAndSet("400X200", config));//$NON-NLS-1$
- assertEquals(false, sdq.checkAndSet("x200", config));//$NON-NLS-1$
- assertEquals(false, sdq.checkAndSet("ax200", config));//$NON-NLS-1$
- assertEquals(false, sdq.checkAndSet("400x", config));//$NON-NLS-1$
- assertEquals(false, sdq.checkAndSet("400xa", config));//$NON-NLS-1$
- assertEquals(false, sdq.checkAndSet("other", config));//$NON-NLS-1$
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenOrientationQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenOrientationQualifierTest.java
deleted file mode 100644
index b960c97..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenOrientationQualifierTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier;
-import com.android.resources.ScreenOrientation;
-
-import junit.framework.TestCase;
-
-public class ScreenOrientationQualifierTest extends TestCase {
-
- private ScreenOrientationQualifier soq;
- private FolderConfiguration config;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- soq = new ScreenOrientationQualifier();
- config = new FolderConfiguration();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- soq = null;
- config = null;
- }
-
- public void testPortrait() {
- assertEquals(true, soq.checkAndSet("port", config)); //$NON-NLS-1$
- assertTrue(config.getScreenOrientationQualifier() != null);
- assertEquals(ScreenOrientation.PORTRAIT, config.getScreenOrientationQualifier().getValue());
- assertEquals("port", config.getScreenOrientationQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testLanscape() {
- assertEquals(true, soq.checkAndSet("land", config)); //$NON-NLS-1$
- assertTrue(config.getScreenOrientationQualifier() != null);
- assertEquals(ScreenOrientation.LANDSCAPE,
- config.getScreenOrientationQualifier().getValue());
- assertEquals("land", config.getScreenOrientationQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testSquare() {
- assertEquals(true, soq.checkAndSet("square", config)); //$NON-NLS-1$
- assertTrue(config.getScreenOrientationQualifier() != null);
- assertEquals(ScreenOrientation.SQUARE,
- config.getScreenOrientationQualifier().getValue());
- assertEquals("square", config.getScreenOrientationQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFailures() {
- assertEquals(false, soq.checkAndSet("", config));//$NON-NLS-1$
- assertEquals(false, soq.checkAndSet("PORT", config));//$NON-NLS-1$
- assertEquals(false, soq.checkAndSet("landscape", config));//$NON-NLS-1$
- assertEquals(false, soq.checkAndSet("portrait", config));//$NON-NLS-1$
- assertEquals(false, soq.checkAndSet("other", config));//$NON-NLS-1$
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenSizeQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenSizeQualifierTest.java
deleted file mode 100644
index 26cf1f3..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenSizeQualifierTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenSizeQualifier;
-import com.android.resources.ScreenSize;
-
-import junit.framework.TestCase;
-
-public class ScreenSizeQualifierTest extends TestCase {
-
- private ScreenSizeQualifier ssq;
- private FolderConfiguration config;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- ssq = new ScreenSizeQualifier();
- config = new FolderConfiguration();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- ssq = null;
- config = null;
- }
-
- public void testSmall() {
- assertEquals(true, ssq.checkAndSet("small", config)); //$NON-NLS-1$
- assertTrue(config.getScreenSizeQualifier() != null);
- assertEquals(ScreenSize.SMALL, config.getScreenSizeQualifier().getValue());
- assertEquals("small", config.getScreenSizeQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testNormal() {
- assertEquals(true, ssq.checkAndSet("normal", config)); //$NON-NLS-1$
- assertTrue(config.getScreenSizeQualifier() != null);
- assertEquals(ScreenSize.NORMAL, config.getScreenSizeQualifier().getValue());
- assertEquals("normal", config.getScreenSizeQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testLarge() {
- assertEquals(true, ssq.checkAndSet("large", config)); //$NON-NLS-1$
- assertTrue(config.getScreenSizeQualifier() != null);
- assertEquals(ScreenSize.LARGE, config.getScreenSizeQualifier().getValue());
- assertEquals("large", config.getScreenSizeQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testXLarge() {
- assertEquals(true, ssq.checkAndSet("xlarge", config)); //$NON-NLS-1$
- assertTrue(config.getScreenSizeQualifier() != null);
- assertEquals(ScreenSize.XLARGE, config.getScreenSizeQualifier().getValue());
- assertEquals("xlarge", config.getScreenSizeQualifier().toString()); //$NON-NLS-1$
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/TextInputMethodQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/TextInputMethodQualifierTest.java
deleted file mode 100644
index f9ba80b..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/TextInputMethodQualifierTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.TextInputMethodQualifier;
-import com.android.resources.Keyboard;
-
-import junit.framework.TestCase;
-
-public class TextInputMethodQualifierTest extends TestCase {
-
- private TextInputMethodQualifier timq;
- private FolderConfiguration config;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- timq = new TextInputMethodQualifier();
- config = new FolderConfiguration();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- timq = null;
- config = null;
- }
-
- public void testQuerty() {
- assertEquals(true, timq.checkAndSet("qwerty", config)); //$NON-NLS-1$
- assertTrue(config.getTextInputMethodQualifier() != null);
- assertEquals(Keyboard.QWERTY, config.getTextInputMethodQualifier().getValue());
- assertEquals("qwerty", config.getTextInputMethodQualifier().toString()); //$NON-NLS-1$
- }
-
- public void test12Key() {
- assertEquals(true, timq.checkAndSet("12key", config)); //$NON-NLS-1$
- assertTrue(config.getTextInputMethodQualifier() != null);
- assertEquals(Keyboard.TWELVEKEY, config.getTextInputMethodQualifier().getValue());
- assertEquals("12key", config.getTextInputMethodQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testNoKey() {
- assertEquals(true, timq.checkAndSet("nokeys", config)); //$NON-NLS-1$
- assertTrue(config.getTextInputMethodQualifier() != null);
- assertEquals(Keyboard.NOKEY, config.getTextInputMethodQualifier().getValue());
- assertEquals("nokeys", config.getTextInputMethodQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFailures() {
- assertEquals(false, timq.checkAndSet("", config));//$NON-NLS-1$
- assertEquals(false, timq.checkAndSet("QWERTY", config));//$NON-NLS-1$
- assertEquals(false, timq.checkAndSet("12keys", config));//$NON-NLS-1$
- assertEquals(false, timq.checkAndSet("*12key", config));//$NON-NLS-1$
- assertEquals(false, timq.checkAndSet("other", config));//$NON-NLS-1$
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/TouchScreenQualifierTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/TouchScreenQualifierTest.java
deleted file mode 100644
index 1dafa8b..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/TouchScreenQualifierTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.TouchScreenQualifier;
-import com.android.resources.TouchScreen;
-
-import junit.framework.TestCase;
-
-public class TouchScreenQualifierTest extends TestCase {
-
- private TouchScreenQualifier tsq;
- private FolderConfiguration config;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- tsq = new TouchScreenQualifier();
- config = new FolderConfiguration();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- tsq = null;
- config = null;
- }
-
- public void testNoTouch() {
- assertEquals(true, tsq.checkAndSet("notouch", config)); //$NON-NLS-1$
- assertTrue(config.getTouchTypeQualifier() != null);
- assertEquals(TouchScreen.NOTOUCH, config.getTouchTypeQualifier().getValue());
- assertEquals("notouch", config.getTouchTypeQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFinger() {
- assertEquals(true, tsq.checkAndSet("finger", config)); //$NON-NLS-1$
- assertTrue(config.getTouchTypeQualifier() != null);
- assertEquals(TouchScreen.FINGER, config.getTouchTypeQualifier().getValue());
- assertEquals("finger", config.getTouchTypeQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testStylus() {
- assertEquals(true, tsq.checkAndSet("stylus", config)); //$NON-NLS-1$
- assertTrue(config.getTouchTypeQualifier() != null);
- assertEquals(TouchScreen.STYLUS, config.getTouchTypeQualifier().getValue());
- assertEquals("stylus", config.getTouchTypeQualifier().toString()); //$NON-NLS-1$
- }
-
- public void testFailures() {
- assertEquals(false, tsq.checkAndSet("", config));//$NON-NLS-1$
- assertEquals(false, tsq.checkAndSet("STYLUS", config));//$NON-NLS-1$
- assertEquals(false, tsq.checkAndSet("other", config));//$NON-NLS-1$
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java
index f8dc9fb..f2a6b54 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java
@@ -16,14 +16,12 @@
package com.android.ide.eclipse.adt.internal.editors.resources.manager;
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQualifier;
+import com.android.ide.common.resources.ResourceFile;
+import com.android.ide.common.resources.ResourceFolder;
+import com.android.ide.common.resources.ResourceRepository;
+import com.android.ide.common.resources.SingleResourceFile;
+import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
-import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFile;
-import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFolder;
-import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFolderType;
-import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
-import com.android.ide.eclipse.adt.internal.resources.manager.SingleResourceFile;
import com.android.ide.eclipse.adt.io.IFileWrapper;
import com.android.ide.eclipse.adt.io.IFolderWrapper;
import com.android.ide.eclipse.mock.Mocks;
@@ -33,16 +31,13 @@ import com.android.resources.KeyboardState;
import com.android.resources.Navigation;
import com.android.resources.NavigationState;
import com.android.resources.NightMode;
+import com.android.resources.ResourceFolderType;
import com.android.resources.ScreenOrientation;
import com.android.resources.TouchScreen;
-import com.android.sdklib.io.IAbstractFolder;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
import junit.framework.TestCase;
public class ConfigMatchTest extends TestCase {
@@ -50,8 +45,8 @@ public class ConfigMatchTest extends TestCase {
private static final String MISC1_FILENAME = "foo.xml"; //$NON-NLS-1$
private static final String MISC2_FILENAME = "bar.xml"; //$NON-NLS-1$
+ private FolderConfiguration mDefaultConfig;
private ProjectResources mResources;
- private ResourceQualifier[] mQualifierList;
private FolderConfiguration config4;
private FolderConfiguration config3;
private FolderConfiguration config2;
@@ -61,15 +56,9 @@ public class ConfigMatchTest extends TestCase {
protected void setUp() throws Exception {
super.setUp();
- // create a Resource Manager to get a list of qualifier as instantiated by the real code.
- // Thanks for QualifierListTest we know this contains all the qualifiers.
- ResourceManager manager = ResourceManager.getInstance();
- Field qualifierListField = ResourceManager.class.getDeclaredField("mQualifiers");
- assertNotNull(qualifierListField);
- qualifierListField.setAccessible(true);
-
- // get the actual list.
- mQualifierList = (ResourceQualifier[])qualifierListField.get(manager);
+ // create a default config with all qualifiers.
+ mDefaultConfig = new FolderConfiguration();
+ mDefaultConfig.createDefault();
// create the project resources.
mResources = new ProjectResources(null /*project*/);
@@ -233,17 +222,18 @@ public class ConfigMatchTest extends TestCase {
* this particular qualifier.
*/
private FolderConfiguration getConfiguration(String... qualifierValues) {
- FolderConfiguration config = new FolderConfiguration();
+ // FolderConfiguration.getQualifierCount is always valid and up to date.
+ final int count = FolderConfiguration.getQualifierCount();
- // those must be of the same length
- assertEquals(qualifierValues.length, mQualifierList.length);
+ // Check we have the right number of qualifier.
+ assertEquals(qualifierValues.length, count);
- int index = 0;
+ FolderConfiguration config = new FolderConfiguration();
- for (ResourceQualifier qualifier : mQualifierList) {
- String value = qualifierValues[index++];
+ for (int i = 0 ; i < count ; i++) {
+ String value = qualifierValues[i];
if (value != null) {
- assertTrue(qualifier.checkAndSet(value, config));
+ assertTrue(mDefaultConfig.getQualifier(i).checkAndSet(value, config));
}
}
@@ -253,11 +243,11 @@ public class ConfigMatchTest extends TestCase {
/**
* Adds a folder to the given {@link ProjectResources} with the given
* {@link FolderConfiguration}. The folder is filled with files from the provided list.
- * @param resources the {@link ProjectResources} in which to add the folder.
+ * @param resources the {@link ResourceRepository} in which to add the folder.
* @param config the {@link FolderConfiguration} for the created folder.
* @param memberList the list of files for the folder.
*/
- private void addFolder(ProjectResources resources, FolderConfiguration config,
+ private void addFolder(ResourceRepository resources, FolderConfiguration config,
IFile[] memberList) throws Exception {
// figure out the folder name based on the configuration
@@ -267,28 +257,11 @@ public class ConfigMatchTest extends TestCase {
IFolder folder = Mocks.createFolder(folderName, memberList);
// add it to the resource, and get back a ResourceFolder object.
- ResourceFolder resFolder = _addProjectResourceFolder(resources, config, folder);
+ ResourceFolder resFolder = resources.processFolder(new IFolderWrapper(folder));
// and fill it with files from the list.
for (IFile file : memberList) {
resFolder.addFile(new SingleResourceFile(new IFileWrapper(file), resFolder));
}
}
-
- /** Calls ProjectResource.add method via reflection to circumvent access
- * restrictions that are enforced when running in the plug-in environment
- * ie cannot access package or protected members in a different plug-in, even
- * if they are in the same declared package as the accessor
- */
- private ResourceFolder _addProjectResourceFolder(ProjectResources resources,
- FolderConfiguration config, IFolder folder) throws Exception {
-
- Method addMethod = ProjectResources.class.getDeclaredMethod("add",
- ResourceFolderType.class, FolderConfiguration.class,
- IAbstractFolder.class);
- addMethod.setAccessible(true);
- ResourceFolder resFolder = (ResourceFolder)addMethod.invoke(resources,
- ResourceFolderType.LAYOUT, config, new IFolderWrapper(folder));
- return resFolder;
- }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/QualifierListTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/QualifierListTest.java
deleted file mode 100644
index 8932a00..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/QualifierListTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.manager;
-
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQualifier;
-import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
-
-import java.lang.reflect.Field;
-
-import junit.framework.TestCase;
-
-public class QualifierListTest extends TestCase {
-
- private ResourceManager mManager;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
-
- mManager = ResourceManager.getInstance();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- mManager = null;
- }
-
- public void testQualifierList() {
- try {
- // get the list of qualifier in the resource manager
- Field qualifierListField = ResourceManager.class.getDeclaredField("mQualifiers");
- assertNotNull(qualifierListField);
- qualifierListField.setAccessible(true);
-
- // get the actual list.
- ResourceQualifier[] qualifierList =
- (ResourceQualifier[])qualifierListField.get(mManager);
-
- // now get the number of qualifier in the FolderConfiguration
- Field qualCountField = FolderConfiguration.class.getDeclaredField("INDEX_COUNT");
- assertNotNull(qualCountField);
- qualCountField.setAccessible(true);
-
- // get the constant value
- Integer count = (Integer)qualCountField.get(null);
-
- // now compare
- assertEquals(count.intValue(), qualifierList.length);
- } catch (SecurityException e) {
- assertTrue(false);
- } catch (NoSuchFieldException e) {
- assertTrue(false);
- } catch (IllegalArgumentException e) {
- assertTrue(false);
- } catch (IllegalAccessException e) {
- assertTrue(false);
- }
- }
-}
-
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java
deleted file mode 100644
index ec6f99a..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.xml;
-
-import junit.framework.TestCase;
-
-public class HyperlinksTest extends TestCase {
- public void testFqnRegexp() throws Exception {
- assertTrue(Hyperlinks.CLASS_PATTERN.matcher("com.android.Foo").matches());
- assertTrue(Hyperlinks.CLASS_PATTERN.matcher("com.android.pk_g.Foo_Bar1").
- matches());
- assertTrue(Hyperlinks.CLASS_PATTERN.matcher("com.android.Foo$Inner").matches());
-
- // Should we allow non-standard packages and class names?
- // For now, we're allowing it -- see how this works out in practice.
- //assertFalse(XmlHyperlinkResolver.CLASS_PATTERN.matcher("Foo.bar").matches());
- assertTrue(Hyperlinks.CLASS_PATTERN.matcher("Foo.bar").matches());
-
- assertFalse(Hyperlinks.CLASS_PATTERN.matcher("LinearLayout").matches());
- assertFalse(Hyperlinks.CLASS_PATTERN.matcher(".").matches());
- assertFalse(Hyperlinks.CLASS_PATTERN.matcher(".F").matches());
- assertFalse(Hyperlinks.CLASS_PATTERN.matcher("f.").matches());
- assertFalse(Hyperlinks.CLASS_PATTERN.matcher("Foo").matches());
- assertFalse(Hyperlinks.CLASS_PATTERN.matcher("com.android.1Foo").matches());
- assertFalse(Hyperlinks.CLASS_PATTERN.matcher("1com.Foo").matches());
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/ResourceHelperTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/ResourceHelperTest.java
new file mode 100644
index 0000000..078e7cb
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/ResourceHelperTest.java
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.resources;
+
+import static com.android.resources.ResourceType.DIMEN;
+import static com.android.resources.ResourceType.LAYOUT;
+
+import com.android.ide.common.resources.ResourceDeltaKind;
+import com.android.ide.common.resources.configuration.FolderConfiguration;
+import com.android.ide.common.resources.configuration.ResourceQualifier;
+import com.android.resources.ResourceType;
+
+import org.eclipse.core.resources.IResourceDelta;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Test ResourceHelper
+ */
+public class ResourceHelperTest extends TestCase {
+
+ /**
+ * temp fake qualifier class.
+ */
+ private static class FakeQualifierClass extends ResourceQualifier {
+
+ @Override
+ public boolean checkAndSet(String value, FolderConfiguration config) {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ return false;
+ }
+
+ @Override
+ public String getFolderSegment() {
+ return null;
+ }
+
+ @Override
+ public String getLongDisplayValue() {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public String getShortDisplayValue() {
+ return null;
+ }
+
+ @Override
+ public String getShortName() {
+ return null;
+ }
+
+ @Override
+ public boolean hasFakeValue() {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public boolean isValid() {
+ return false;
+ }
+
+ }
+
+ public void testgetIcon() throws Exception {
+ // check that the method returns null for an unknown qualifier class
+ assertNull(ResourceHelper.getIcon(FakeQualifierClass.class));
+
+ // find all the qualifiers through FolderConfiguration.createdefault()
+ FolderConfiguration config = new FolderConfiguration();
+ config.createDefault();
+ final int count = FolderConfiguration.getQualifierCount();
+ for (int i = 0 ; i < count ; i++) {
+ ResourceQualifier qual = config.getQualifier(i);
+ assertNotNull(qual);
+ assertNotNull(qual.getClass().getCanonicalName(),
+ ResourceHelper.getIcon(qual.getClass()));
+ }
+ }
+
+ public void testGetResourceDeltaKind() {
+ assertEquals(ResourceDeltaKind.ADDED,
+ ResourceHelper.getResourceDeltaKind(IResourceDelta.ADDED));
+ assertEquals(ResourceDeltaKind.REMOVED,
+ ResourceHelper.getResourceDeltaKind(IResourceDelta.REMOVED));
+ assertEquals(ResourceDeltaKind.CHANGED,
+ ResourceHelper.getResourceDeltaKind(IResourceDelta.CHANGED));
+
+ assertNull(ResourceHelper.getResourceDeltaKind(IResourceDelta.ADDED_PHANTOM));
+ }
+
+ public void testParseResource() {
+ assertNull(ResourceHelper.parseResource(""));
+ assertNull(ResourceHelper.parseResource("not_a_resource"));
+
+ assertEquals(LAYOUT, ResourceHelper.parseResource("@layout/foo").getFirst());
+ assertEquals(DIMEN, ResourceHelper.parseResource("@dimen/foo").getFirst());
+ assertEquals(DIMEN, ResourceHelper.parseResource("@android:dimen/foo").getFirst());
+ assertEquals("foo", ResourceHelper.parseResource("@layout/foo").getSecond());
+ assertEquals("foo", ResourceHelper.parseResource("@dimen/foo").getSecond());
+ assertEquals("foo", ResourceHelper.parseResource("@android:dimen/foo").getSecond());
+ }
+
+
+ public void testIsFileBasedResourceType() throws Exception {
+ assertTrue(ResourceHelper.isFileBasedResourceType(ResourceType.ANIMATOR));
+ assertTrue(ResourceHelper.isFileBasedResourceType(ResourceType.LAYOUT));
+
+ assertFalse(ResourceHelper.isFileBasedResourceType(ResourceType.STRING));
+ assertFalse(ResourceHelper.isFileBasedResourceType(ResourceType.DIMEN));
+ assertFalse(ResourceHelper.isFileBasedResourceType(ResourceType.ID));
+
+ // Both:
+ assertTrue(ResourceHelper.isFileBasedResourceType(ResourceType.DRAWABLE));
+ assertTrue(ResourceHelper.isFileBasedResourceType(ResourceType.COLOR));
+ }
+
+ public void testIsValueBasedResourceType() throws Exception {
+ assertTrue(ResourceHelper.isValueBasedResourceType(ResourceType.STRING));
+ assertTrue(ResourceHelper.isValueBasedResourceType(ResourceType.DIMEN));
+ assertTrue(ResourceHelper.isValueBasedResourceType(ResourceType.ID));
+
+ assertFalse(ResourceHelper.isValueBasedResourceType(ResourceType.LAYOUT));
+
+ // These can be both:
+ assertTrue(ResourceHelper.isValueBasedResourceType(ResourceType.DRAWABLE));
+ assertTrue(ResourceHelper.isValueBasedResourceType(ResourceType.COLOR));
+ }
+
+ public void testCanCreateResource() throws Exception {
+ assertTrue(ResourceHelper.canCreateResource("@layout/foo"));
+ assertTrue(ResourceHelper.canCreateResource("@string/foo"));
+ assertTrue(ResourceHelper.canCreateResource("@dimen/foo"));
+ assertTrue(ResourceHelper.canCreateResource("@color/foo"));
+
+ assertFalse(ResourceHelper.canCreateResource("@typo/foo")); // nonexistent type
+ assertFalse(ResourceHelper.canCreateResource("@layout/foo bar")); // space
+ assertFalse(ResourceHelper.canCreateResource("@layout/new")); // keyword
+ assertFalse(ResourceHelper.canCreateResource("@android:string/foo")); // framework
+ assertFalse(ResourceHelper.canCreateResource("@android:dimen/foo"));
+ assertFalse(ResourceHelper.canCreateResource("@android:color/foo"));
+ }
+
+ public void testStyleToTheme() throws Exception {
+ assertEquals("Foo", ResourceHelper.styleToTheme("Foo"));
+ assertEquals("Theme", ResourceHelper.styleToTheme("@android:style/Theme"));
+ assertEquals("LocalTheme", ResourceHelper.styleToTheme("@style/LocalTheme"));
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/ResourceNameValidatorTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/ResourceNameValidatorTest.java
new file mode 100644
index 0000000..b771667
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/ResourceNameValidatorTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
+ *
+ * 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 com.android.ide.eclipse.adt.internal.resources;
+
+import com.android.resources.ResourceFolderType;
+import com.android.resources.ResourceType;
+
+import java.util.Collections;
+
+import junit.framework.TestCase;
+
+public class ResourceNameValidatorTest extends TestCase {
+ public void testValidator() throws Exception {
+ // Valid
+ ResourceNameValidator validator = ResourceNameValidator.create(true,
+ ResourceFolderType.VALUES);
+ assertTrue(validator.isValid("foo") == null);
+ assertTrue(validator.isValid("foo.xml") == null);
+ assertTrue(validator.isValid("Foo123_$") == null);
+
+ // Invalid
+ assertTrue(validator.isValid("") != null);
+ assertTrue(validator.isValid(" ") != null);
+ assertTrue(validator.isValid("foo.xm") != null);
+ assertTrue(validator.isValid("foo bar") != null);
+ assertTrue(validator.isValid("1foo") != null);
+ assertTrue(validator.isValid("foo%bar") != null);
+ assertTrue(ResourceNameValidator.create(true, Collections.singleton("foo"),
+ ResourceType.STRING).isValid("foo") != null);
+
+ // Only lowercase chars allowed in file-based resource names
+ assertTrue(ResourceNameValidator.create(true, ResourceFolderType.LAYOUT)
+ .isValid("Foo123_$") != null);
+ assertTrue(ResourceNameValidator.create(true, ResourceFolderType.LAYOUT)
+ .isValid("foo123_") == null);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/manager/FolderTypeRelationShipTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/manager/FolderTypeRelationShipTest.java
deleted file mode 100644
index f1ce9d9..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/manager/FolderTypeRelationShipTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.resources.manager;
-
-import com.android.resources.ResourceType;
-
-import junit.framework.TestCase;
-
-public class FolderTypeRelationShipTest extends TestCase {
-
- public void testResourceType() {
- // all resource type should be in the FolderTypeRelationShip map.
- // loop on all the enum, and make sure there's at least one folder type for it.
- for (ResourceType type : ResourceType.values()) {
- assertTrue(type.getDisplayName(),
- FolderTypeRelationship.getRelatedFolders(type).length > 0);
- }
- }
-
- public void testResourceFolderType() {
- // all resource folder type should generate at least one type of resource.
- // loop on all the enum, and make sure there's at least one res type for it.
- for (ResourceFolderType type : ResourceFolderType.values()) {
- assertTrue(type.getName(),
- FolderTypeRelationship.getRelatedResourceTypes(type).length > 0);
- }
- }
-
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/ResourceNameValidatorTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/ResourceNameValidatorTest.java
deleted file mode 100644
index 5ee6793..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/ResourceNameValidatorTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.wizards.newxmlfile;
-
-import java.util.Collections;
-
-import junit.framework.TestCase;
-
-public class ResourceNameValidatorTest extends TestCase {
- public void testValidator() throws Exception {
- // Valid
- assertTrue(ResourceNameValidator.create(true).isValid("foo") == null);
- assertTrue(ResourceNameValidator.create(true).isValid("foo.xml") == null);
- assertTrue(ResourceNameValidator.create(true).isValid("Foo123_$") == null);
-
- // Invalid
- assertTrue(ResourceNameValidator.create(true).isValid("") != null);
- assertTrue(ResourceNameValidator.create(true).isValid(" ") != null);
- assertTrue(ResourceNameValidator.create(true).isValid("foo.xm") != null);
- assertTrue(ResourceNameValidator.create(true).isValid("foo bar") != null);
- assertTrue(ResourceNameValidator.create(true).isValid("1foo") != null);
- assertTrue(ResourceNameValidator.create(true).isValid("foo%bar") != null);
- assertTrue(ResourceNameValidator.create(true, Collections.singleton("foo"))
- .isValid("foo") != null);
- }
-}