2 * Copyright (C) 2015 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package android
.databinding
.testapp
;
18 import android
.databinding
.testapp
.databinding
.AbsSpinnerAdapterTestBinding
;
19 import android
.databinding
.testapp
.vo
.AbsSpinnerBindingObject
;
21 import android
.os
.Build
;
22 import android
.widget
.Spinner
;
23 import android
.widget
.SpinnerAdapter
;
25 public class AbsSpinnerBindingAdapterTest
26 extends BindingAdapterTestBase
<AbsSpinnerAdapterTestBinding
, AbsSpinnerBindingObject
> {
30 public AbsSpinnerBindingAdapterTest() {
31 super(AbsSpinnerAdapterTestBinding
.class, AbsSpinnerBindingObject
.class,
32 R
.layout
.abs_spinner_adapter_test
);
36 protected void setUp() throws Exception
{
41 public void testEntries() throws Throwable
{
42 if (Build
.VERSION
.SDK_INT
>= Build
.VERSION_CODES
.LOLLIPOP
) {
51 private void validateEntries() {
52 assertEquals(mBindingObject
.getEntries().length
, mView
.getAdapter().getCount());
53 CharSequence
[] entries
= mBindingObject
.getEntries();
54 SpinnerAdapter adapter
= mView
.getAdapter();
55 for (int i
= 0; i
< entries
.length
; i
++) {
56 assertEquals(adapter
.getItem(i
), entries
[i
]);