blob: e097b5a19912b557594210f436670cf704d0e43b [file] [log] [blame]
The Android Open Source Projectf8057102009-03-15 16:47:16 -07001/*
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 */
16package android.graphics.cts;
17
Phil Dubach3ba0b612009-06-17 13:38:57 -070018import junit.framework.TestCase;
The Android Open Source Projectf8057102009-03-15 16:47:16 -070019import android.graphics.Bitmap;
20import android.graphics.Bitmap.Config;
The Android Open Source Projectf8057102009-03-15 16:47:16 -070021
Phil Dubach3ba0b612009-06-17 13:38:57 -070022public class Bitmap_ConfigTest extends TestCase {
The Android Open Source Projectf8057102009-03-15 16:47:16 -070023
The Android Open Source Projectf8057102009-03-15 16:47:16 -070024 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 Projectf8057102009-03-15 16:47:16 -070031 public void testValues(){
32 Config[] config = Config.values();
33
Wally Yau5e689a82015-10-08 11:57:30 -070034 assertTrue(config.length >= 4);
The Android Open Source Projectf8057102009-03-15 16:47:16 -070035 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}