Home | History | Annotate | Download | only in cts
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      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
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     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.
     15  */
     16 
     17 package android.text.style.cts;
     18 
     19 import android.app.PendingIntent;
     20 import android.content.Intent;
     21 import android.os.Parcel;
     22 import android.support.test.InstrumentationRegistry;
     23 import android.support.test.filters.SmallTest;
     24 import android.support.test.runner.AndroidJUnit4;
     25 import android.text.style.EasyEditSpan;
     26 
     27 import org.junit.Test;
     28 import org.junit.runner.RunWith;
     29 
     30 @SmallTest
     31 @RunWith(AndroidJUnit4.class)
     32 public class EasyEditSpanTest {
     33     @Test
     34     public void testConstructor() {
     35         new EasyEditSpan();
     36         new EasyEditSpan(PendingIntent.getActivity(
     37                 InstrumentationRegistry.getTargetContext(), 0, new Intent(), 0));
     38 
     39         Parcel p = Parcel.obtain();
     40         try {
     41             new EasyEditSpan(p);
     42         } finally {
     43             p.recycle();
     44         }
     45     }
     46 
     47     @Test
     48     public void testDescribeContents_doesNotThrowException() {
     49         EasyEditSpan easyEditSpan = new EasyEditSpan();
     50         easyEditSpan.describeContents();
     51     }
     52 
     53     @Test
     54     public void testGetSpanTypeId_doesNotThrowException() {
     55         EasyEditSpan easyEditSpan = new EasyEditSpan();
     56         easyEditSpan.getSpanTypeId();
     57     }
     58 
     59     @Test
     60     public void testWriteToParcel() {
     61         Parcel p = Parcel.obtain();
     62         try {
     63             EasyEditSpan easyEditSpan = new EasyEditSpan();
     64             easyEditSpan.writeToParcel(p, 0);
     65             p.setDataPosition(0);
     66             new EasyEditSpan(p);
     67         } finally {
     68             p.recycle();
     69         }
     70     }
     71 }
     72