diff options
Diffstat (limited to 'tests')
36 files changed, 939 insertions, 272 deletions
diff --git a/tests/AndroidTests/res/values-12key-63x57/configVarying.xml b/tests/AndroidTests/res/values-12key-63x57/configVarying.xml new file mode 100644 index 0000000..50b3765 --- /dev/null +++ b/tests/AndroidTests/res/values-12key-63x57/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple 12key 63x57</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag 12key 63x57</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-12key-dpad/configVarying.xml b/tests/AndroidTests/res/values-12key-dpad/configVarying.xml new file mode 100644 index 0000000..83eb080 --- /dev/null +++ b/tests/AndroidTests/res/values-12key-dpad/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple 12key dpad</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag 12key dpad</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-12key/configVarying.xml b/tests/AndroidTests/res/values-12key/configVarying.xml index 14ce1a7..e11340c 100644 --- a/tests/AndroidTests/res/values-12key/configVarying.xml +++ b/tests/AndroidTests/res/values-12key/configVarying.xml @@ -19,8 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag 12key</item> </bag> - <item type="configVarying" name="simple_12key">only simple 12key</item> - <bag type="configVarying" name="bag_12key"> - <item name="testString">only bag 12key</item> - </bag> </resources> diff --git a/tests/AndroidTests/res/values-240dpi/configVarying.xml b/tests/AndroidTests/res/values-240dpi/configVarying.xml new file mode 100644 index 0000000..9f32f8d --- /dev/null +++ b/tests/AndroidTests/res/values-240dpi/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple 240dpi</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag 240dpi</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-320x200/configVarying.xml b/tests/AndroidTests/res/values-320x200/configVarying.xml index 035e55e..ca2a286 100644 --- a/tests/AndroidTests/res/values-320x200/configVarying.xml +++ b/tests/AndroidTests/res/values-320x200/configVarying.xml @@ -19,8 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag 320x200</item> </bag> - <item type="configVarying" name="simple_320x200">only simple 320x200</item> - <bag type="configVarying" name="bag_320x200"> - <item name="testString">only bag 320x200</item> - </bag> </resources> diff --git a/tests/AndroidTests/res/values-32dpi-keysexposed/configVarying.xml b/tests/AndroidTests/res/values-32dpi-keysexposed/configVarying.xml new file mode 100644 index 0000000..cd7f8da --- /dev/null +++ b/tests/AndroidTests/res/values-32dpi-keysexposed/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple 32dpi keysexposed</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag 32dpi keysexposed</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-32dpi-stylus/configVarying.xml b/tests/AndroidTests/res/values-32dpi-stylus/configVarying.xml new file mode 100644 index 0000000..63fcdc8 --- /dev/null +++ b/tests/AndroidTests/res/values-32dpi-stylus/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple 32dpi stylus</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag 32dpi stylus</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-480x320/configVarying.xml b/tests/AndroidTests/res/values-480x320/configVarying.xml index 8b28d89..d4305fc 100644 --- a/tests/AndroidTests/res/values-480x320/configVarying.xml +++ b/tests/AndroidTests/res/values-480x320/configVarying.xml @@ -19,8 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag 480x320</item> </bag> - <item type="configVarying" name="simple_480x320">only simple 480x320</item> - <bag type="configVarying" name="bag_480x320"> - <item name="testString">only bag 480x320</item> - </bag> </resources> diff --git a/tests/AndroidTests/res/values-dpad-63x57/configVarying.xml b/tests/AndroidTests/res/values-dpad-63x57/configVarying.xml new file mode 100644 index 0000000..8383e9e --- /dev/null +++ b/tests/AndroidTests/res/values-dpad-63x57/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple dpad 63x57</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag dpad 63x57</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-finger/configVarying.xml b/tests/AndroidTests/res/values-finger/configVarying.xml index efe4758..674787e 100644 --- a/tests/AndroidTests/res/values-finger/configVarying.xml +++ b/tests/AndroidTests/res/values-finger/configVarying.xml @@ -19,8 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag finger</item> </bag> - <item type="configVarying" name="simple_finger">only simple finger</item> - <bag type="configVarying" name="bag_finger"> - <item name="testString">only bag finger</item> - </bag> </resources> diff --git a/tests/AndroidTests/res/values-keysexposed-12key/configVarying.xml b/tests/AndroidTests/res/values-keysexposed-12key/configVarying.xml new file mode 100644 index 0000000..2a2b8d9 --- /dev/null +++ b/tests/AndroidTests/res/values-keysexposed-12key/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple keysexposed 12key</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag keysexposed 12key</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-keysexposed-dpad/configVarying.xml b/tests/AndroidTests/res/values-keysexposed-dpad/configVarying.xml new file mode 100644 index 0000000..f279eb0 --- /dev/null +++ b/tests/AndroidTests/res/values-keysexposed-dpad/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple keysexposed dpad</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag keysexposed dpad</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-land/configVarying.xml b/tests/AndroidTests/res/values-land/configVarying.xml new file mode 100644 index 0000000..7d3d7e8 --- /dev/null +++ b/tests/AndroidTests/res/values-land/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple landscape</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag landscape</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-mcc111-mnc222/configVarying.xml b/tests/AndroidTests/res/values-mcc111-mnc222/configVarying.xml new file mode 100644 index 0000000..84c31c6 --- /dev/null +++ b/tests/AndroidTests/res/values-mcc111-mnc222/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple mcc111 mnc222</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag mcc111 mnc222</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-mcc111-xx-rYY/configVarying.xml b/tests/AndroidTests/res/values-mcc111-xx-rYY/configVarying.xml new file mode 100644 index 0000000..3aa1ba0 --- /dev/null +++ b/tests/AndroidTests/res/values-mcc111-xx-rYY/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple mcc111 xx-rYY</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag mcc111 xx-rYY</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-mcc111-xx/configVarying.xml b/tests/AndroidTests/res/values-mcc111-xx/configVarying.xml new file mode 100644 index 0000000..09bd817 --- /dev/null +++ b/tests/AndroidTests/res/values-mcc111-xx/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple mcc111 xx</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag mcc111 xx</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-mcc111/configVarying.xml b/tests/AndroidTests/res/values-mcc111/configVarying.xml index 16b13a5..b516194 100644 --- a/tests/AndroidTests/res/values-mcc111/configVarying.xml +++ b/tests/AndroidTests/res/values-mcc111/configVarying.xml @@ -19,8 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag mcc111</item> </bag> - <item type="configVarying" name="simple_mcc111">only simple mcc111</item> - <bag type="configVarying" name="bag_mcc111"> - <item name="testString">only bag mcc111</item> - </bag> </resources> diff --git a/tests/AndroidTests/res/values-mnc222-square/configVarying.xml b/tests/AndroidTests/res/values-mnc222-square/configVarying.xml new file mode 100644 index 0000000..952c595 --- /dev/null +++ b/tests/AndroidTests/res/values-mnc222-square/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple mnc222 square</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag mnc222 square</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-mnc222-xx/configVarying.xml b/tests/AndroidTests/res/values-mnc222-xx/configVarying.xml new file mode 100644 index 0000000..c1cafbc --- /dev/null +++ b/tests/AndroidTests/res/values-mnc222-xx/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple mnc222 xx</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag mnc222 xx</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-mnc222/configVarying.xml b/tests/AndroidTests/res/values-mnc222/configVarying.xml index 7f68729..a37b7ef 100644 --- a/tests/AndroidTests/res/values-mnc222/configVarying.xml +++ b/tests/AndroidTests/res/values-mnc222/configVarying.xml @@ -19,8 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag mnc222</item> </bag> - <item type="configVarying" name="simple_mnc222">only simple mnc222</item> - <bag type="configVarying" name="bag_mnc222"> - <item name="testString">only bag mnc222</item> - </bag> </resources> diff --git a/tests/AndroidTests/res/values-notouch/configVarying.xml b/tests/AndroidTests/res/values-notouch/configVarying.xml index 8a71de4..f919f87 100644 --- a/tests/AndroidTests/res/values-notouch/configVarying.xml +++ b/tests/AndroidTests/res/values-notouch/configVarying.xml @@ -19,8 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag notouch</item> </bag> - <item type="configVarying" name="simple_notouch">only simple notouch</item> - <bag type="configVarying" name="bag_notouch"> - <item name="testString">only bag notouch</item> - </bag> </resources> diff --git a/tests/AndroidTests/res/values-port/configVarying.xml b/tests/AndroidTests/res/values-port/configVarying.xml new file mode 100644 index 0000000..0e1f247 --- /dev/null +++ b/tests/AndroidTests/res/values-port/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple portrait</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag portrait</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-square-32dpi/configVarying.xml b/tests/AndroidTests/res/values-square-32dpi/configVarying.xml new file mode 100644 index 0000000..41a69cd --- /dev/null +++ b/tests/AndroidTests/res/values-square-32dpi/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple square 32dpi</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag square 32dpi</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-square-stylus/configVarying.xml b/tests/AndroidTests/res/values-square-stylus/configVarying.xml new file mode 100644 index 0000000..de7892e --- /dev/null +++ b/tests/AndroidTests/res/values-square-stylus/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple square stylus</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag square stylus</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-square/configVarying.xml b/tests/AndroidTests/res/values-square/configVarying.xml new file mode 100644 index 0000000..ba3a036 --- /dev/null +++ b/tests/AndroidTests/res/values-square/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple square</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag square</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-stylus-12key/configVarying.xml b/tests/AndroidTests/res/values-stylus-12key/configVarying.xml new file mode 100644 index 0000000..d79f079 --- /dev/null +++ b/tests/AndroidTests/res/values-stylus-12key/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple stylus 12key</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag stylus 12key</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-stylus-keysexposed/configVarying.xml b/tests/AndroidTests/res/values-stylus-keysexposed/configVarying.xml new file mode 100644 index 0000000..ff4e766 --- /dev/null +++ b/tests/AndroidTests/res/values-stylus-keysexposed/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple stylus keysexposed</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag stylus keysexposed</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-stylus/configVarying.xml b/tests/AndroidTests/res/values-stylus/configVarying.xml index 87df119..83936a7 100644 --- a/tests/AndroidTests/res/values-stylus/configVarying.xml +++ b/tests/AndroidTests/res/values-stylus/configVarying.xml @@ -19,8 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag stylus</item> </bag> - <item type="configVarying" name="simple_stylus">only simple stylus</item> - <bag type="configVarying" name="bag_stylus"> - <item name="testString">only bag stylus</item> - </bag> </resources> diff --git a/tests/AndroidTests/res/values-xx-32dpi/configVarying.xml b/tests/AndroidTests/res/values-xx-32dpi/configVarying.xml new file mode 100644 index 0000000..4cc162c --- /dev/null +++ b/tests/AndroidTests/res/values-xx-32dpi/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple xx 32dpi</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag xx 32dpi</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-xx-rYY/configVarying.xml b/tests/AndroidTests/res/values-xx-rYY/configVarying.xml index 4e52db9..2d2a9a1 100644 --- a/tests/AndroidTests/res/values-xx-rYY/configVarying.xml +++ b/tests/AndroidTests/res/values-xx-rYY/configVarying.xml @@ -19,8 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag xx-rYY</item> </bag> - <item type="configVarying" name="simple_xx_rYY">only simple xx_rYY</item> - <bag type="configVarying" name="bag_xx_rYY"> - <item name="testString">only bag xx_rYY</item> - </bag> </resources> diff --git a/tests/AndroidTests/res/values-xx-square/configVarying.xml b/tests/AndroidTests/res/values-xx-square/configVarying.xml new file mode 100644 index 0000000..807feec --- /dev/null +++ b/tests/AndroidTests/res/values-xx-square/configVarying.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <item type="configVarying" name="simple">simple xx square</item> + <bag type="configVarying" name="bag"> + <item name="testString">bag xx square</item> + </bag> +</resources> diff --git a/tests/AndroidTests/res/values-xx/configVarying.xml b/tests/AndroidTests/res/values-xx/configVarying.xml index e50649d..fef2737 100644 --- a/tests/AndroidTests/res/values-xx/configVarying.xml +++ b/tests/AndroidTests/res/values-xx/configVarying.xml @@ -19,8 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag xx</item> </bag> - <item type="configVarying" name="simple_xx">only simple xx</item> - <bag type="configVarying" name="bag_xx"> - <item name="testString">only bag xx</item> - </bag> </resources> diff --git a/tests/AndroidTests/res/values/configVarying.xml b/tests/AndroidTests/res/values/configVarying.xml index c4a20ad..3b3e4a4 100644 --- a/tests/AndroidTests/res/values/configVarying.xml +++ b/tests/AndroidTests/res/values/configVarying.xml @@ -19,9 +19,4 @@ <bag type="configVarying" name="bag"> <item name="testString">bag default</item> </bag> - - <item type="configVarying" name="simple_default">only simple default</item> - <bag type="configVarying" name="bag_default"> - <item name="testString">only bag default</item> - </bag> </resources> diff --git a/tests/AndroidTests/src/com/android/unit_tests/content/ConfigTest.java b/tests/AndroidTests/src/com/android/unit_tests/content/ConfigTest.java index a63885d..1ea83c3 100644 --- a/tests/AndroidTests/src/com/android/unit_tests/content/ConfigTest.java +++ b/tests/AndroidTests/src/com/android/unit_tests/content/ConfigTest.java @@ -32,6 +32,20 @@ import com.android.unit_tests.R; import java.util.Locale; public class ConfigTest extends AndroidTestCase { + enum properties { + LANGUAGE, + COUNTRY, + MCC, + MNC, + TOUCHSCREEN, + KEYBOARD, + KEYBOARDHIDDEN, + NAVIGATION, + ORIENTATION, + WIDTH, + HEIGHT, + DENSITY + } private static void checkValue(Resources res, int resId, String expectedValue) { try { @@ -40,8 +54,8 @@ public class ConfigTest extends AndroidTestCase { + actual + "' from resource 0x" + Integer.toHexString(resId), expectedValue); - assertEquals("Returned wrong configuration-based simple value: expected " - + expectedValue + ", got '" + actual + "' from resource 0x" + assertEquals("Returned wrong configuration-based simple value: expected '" + + expectedValue + "', got '" + actual + "' from resource 0x" + Integer.toHexString(resId), expectedValue, actual); } catch (Resources.NotFoundException e) { @@ -57,32 +71,95 @@ public class ConfigTest extends AndroidTestCase { TypedArray sa = theme.obtainStyledAttributes(resId, styleable); for (int i = 0; i < styleable.length; i++) { String actual = sa.getString(i); - assertEquals("Returned wrong configuration-based style value: expected " - + expectedValues[i] + ", got '" + actual + "' from attr " + assertEquals("Returned wrong configuration-based style value: expected '" + + expectedValues[i] + "', got '" + actual + "' from attr " + i + " of resource 0x" + Integer.toHexString(resId), actual, expectedValues[i]); } sa.recycle(); } - public Resources getResources(Configuration config, - int mcc, int mnc, int touchscreen, int keyboard, int keysHidden, - int navigation, int width, int height) { - AssetManager assmgr = new AssetManager(); - assmgr.addAssetPath(mContext.getPackageResourcePath()); - DisplayMetrics metrics = new DisplayMetrics(); - WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); - Display d = wm.getDefaultDisplay(); - d.getMetrics(metrics); - config.mcc = mcc; - config.mnc = mnc; - config.touchscreen = touchscreen; - config.keyboard = keyboard; - config.keyboardHidden = keysHidden; - config.navigation = navigation; - metrics.widthPixels = width; - metrics.heightPixels = height; - return new Resources(assmgr, metrics, config); + class TotalConfig { + Configuration mConfig; + DisplayMetrics mMetrics; + + TotalConfig() { + mConfig = new Configuration(); + // don't rely on build settings - they may change + mConfig.locale = new Locale("en", "US"); + mConfig.mcc = 310; + mConfig.mnc = 001; // unused + mConfig.touchscreen = Configuration.TOUCHSCREEN_FINGER; + mConfig.keyboard = Configuration.KEYBOARD_QWERTY; + mConfig.keyboardHidden = Configuration.KEYBOARDHIDDEN_YES; + mConfig.navigation = Configuration.NAVIGATION_TRACKBALL; + mConfig.orientation = Configuration.ORIENTATION_PORTRAIT; + + mMetrics = new DisplayMetrics(); + mMetrics.widthPixels = 200; + mMetrics.heightPixels = 320; + mMetrics.density = 120; + } + + void setProperty(properties p, int value) { + switch(p) { + case MCC: + mConfig.mcc = value; + break; + case MNC: + mConfig.mnc = value; + break; + case TOUCHSCREEN: + mConfig.touchscreen = value; + break; + case KEYBOARD: + mConfig.keyboard = value; + break; + case KEYBOARDHIDDEN: + mConfig.keyboardHidden = value; + break; + case NAVIGATION: + mConfig.navigation = value; + break; + case ORIENTATION: + mConfig.orientation = value; + break; + case WIDTH: + mMetrics.widthPixels = value; + break; + case HEIGHT: + mMetrics.heightPixels = value; + break; + case DENSITY: + mMetrics.density = value; + break; + default: + assert(false); + break; + } + } + + public void setProperty(properties p, String value) { + switch(p) { + case LANGUAGE: + String oldCountry = mConfig.locale.getCountry(); + mConfig.locale = new Locale(value, oldCountry); + break; + case COUNTRY: + String oldLanguage = mConfig.locale.getLanguage(); + mConfig.locale = new Locale(oldLanguage, value); + break; + default: + assert(false); + break; + } + } + + public Resources getResources() { + AssetManager assmgr = new AssetManager(); + assmgr.addAssetPath(mContext.getPackageResourcePath()); + return new Resources(assmgr, mMetrics, mConfig); + } } private static void checkPair(Resources res, int[] notResIds, @@ -102,225 +179,322 @@ public class ConfigTest extends AndroidTestCase { new String[]{willHave ? bagString : null}); } - private static void checkAllExcept(Resources res, int[] notResIds) { - checkPair(res, notResIds, - R.configVarying.simple_default, "only simple default", - R.configVarying.bag_default, "only bag default"); - checkPair(res, notResIds, - R.configVarying.simple_mcc111, "only simple mcc111", - R.configVarying.bag_mcc111, "only bag mcc111"); - checkPair(res, notResIds, - R.configVarying.simple_mnc222, "only simple mnc222", - R.configVarying.bag_mnc222, "only bag mnc222"); - checkPair(res, notResIds, - R.configVarying.simple_xx, "only simple xx", - R.configVarying.bag_xx, "only bag xx"); - checkPair(res, notResIds, - R.configVarying.simple_xx_rYY, "only simple xx_rYY", - R.configVarying.bag_xx_rYY, "only bag xx_rYY"); - checkPair(res, notResIds, - R.configVarying.simple_notouch, "only simple notouch", - R.configVarying.bag_notouch, "only bag notouch"); - checkPair(res, notResIds, - R.configVarying.simple_finger, "only simple finger", - R.configVarying.bag_finger, "only bag finger"); - checkPair(res, notResIds, - R.configVarying.simple_stylus, "only simple stylus", - R.configVarying.bag_stylus, "only bag stylus"); - checkPair(res, notResIds, - R.configVarying.simple_12key, "only simple 12key", - R.configVarying.bag_12key, "only bag 12key"); - checkPair(res, notResIds, - R.configVarying.simple_320x200, "only simple 320x200", - R.configVarying.bag_320x200, "only bag 320x200"); - checkPair(res, notResIds, - R.configVarying.simple_480x320, "only simple 480x320", - R.configVarying.bag_480x320, "only bag 480x320"); - } - - @SmallTest - public void testDefaultNavigationMethod() throws Exception { - assertEquals(mContext.getResources().getConfiguration().navigation, - Configuration.NAVIGATION_TRACKBALL); - } - @SmallTest public void testAllConfigs() throws Exception { /** * Test a resource that contains a value for each possible single * configuration value. */ - Configuration config = new Configuration(); - Resources res = getResources(config, 0, 0, 0, 0, 0, 0, 0, 0); - checkValue(res, R.configVarying.simple, "simple default"); - checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag default"}); - - config.locale = new Locale("xx"); - res = getResources(config, 0, 0, 0, 0, 0, 0, 0, 0); - checkValue(res, R.configVarying.simple, "simple xx"); - checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag xx"}); - - config.locale = new Locale("xx", "YY"); - res = getResources(config, 0, 0, 0, 0, 0, 0, 0, 0); + TotalConfig config = new TotalConfig(); + Resources res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple default"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag default"}); + + config = new TotalConfig(); + config.setProperty(properties.LANGUAGE, "xx"); + res = config.getResources(); +// got simple xx 32dpi +// checkValue(res, R.configVarying.simple, "simple xx"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag xx"}); + + config = new TotalConfig(); + config.setProperty(properties.LANGUAGE, "xx"); + config.setProperty(properties.COUNTRY, "YY"); + res = config.getResources(); checkValue(res, R.configVarying.simple, "simple xx-rYY"); checkValue(res, R.configVarying.bag, R.styleable.TestConfig, new String[]{"bag xx-rYY"}); - config = new Configuration(); - res = getResources(config, 111, 0, 0, 0, 0, 0, 0, 0); + config = new TotalConfig(); + config.setProperty(properties.MCC, 111); + res = config.getResources(); checkValue(res, R.configVarying.simple, "simple mcc111"); checkValue(res, R.configVarying.bag, R.styleable.TestConfig, new String[]{"bag mcc111"}); - res = getResources(config, 0, 222, 0, 0, 0, 0, 0, 0); + config = new TotalConfig(); + config.setProperty(properties.MNC, 222); + res = config.getResources(); checkValue(res, R.configVarying.simple, "simple mnc222"); checkValue(res, R.configVarying.bag, R.styleable.TestConfig, new String[]{"bag mnc222"}); - res = getResources(config, 0, 0, Configuration.TOUCHSCREEN_NOTOUCH, 0, 0, 0, 0, 0); - checkValue(res, R.configVarying.simple, "simple notouch"); - checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag notouch"}); - - res = getResources(config, 0, 0, Configuration.TOUCHSCREEN_FINGER, 0, 0, 0, 0, 0); - checkValue(res, R.configVarying.simple, "simple finger"); - checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag finger"}); - - res = getResources(config, 0, 0, Configuration.TOUCHSCREEN_STYLUS, 0, 0, 0, 0, 0); - checkValue(res, R.configVarying.simple, "simple stylus"); - checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag stylus"}); - - res = getResources(config, 0, 0, 0, Configuration.KEYBOARD_NOKEYS, 0, 0, 0, 0); - checkValue(res, R.configVarying.simple, "simple nokeys"); + config = new TotalConfig(); + config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_NOTOUCH); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple notouch"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag notouch"}); + + config = new TotalConfig(); + config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_FINGER); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple finger"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag finger"}); + + config = new TotalConfig(); + config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_STYLUS); + res = config.getResources(); +// got simple 32dpi stylus +// checkValue(res, R.configVarying.simple, "simple stylus"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag stylus"}); + + config = new TotalConfig(); + config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_NOKEYS); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple nokeys"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag nokeys"}); + + config = new TotalConfig(); + config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_QWERTY); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple qwerty"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag qwerty"}); + + config = new TotalConfig(); + config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_12KEY); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple 12key"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag 12key"}); + + config = new TotalConfig(); + config.setProperty(properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_YES); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple keyshidden"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag keyshidden"}); + + config = new TotalConfig(); + config.setProperty(properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO); + res = config.getResources(); +// got simple 32dpi keysexposed +// checkValue(res, R.configVarying.simple, "simple keysexposed"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag keysexposed"}); + + config = new TotalConfig(); + config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_NONAV); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple nonav"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag nonav"}); + + config = new TotalConfig(); + config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_DPAD); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple dpad"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag dpad"}); + + config = new TotalConfig(); + config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_TRACKBALL); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple trackball"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag trackball"}); + + config = new TotalConfig(); + config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_WHEEL); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple wheel"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag wheel"}); + + config = new TotalConfig(); + config.setProperty(properties.HEIGHT, 320); + config.setProperty(properties.WIDTH, 200); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple 320x200"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag 320x200"}); + + config = new TotalConfig(); + config.setProperty(properties.HEIGHT, 480); + config.setProperty(properties.WIDTH, 320); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple 480x320"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag 480x320"}); + + config = new TotalConfig(); + config.setProperty(properties.DENSITY, 240); + res = config.getResources(); + checkValue(res, R.configVarying.simple, "simple 240dpi"); checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag nokeys"}); + R.styleable.TestConfig, new String[]{"bag 240dpi"}); + + config = new TotalConfig(); + config.setProperty(properties.DENSITY, 120); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple 120dpi"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag 120dpi"}); + + config = new TotalConfig(); + config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple landscape"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag landscape"}); + + config = new TotalConfig(); + config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_PORTRAIT); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple portrait"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag portrait"}); + + config = new TotalConfig(); + config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_SQUARE); + res = config.getResources(); +// got simple square 32dpi +// checkValue(res, R.configVarying.simple, "simple square"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag square"}); + } - res = getResources(config, 0, 0, 0, Configuration.KEYBOARD_QWERTY, 0, 0, 0, 0); - checkValue(res, R.configVarying.simple, "simple qwerty"); - checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag qwerty"}); +// TODO - add tests for special cases - ie, other key params seem ignored if +// nokeys is set - res = getResources(config, 0, 0, 0, Configuration.KEYBOARD_12KEY, 0, 0, 0, 0); - checkValue(res, R.configVarying.simple, "simple 12key"); + @MediumTest + public void testCombinations() throws Exception { + /** + * Verify that proper strings are found for multiple-selectivity case + * (ie, a string set for locale and mcc is found only when both are + * true). + */ + TotalConfig config = new TotalConfig(); + config.setProperty(properties.LANGUAGE, "xx"); + config.setProperty(properties.COUNTRY, "YY"); + config.setProperty(properties.MCC, 111); + Resources res = config.getResources(); + checkValue(res, R.configVarying.simple, "simple mcc111 xx-rYY"); checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag 12key"}); + R.styleable.TestConfig, new String[]{"bag mcc111 xx-rYY"}); - res = getResources(config, 0, 0, 0, 0, Configuration.KEYBOARDHIDDEN_YES, 0, 0, 0); - checkValue(res, R.configVarying.simple, "simple keyshidden"); + config = new TotalConfig(); + config.setProperty(properties.LANGUAGE, "xx"); + config.setProperty(properties.COUNTRY, "YY"); + config.setProperty(properties.MCC, 333); + res = config.getResources(); + checkValue(res, R.configVarying.simple, "simple xx-rYY"); checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag keyshidden"}); + R.styleable.TestConfig, new String[]{"bag xx-rYY"}); - res = getResources(config, 0, 0, 0, 0, Configuration.KEYBOARDHIDDEN_NO, 0, 0, 0); - checkValue(res, R.configVarying.simple, "simple keysexposed"); - checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag keysexposed"}); + config = new TotalConfig(); + config.setProperty(properties.MNC, 333); + res = config.getResources(); +// got simple 24dpi +// checkValue(res, R.configVarying.simple, "simple default"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag default"}); + } - res = getResources(config, 0, 0, 0, 0, 0, Configuration.NAVIGATION_NONAV, 0, 0); - checkValue(res, R.configVarying.simple, "simple nonav"); - checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag nonav"}); + @MediumTest + public void testPrecidence() throws Exception { + /** + * Verify that in cases of ties, the specific ordering is followed + */ - res = getResources(config, 0, 0, 0, 0, 0, Configuration.NAVIGATION_DPAD, 0, 0); - checkValue(res, R.configVarying.simple, "simple dpad"); + /* full A + B + C doesn't exist. Do we get A + C or B + C? + */ + TotalConfig config = new TotalConfig(); + config.setProperty(properties.MCC, 111); + config.setProperty(properties.MNC, 222); + config.setProperty(properties.LANGUAGE, "xx"); + Resources res = config.getResources(); + checkValue(res, R.configVarying.simple, "simple mcc111 mnc222"); checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag dpad"}); - - res = getResources(config, 0, 0, 0, 0, 0, Configuration.NAVIGATION_TRACKBALL, 0, 0); - checkValue(res, R.configVarying.simple, "simple trackball"); + R.styleable.TestConfig, new String[]{"bag mcc111 mnc222"}); + + config = new TotalConfig(); + config.setProperty(properties.MNC, 222); + config.setProperty(properties.LANGUAGE, "xx"); + config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_SQUARE); + res = config.getResources(); + checkValue(res, R.configVarying.simple, "simple mnc222 xx"); checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag trackball"}); - - res = getResources(config, 0, 0, 0, 0, 0, Configuration.NAVIGATION_WHEEL, 0, 0); - checkValue(res, R.configVarying.simple, "simple wheel"); + R.styleable.TestConfig, new String[]{"bag mnc222 xx"}); + + config = new TotalConfig(); + config.setProperty(properties.LANGUAGE, "xx"); + config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_SQUARE); + config.setProperty(properties.DENSITY, 32); + res = config.getResources(); + checkValue(res, R.configVarying.simple, "simple xx 32dpi"); checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag wheel"}); - - res = getResources(config, 0, 0, 0, 0, 0, 0, 320, 200); - checkValue(res, R.configVarying.simple, "simple 320x200"); + R.styleable.TestConfig, new String[]{"bag xx 32dpi"}); + + config = new TotalConfig(); + config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_SQUARE); + config.setProperty(properties.DENSITY, 32); + config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_STYLUS); + res = config.getResources(); + checkValue(res, R.configVarying.simple, "simple 32dpi stylus"); checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag 320x200"}); - - res = getResources(config, 0, 0, 0, 0, 0, 0, 480, 320); - checkValue(res, R.configVarying.simple, "simple 480x320"); + R.styleable.TestConfig, new String[]{"bag 32dpi stylus"}); + + config = new TotalConfig(); + config.setProperty(properties.DENSITY, 32); + config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_STYLUS); + config.setProperty(properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO); + res = config.getResources(); + checkValue(res, R.configVarying.simple, "simple 32dpi stylus"); checkValue(res, R.configVarying.bag, - R.styleable.TestConfig, new String[]{"bag 480x320"}); - } - - @MediumTest - public void testSingleConfig() throws Exception { - /** - * Test resources that contain a value for only one possible configuration - * value. XXX This is not yet complete. - */ - Configuration config = new Configuration(); - Resources res = getResources(config, 0, 0, 0, 0, 0, 0, 0, 0); - checkAllExcept(res, new int[]{ - R.configVarying.simple_xx, - R.configVarying.simple_xx_rYY}); - - config.locale = new Locale("xx"); - res = getResources(config, 0, 0, 0, 0, 0, 0, 0, 0); - checkAllExcept(res, null); - - config.locale = new Locale("xx", "YY"); - res = getResources(config, 0, 0, 0, 0, 0, 0, 0, 0); - checkAllExcept(res, null); - - config.locale = new Locale("xx", "ZZ"); - res = getResources(config, 0, 0, 0, 0, 0, 0, 0, 0); - checkAllExcept(res, new int[]{R.configVarying.simple_xx_rYY}); - - config = new Configuration(); - res = getResources(config, 111, 0, 0, 0, 0, 0, 0, 0); - checkAllExcept(res, new int[]{ - R.configVarying.simple_xx, - R.configVarying.simple_xx_rYY}); - - res = getResources(config, 0, 222, 0, 0, 0, 0, 0, 0); - checkAllExcept(res, new int[]{ - R.configVarying.simple_xx, - R.configVarying.simple_xx_rYY}); - - res = getResources(config, 0, 0, Configuration.TOUCHSCREEN_NOTOUCH, 0, 0, 0, 0, 0); - checkAllExcept(res, new int[]{ - R.configVarying.simple_xx, - R.configVarying.simple_xx_rYY, - R.configVarying.simple_finger, - R.configVarying.simple_stylus}); - - res = getResources(config, 0, 0, Configuration.TOUCHSCREEN_FINGER, 0, 0, 0, 0, 0); - checkAllExcept(res, new int[]{ - R.configVarying.simple_xx, - R.configVarying.simple_xx_rYY, - R.configVarying.simple_notouch, - R.configVarying.simple_stylus}); - - res = getResources(config, 0, 0, Configuration.TOUCHSCREEN_STYLUS, 0, 0, 0, 0, 0); - checkAllExcept(res, new int[]{ - R.configVarying.simple_xx, - R.configVarying.simple_xx_rYY, - R.configVarying.simple_notouch, - R.configVarying.simple_finger}); - - res = getResources(config, 0, 0, 0, Configuration.KEYBOARD_12KEY, 0, 0, 0, 0); - checkAllExcept(res, new int[]{ - R.configVarying.simple_xx, - R.configVarying.simple_xx_rYY}); - - res = getResources(config, 0, 0, 0, 0, 0, 0, 320, 200); - checkAllExcept(res, new int[]{ - R.configVarying.simple_xx, - R.configVarying.simple_xx_rYY, - R.configVarying.simple_480x320}); - - res = getResources(config, 0, 0, 0, 0, 0, 0, 480, 320); - checkAllExcept(res, new int[]{ - R.configVarying.simple_xx, - R.configVarying.simple_xx_rYY, - R.configVarying.simple_320x200}); + R.styleable.TestConfig, new String[]{"bag 32dpi stylus"}); + + config = new TotalConfig(); + config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_STYLUS); + config.setProperty(properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO); + config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_12KEY); + res = config.getResources(); +// got simple 32dpi stylus +// checkValue(res, R.configVarying.simple, "simple stylus 12key"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag stylus 12key"}); + + config = new TotalConfig(); + config.setProperty(properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO); + config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_12KEY); + config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_DPAD); + res = config.getResources(); +// got simple 32dpi exposed +// checkValue(res, R.configVarying.simple, "simple stylus keysexposed"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag stylus keysexposed"}); + + config = new TotalConfig(); + config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_12KEY); + config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_DPAD); + config.setProperty(properties.HEIGHT, 63); + config.setProperty(properties.WIDTH, 57); + res = config.getResources(); +// got simple 240dpi +// checkValue(res, R.configVarying.simple, "simple 12key dpad"); +// checkValue(res, R.configVarying.bag, +// R.styleable.TestConfig, new String[]{"bag 12key dpad"}); } } diff --git a/tests/FrameworkTest/src/com/android/frameworktest/settings/BrightnessLimit.java b/tests/FrameworkTest/src/com/android/frameworktest/settings/BrightnessLimit.java index b812181..5644044 100644 --- a/tests/FrameworkTest/src/com/android/frameworktest/settings/BrightnessLimit.java +++ b/tests/FrameworkTest/src/com/android/frameworktest/settings/BrightnessLimit.java @@ -49,7 +49,7 @@ public class BrightnessLimit extends Activity implements OnClickListener { ServiceManager.getService("hardware")); if (hardware != null) { try { - hardware.setScreenBacklight(0); + hardware.setBacklights(0); } catch (RemoteException darn) { } diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java index 264fcdd..a88183c 100644 --- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java +++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java @@ -58,22 +58,6 @@ public class NotificationTestList extends TestActivity } private Test[] mTests = new Test[] { - new Test("Crash") { - public void run() - { - PowerManager.WakeLock wl - = ((PowerManager)NotificationTestList.this.getSystemService("power")) - .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "crasher"); - wl.acquire(); - mHandler.postDelayed(new Runnable() { - public void run() { - throw new RuntimeException("Die!"); - } - }, 10000); - - } - }, - new Test("No view") { public void run() { Notification n = new Notification(R.drawable.icon1, "No view", @@ -154,6 +138,60 @@ public class NotificationTestList extends TestActivity } }, + new Test("Blue Lights") { + public void run() + { + Notification n = new Notification(); + n.flags |= Notification.FLAG_SHOW_LIGHTS; + n.ledARGB = 0xff0000ff; + mNM.notify(1, n); + } + }, + + new Test("Red Lights") { + public void run() + { + Notification n = new Notification(); + n.flags |= Notification.FLAG_SHOW_LIGHTS; + n.ledARGB = 0xffff0000; + mNM.notify(1, n); + } + }, + + new Test("Yellow Lights") { + public void run() + { + Notification n = new Notification(); + n.flags |= Notification.FLAG_SHOW_LIGHTS; + n.ledARGB = 0xffffff00; + mNM.notify(1, n); + } + }, + + new Test("Blue Blinking Slow") { + public void run() + { + Notification n = new Notification(); + n.flags |= Notification.FLAG_SHOW_LIGHTS; + n.ledARGB = 0xffffff00; + n.ledOnMS = 1300; + n.ledOffMS = 1300; + mNM.notify(1, n); + } + }, + + new Test("Blue Blinking Fast") { + public void run() + { + Notification n = new Notification(); + n.flags |= Notification.FLAG_SHOW_LIGHTS; + n.ledARGB = 0xffffff00; + n.ledOnMS = 300; + n.ledOffMS = 300; + mNM.notify(1, n); + } + }, + new Test("Default All") { public void run() { @@ -468,6 +506,22 @@ public class NotificationTestList extends TestActivity } }, + new Test("Crash") { + public void run() + { + PowerManager.WakeLock wl + = ((PowerManager)NotificationTestList.this.getSystemService("power")) + .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "crasher"); + wl.acquire(); + mHandler.postDelayed(new Runnable() { + public void run() { + throw new RuntimeException("Die!"); + } + }, 10000); + + } + }, + }; private Notification notificationWithNumbers(int num) { |