• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.NotificationIconGenerator.NotificationOptions;
20 
21 import java.io.IOException;
22 
23 @SuppressWarnings("javadoc")
24 public class NotificationIconGeneratorTest extends GeneratorTest {
checkGraphic(String baseName, GraphicGenerator.Shape shape, int minSdk, String folderName, int expectedCount)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 
checkGraphic(String baseName, GraphicGenerator.Shape shape)36     private void checkGraphic(String baseName, GraphicGenerator.Shape shape) throws IOException {
37         checkGraphic(baseName, shape, 1, "notification", 12);
38     }
39 
testNotification1()40     public void testNotification1() throws Exception {
41         checkGraphic("ic_stat_circle", GraphicGenerator.Shape.CIRCLE);
42     }
43 
testNotification2()44     public void testNotification2() throws Exception {
45         checkGraphic("ic_stat_square", GraphicGenerator.Shape.SQUARE);
46     }
47 
testNotification3()48     public void testNotification3() throws Exception {
49         checkGraphic("ic_stat_circle", GraphicGenerator.Shape.CIRCLE, 9 /* minSdk*/,
50                 "notification-v9+", 8 /*fileCount*/);
51     }
52 
testNotification4()53     public void testNotification4() throws Exception {
54         checkGraphic("ic_stat_circle", GraphicGenerator.Shape.CIRCLE, 11, "notification-v11+", 4);
55     }
56 }
57