Home | History | Annotate | Download | only in assetstudiolib
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
      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 com.android.assetstudiolib;
     18 
     19 import com.android.assetstudiolib.LauncherIconGenerator.LauncherOptions;
     20 
     21 import java.io.IOException;
     22 
     23 @SuppressWarnings("javadoc")
     24 public class LauncherIconGeneratorTest extends GeneratorTest {
     25     private void checkGraphic(String baseName,
     26             GraphicGenerator.Shape shape, GraphicGenerator.Style style,
     27             boolean crop, int background, boolean isWebGraphic) throws IOException {
     28         LauncherOptions options = new LauncherOptions();
     29         options.shape = shape;
     30         options.crop = crop;
     31         options.style = style;
     32         options.backgroundColor = background;
     33         options.isWebGraphic = isWebGraphic;
     34 
     35         LauncherIconGenerator generator = new LauncherIconGenerator();
     36         checkGraphic(4 + (isWebGraphic ? 1 : 0), "launcher", baseName, generator, options);
     37     }
     38 
     39     public void testLauncher_fancyCircle() throws Exception {
     40         checkGraphic("red_fancy_circle", GraphicGenerator.Shape.CIRCLE,
     41                 GraphicGenerator.Style.FANCY, true, 0xFF0000, true);
     42     }
     43 
     44     public void testLauncher_glossySquare() throws Exception {
     45         checkGraphic("blue_glossy_square", GraphicGenerator.Shape.SQUARE,
     46                 GraphicGenerator.Style.GLOSSY, true, 0x0040FF, true);
     47     }
     48 }
     49