/*
 * Copyright (C) 2017 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.
 */

package android.support.v4.graphics;

import static org.junit.Assert.assertEquals;

import android.graphics.Paint;
import android.support.test.filters.SmallTest;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.Arrays;
import java.util.Collection;

@RunWith(Parameterized.class)
@SmallTest
public class PaintCompatHasGlyphTest {

    @Parameterized.Parameters
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][]{
                {"B", true},
                {"\uDB3F\uDFFD", false},
                {"☺", true},
                {"Hello", false},
                {"\u0020", true},  // white space
                {"\t\t\t", false},  // more white space
        });
    }

    private final String mTestString;
    private final boolean mExpectedResult;

    public PaintCompatHasGlyphTest(String testString, boolean expectedResult) {
        mTestString = testString;
        mExpectedResult = expectedResult;
    }

    @Test
    public void testHasGlyph() {
        assertEquals(mExpectedResult, PaintCompat.hasGlyph(new Paint(), mTestString));
    }
}

@@ -648,24 +648,73 @@
 .graphics;%0A%0A
+import static android.os.Build.VERSION.SDK_INT;%0A%0A
 import stati
@@ -746,16 +746,16 @@
 Equals;%0A
-
 %0Aimport 
@@ -1274,9 +1274,67 @@
   %7B%22
-%E2%98%BA
+%C5%8C%22, true%7D,%0A                %7B%22%C2%A3%22, true%7D,%0A                %7B%22%E2%85%93
 %22, t
@@ -1471,32 +1471,181 @@
 ore white space%0A
+                %7B%22%E2%98%BA%22, SDK_INT %3E= 16%7D, // glyph added in API 16%0A                %7B%22%5CuD83D%5CuDC66%5CuD83C%5CuDFFF%22, SDK_INT %3E= 24%7D, // glyph added in API 24%0A
         %7D);%0A    
@@ -1947,37 +1947,32 @@
     
-assertEquals(mExpectedResult,
+final boolean hasGlyph =
  Pai
@@ -2014,16 +2014,146 @@
 tString)
+;%0A        assertEquals(%22hasGlyph() returned %22 + hasGlyph + %22 for '%22 + mTestString + %22'%22,%0A                mExpectedResult, hasGlyph
 );%0A    %7D

Fix PaintCompatHasGlyphTest on API 15 am: 7b4fde9d7c