The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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 | package android.graphics.cts; |
| 17 | |
Phil Dubach | 3ba0b61 | 2009-06-17 13:38:57 -0700 | [diff] [blame] | 18 | import junit.framework.TestCase; |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 19 | import android.graphics.Bitmap; |
| 20 | import android.graphics.Bitmap.Config; |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 21 | |
Phil Dubach | 3ba0b61 | 2009-06-17 13:38:57 -0700 | [diff] [blame] | 22 | public class Bitmap_ConfigTest extends TestCase { |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 23 | |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 24 | public void testValueOf(){ |
| 25 | assertEquals(Config.ALPHA_8, Config.valueOf("ALPHA_8")); |
| 26 | assertEquals(Config.RGB_565, Config.valueOf("RGB_565")); |
| 27 | assertEquals(Config.ARGB_4444, Config.valueOf("ARGB_4444")); |
| 28 | assertEquals(Config.ARGB_8888, Config.valueOf("ARGB_8888")); |
| 29 | } |
| 30 | |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 31 | public void testValues(){ |
| 32 | Config[] config = Config.values(); |
| 33 | |
Wally Yau | 5e689a8 | 2015-10-08 11:57:30 -0700 | [diff] [blame] | 34 | assertTrue(config.length >= 4); |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 35 | assertEquals(Config.ALPHA_8, config[0]); |
| 36 | assertEquals(Config.RGB_565, config[1]); |
| 37 | assertEquals(Config.ARGB_4444, config[2]); |
| 38 | assertEquals(Config.ARGB_8888, config[3]); |
| 39 | |
| 40 | //Config is used as a argument here for all the methods that use it |
| 41 | assertNotNull(Bitmap.createBitmap(10, 24, Config.ALPHA_8)); |
| 42 | assertNotNull(Bitmap.createBitmap(10, 24, Config.ARGB_4444)); |
| 43 | assertNotNull(Bitmap.createBitmap(10, 24, Config.ARGB_8888)); |
| 44 | assertNotNull(Bitmap.createBitmap(10, 24, Config.RGB_565)); |
| 45 | } |
| 46 | } |