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 17package com.android.assetstudiolib; 18 19import com.android.assetstudiolib.NotificationIconGenerator.NotificationOptions; 20 21import java.io.IOException; 22 23@SuppressWarnings("javadoc") 24public class NotificationIconGeneratorTest extends GeneratorTest { 25 private void checkGraphic(String baseName, 26 GraphicGenerator.Shape shape, int minSdk, String folderName, 27 int expectedCount) throws IOException { 28 NotificationOptions options = new NotificationOptions(); 29 options.shape = shape; 30 options.minSdk = minSdk; 31 32 NotificationIconGenerator generator = new NotificationIconGenerator(); 33 checkGraphic(expectedCount, folderName, baseName, generator, options); 34 } 35 36 private void checkGraphic(String baseName, GraphicGenerator.Shape shape) throws IOException { 37 checkGraphic(baseName, shape, 1, "notification", 12); 38 } 39 40 public void testNotification1() throws Exception { 41 checkGraphic("ic_stat_circle", GraphicGenerator.Shape.CIRCLE); 42 } 43 44 public void testNotification2() throws Exception { 45 checkGraphic("ic_stat_square", GraphicGenerator.Shape.SQUARE); 46 } 47 48 public void testNotification3() throws Exception { 49 checkGraphic("ic_stat_circle", GraphicGenerator.Shape.CIRCLE, 9 /* minSdk*/, 50 "notification-v9+", 8 /*fileCount*/); 51 } 52 53 public void testNotification4() throws Exception { 54 checkGraphic("ic_stat_circle", GraphicGenerator.Shape.CIRCLE, 11, "notification-v11+", 4); 55 } 56} 57