2 * Copyright (C) 2007 The Android Open Source Project
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
8 * http://www.eclipse.org/org/documents/epl-v10.php
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.
17 package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
19 import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
20 import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
21 import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier.Density;
23 import junit.framework.TestCase;
25 public class PixelDensityQualifierTest extends TestCase {
27 private PixelDensityQualifier pdq;
28 private FolderConfiguration config;
31 protected void setUp() throws Exception {
33 pdq = new PixelDensityQualifier();
34 config = new FolderConfiguration();
38 protected void tearDown() throws Exception {
44 public void testCheckAndSet() {
45 assertEquals(true, pdq.checkAndSet("ldpi", config));//$NON-NLS-1$
46 assertTrue(config.getPixelDensityQualifier() != null);
47 assertEquals(Density.LOW, config.getPixelDensityQualifier().getValue());
48 assertEquals("ldpi", config.getPixelDensityQualifier().toString()); //$NON-NLS-1$
51 public void testFailures() {
52 assertEquals(false, pdq.checkAndSet("", config));//$NON-NLS-1$
53 assertEquals(false, pdq.checkAndSet("dpi", config));//$NON-NLS-1$
54 assertEquals(false, pdq.checkAndSet("123dpi", config));//$NON-NLS-1$
55 assertEquals(false, pdq.checkAndSet("123", config));//$NON-NLS-1$
56 assertEquals(false, pdq.checkAndSet("sdfdpi", config));//$NON-NLS-1$