Methods Summary |
---|
private static void | assumeTrue(java.lang.String message, boolean cond)
assertTrue("(assume)"+message, cond);
|
private void | getVirtualizer(int session)
if (mVirtualizer == null || session != mSession) {
if (session != mSession && mVirtualizer != null) {
mVirtualizer.release();
mVirtualizer = null;
}
try {
mVirtualizer = new Virtualizer(0, session);
mSession = session;
} catch (IllegalArgumentException e) {
Log.e(TAG, "getVirtualizer() Virtualizer not found exception: "+e);
} catch (UnsupportedOperationException e) {
Log.e(TAG, "getVirtualizer() Effect library not loaded exception: "+e);
}
}
assertNotNull("could not create mVirtualizer", mVirtualizer);
|
private void | log(java.lang.String testName, java.lang.String message)
Log.v(TAG, "["+testName+"] "+message);
|
private void | loge(java.lang.String testName, java.lang.String message)
Log.e(TAG, "["+testName+"] "+message);
|
private void | releaseVirtualizer()
if (mVirtualizer != null) {
mVirtualizer.release();
mVirtualizer = null;
}
|
protected void | setUp()
super.setUp();
|
protected void | tearDown()
super.tearDown();
releaseVirtualizer();
|
public void | test0_0ConstructorAndRelease()
boolean result = false;
String msg = "test1_0ConstructorAndRelease()";
Virtualizer virtualizer = null;
try {
virtualizer = new Virtualizer(0, 0);
assertNotNull(msg + ": could not create Virtualizer", virtualizer);
try {
assertTrue(msg +": invalid effect ID", (virtualizer.getId() != 0));
} catch (IllegalStateException e) {
msg = msg.concat(": Virtualizer not initialized");
}
result = true;
} catch (IllegalArgumentException e) {
msg = msg.concat(": Virtualizer not found");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": Effect library not loaded");
} finally {
if (virtualizer != null) {
virtualizer.release();
}
}
assertTrue(msg, result);
|
public void | test1_0Strength()
boolean result = false;
String msg = "test1_0Strength()";
getVirtualizer(0);
try {
if (mVirtualizer.getStrengthSupported()) {
mVirtualizer.setStrength((short)TEST_STRENGTH);
short strength = mVirtualizer.getRoundedStrength();
// allow 10% difference between set strength and rounded strength
assertTrue(msg +": got incorrect strength",
((float)strength > (float)TEST_STRENGTH * 0.9f) &&
((float)strength < (float)TEST_STRENGTH * 1.1f));
} else {
short strength = mVirtualizer.getRoundedStrength();
assertTrue(msg +": got incorrect strength", strength >= 0 && strength <= 1000);
}
result = true;
} catch (IllegalArgumentException e) {
msg = msg.concat(": Bad parameter value");
loge(msg, "Bad parameter value");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": get parameter() rejected");
loge(msg, "get parameter() rejected");
} catch (IllegalStateException e) {
msg = msg.concat("get parameter() called in wrong state");
loge(msg, "get parameter() called in wrong state");
} finally {
releaseVirtualizer();
}
assertTrue(msg, result);
|
public void | test1_1Properties()
boolean result = false;
String msg = "test1_1Properties()";
getVirtualizer(0);
try {
Virtualizer.Settings settings = mVirtualizer.getProperties();
String str = settings.toString();
settings = new Virtualizer.Settings(str);
mVirtualizer.setProperties(settings);
result = true;
} catch (IllegalArgumentException e) {
msg = msg.concat(": Bad parameter value");
loge(msg, "Bad parameter value");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": get parameter() rejected");
loge(msg, "get parameter() rejected");
} catch (IllegalStateException e) {
msg = msg.concat("get parameter() called in wrong state");
loge(msg, "get parameter() called in wrong state");
} finally {
releaseVirtualizer();
}
assertTrue(msg, result);
|