aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-10-25 13:14:43 -0700
committerTor Norbye <tnorbye@google.com>2012-10-29 07:17:24 -0700
commit2b74b0d5e2bda859cc925ebd314f5e5122c5350a (patch)
tree46724e517813a255bc1dbb1a906ce2e97cdceefd /templates
parentd4a7e7b92f518e45800dc32ae7cbe5f6d4ed4c43 (diff)
downloadsdk-2b74b0d5e2bda859cc925ebd314f5e5122c5350a.zip
sdk-2b74b0d5e2bda859cc925ebd314f5e5122c5350a.tar.gz
sdk-2b74b0d5e2bda859cc925ebd314f5e5122c5350a.tar.bz2
Template unit tests
This adds a plugin test which runs through project creation for all project+activity combinations, across a series of minSdkVersion, targetSdkVersion and build targets, and also varies all the enum and boolean properties (such as the theme setting, the navigation type, etc). For each created project, it runs both ant (to verify that there are no build errors), as well as lint, to verify that there are no lint warnings, except a few allowed ones (such as the is-using-latest-targetSdkVersion, since we are deliberately testing older targetSdkVersions, and the icon checks (disabled because something about the image loading from unit tests hangs Eclipse). It also tests creating all non-activity templates into an existing project. Also fixes a few template issues found by the unit test. Change-Id: Ibe61c47053a7c3ad17e7e1bbb31f9ae3b49c143a
Diffstat (limited to 'templates')
-rw-r--r--templates/activities/BlankActivity/root/res/values/strings.xml.ftl4
-rw-r--r--templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl9
2 files changed, 8 insertions, 5 deletions
diff --git a/templates/activities/BlankActivity/root/res/values/strings.xml.ftl b/templates/activities/BlankActivity/root/res/values/strings.xml.ftl
index 4ba950a..8c7636e 100644
--- a/templates/activities/BlankActivity/root/res/values/strings.xml.ftl
+++ b/templates/activities/BlankActivity/root/res/values/strings.xml.ftl
@@ -5,11 +5,11 @@
<string name="menu_settings">Settings</string>
- <string name="hello_world">Hello world!</string>
-
<#if navType != "none">
<string name="title_section1">Section 1</string>
<string name="title_section2">Section 2</string>
<string name="title_section3">Section 3</string>
+ <#else>
+ <string name="hello_world">Hello world!</string>
</#if>
</resources>
diff --git a/templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl b/templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl
index 7aa79bd..30c4f4a 100644
--- a/templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl
+++ b/templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl
@@ -1,5 +1,7 @@
package ${packageName};
+import java.util.Locale;
+
<#if navType?contains("tabs")>import android.app.ActionBar;
import android.app.FragmentTransaction;</#if>
import android.os.Bundle;
@@ -133,13 +135,14 @@ public class ${activityClass} extends FragmentActivity<#if navType?contains("tab
@Override
public CharSequence getPageTitle(int position) {
+ Locale l = Locale.getDefault();
switch (position) {
case 0:
- return getString(R.string.title_section1).toUpperCase();
+ return getString(R.string.title_section1).toUpperCase(l);
case 1:
- return getString(R.string.title_section2).toUpperCase();
+ return getString(R.string.title_section2).toUpperCase(l);
case 2:
- return getString(R.string.title_section3).toUpperCase();
+ return getString(R.string.title_section3).toUpperCase(l);
}
return null;
}