Fix ResourceQualifier tests.

Change-Id: Ib6109c1bb76dadddeef24aec3af16e178a931651
This commit is contained in:
Xavier Ducrohet
2009-09-28 12:16:16 -07:00
parent 3a68366197
commit e6ca35d4b0
2 changed files with 31 additions and 12 deletions

View File

@@ -18,6 +18,7 @@ package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration; import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier; import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier.Density;
import junit.framework.TestCase; import junit.framework.TestCase;
@@ -41,16 +42,16 @@ public class PixelDensityQualifierTest extends TestCase {
} }
public void testCheckAndSet() { public void testCheckAndSet() {
assertEquals(true, pdq.checkAndSet("123dpi", config));//$NON-NLS-1$ assertEquals(true, pdq.checkAndSet("ldpi", config));//$NON-NLS-1$
assertTrue(config.getPixelDensityQualifier() != null); assertTrue(config.getPixelDensityQualifier() != null);
assertEquals(123, config.getPixelDensityQualifier().getValue()); assertEquals(Density.LOW, config.getPixelDensityQualifier().getValue());
assertEquals("123dpi", config.getPixelDensityQualifier().toString()); //$NON-NLS-1$ assertEquals("ldpi", config.getPixelDensityQualifier().toString()); //$NON-NLS-1$
} }
public void testFailures() { public void testFailures() {
assertEquals(false, pdq.checkAndSet("", config));//$NON-NLS-1$ assertEquals(false, pdq.checkAndSet("", config));//$NON-NLS-1$
assertEquals(false, pdq.checkAndSet("dpi", config));//$NON-NLS-1$ assertEquals(false, pdq.checkAndSet("dpi", config));//$NON-NLS-1$
assertEquals(false, pdq.checkAndSet("123DPI", config));//$NON-NLS-1$ assertEquals(false, pdq.checkAndSet("123dpi", config));//$NON-NLS-1$
assertEquals(false, pdq.checkAndSet("123", config));//$NON-NLS-1$ assertEquals(false, pdq.checkAndSet("123", config));//$NON-NLS-1$
assertEquals(false, pdq.checkAndSet("sdfdpi", config));//$NON-NLS-1$ assertEquals(false, pdq.checkAndSet("sdfdpi", config));//$NON-NLS-1$
} }

View File

@@ -88,13 +88,16 @@ public class ConfigMatchTest extends TestCase {
null, // network code null, // network code
null, // language null, // language
null, // region null, // region
null, // screen size
null, // screen ratio
null, // screen orientation null, // screen orientation
null, // dpi null, // dpi
null, // touch mode null, // touch mode
null, // keyboard state null, // keyboard state
null, // text input null, // text input
null, // navigation null, // navigation
null); // screen size null, // screen dimension
null);// version
addFolder(mResources, defaultConfig, validMemberList); addFolder(mResources, defaultConfig, validMemberList);
@@ -103,13 +106,16 @@ public class ConfigMatchTest extends TestCase {
null, // network code null, // network code
"en", // language "en", // language
null, // region null, // region
null, // screen size
null, // screen ratio
null, // screen orientation null, // screen orientation
null, // dpi null, // dpi
null, // touch mode null, // touch mode
KeyboardState.EXPOSED.getValue(), // keyboard state KeyboardState.EXPOSED.getValue(), // keyboard state
null, // text input null, // text input
null, // navigation null, // navigation
null); // screen size null, // screen dimension
null);// version
addFolder(mResources, config1, validMemberList); addFolder(mResources, config1, validMemberList);
@@ -118,13 +124,16 @@ public class ConfigMatchTest extends TestCase {
null, // network code null, // network code
"en", // language "en", // language
null, // region null, // region
null, // screen size
null, // screen ratio
null, // screen orientation null, // screen orientation
null, // dpi null, // dpi
null, // touch mode null, // touch mode
KeyboardState.HIDDEN.getValue(), // keyboard state KeyboardState.HIDDEN.getValue(), // keyboard state
null, // text input null, // text input
null, // navigation null, // navigation
null); // screen size null, // screen dimension
null);// version
addFolder(mResources, config2, validMemberList); addFolder(mResources, config2, validMemberList);
@@ -133,13 +142,16 @@ public class ConfigMatchTest extends TestCase {
null, // network code null, // network code
"en", // language "en", // language
null, // region null, // region
null, // screen size
null, // screen ratio
ScreenOrientation.LANDSCAPE.getValue(), // screen orientation ScreenOrientation.LANDSCAPE.getValue(), // screen orientation
null, // dpi null, // dpi
null, // touch mode null, // touch mode
null, // keyboard state null, // keyboard state
null, // text input null, // text input
null, // navigation null, // navigation
null); // screen size null, // screen dimension
null);// version
addFolder(mResources, config3, validMemberList); addFolder(mResources, config3, validMemberList);
@@ -148,13 +160,16 @@ public class ConfigMatchTest extends TestCase {
"mnc435", // network code "mnc435", // network code
"en", // language "en", // language
"rUS", // region "rUS", // region
"normal", // screen size
"notlong", // screen ratio
ScreenOrientation.LANDSCAPE.getValue(), // screen orientation ScreenOrientation.LANDSCAPE.getValue(), // screen orientation
"160dpi", // dpi "mdpi", // dpi
TouchScreenType.FINGER.getValue(), // touch mode TouchScreenType.FINGER.getValue(), // touch mode
KeyboardState.EXPOSED.getValue(), // keyboard state KeyboardState.EXPOSED.getValue(), // keyboard state
TextInputMethod.QWERTY.getValue(), // text input TextInputMethod.QWERTY.getValue(), // text input
NavigationMethod.DPAD.getValue(), // navigation NavigationMethod.DPAD.getValue(), // navigation
"480x320"); // screen size "480x320", // screen dimension
"v3"); // version
addFolder(mResources, config4, invalidMemberList); addFolder(mResources, config4, invalidMemberList);
} }
@@ -171,13 +186,16 @@ public class ConfigMatchTest extends TestCase {
"mnc435", // network code "mnc435", // network code
"en", // language "en", // language
"rUS", // region "rUS", // region
"normal", // screen size
"notlong", // screen ratio
ScreenOrientation.LANDSCAPE.getValue(), // screen orientation ScreenOrientation.LANDSCAPE.getValue(), // screen orientation
"160dpi", // dpi "mdpi", // dpi
TouchScreenType.FINGER.getValue(), // touch mode TouchScreenType.FINGER.getValue(), // touch mode
KeyboardState.EXPOSED.getValue(), // keyboard state KeyboardState.EXPOSED.getValue(), // keyboard state
TextInputMethod.QWERTY.getValue(), // text input TextInputMethod.QWERTY.getValue(), // text input
NavigationMethod.DPAD.getValue(), // navigation NavigationMethod.DPAD.getValue(), // navigation
"480x320"); // screen size "480x320", // screen dimension
"v3"); // version
ResourceFile result = mResources.getMatchingFile(SEARCHED_FILENAME, ResourceFile result = mResources.getMatchingFile(SEARCHED_FILENAME,
ResourceFolderType.LAYOUT, testConfig); ResourceFolderType.LAYOUT, testConfig);