summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSean M. Pappalardo <pegasus@renegadetech.com>2015-12-10 08:44:46 -0800
committerSean M. Pappalardo <pegasus@renegadetech.com>2015-12-11 07:45:42 -0800
commit50a7ba15a1b1591d9139d793dc8b2295e9b48504 (patch)
tree8c129ca81e68d262ffc87c9feb299b8eb453b791 /src
parent0f21e54330fc3787028d6e2e9ff9858ed1a9da48 (diff)
Cherry-picked a third commit from st_fix plus ST tests from st_real_fix.
Diffstat (limited to 'src')
-rw-r--r--src/test/softtakeover_test.cpp233
1 files changed, 134 insertions, 99 deletions
diff --git a/src/test/softtakeover_test.cpp b/src/test/softtakeover_test.cpp
index b91900e44d..dd5a484ca4 100644
--- a/src/test/softtakeover_test.cpp
+++ b/src/test/softtakeover_test.cpp
@@ -15,7 +15,7 @@ class SoftTakeoverTest : public MixxxTest {
protected:
virtual void SetUp() {
Time::setTestMode(true);
- Time::setTestElapsedTime(0);
+ Time::setTestElapsedMsecs(10);
}
virtual void TearDown() {
@@ -23,7 +23,7 @@ class SoftTakeoverTest : public MixxxTest {
}
};
-TEST_F(SoftTakeoverTest, SoftTakeover_DoesntIgnoreDisabledControl) {
+TEST_F(SoftTakeoverTest, DoesntIgnoreDisabledControl) {
// Range -1.0 to 1.0
QScopedPointer<ControlPotmeter> co(new ControlPotmeter(
ConfigKey("[Channel1]", "test_pot"), -1.0, 1.0));
@@ -32,7 +32,7 @@ TEST_F(SoftTakeoverTest, SoftTakeover_DoesntIgnoreDisabledControl) {
EXPECT_FALSE(st_control.ignore(co.data(), co->get()));
}
-TEST_F(SoftTakeoverTest, SoftTakeover_DoesntIgnoreNonPotmeter) {
+TEST_F(SoftTakeoverTest, DoesntIgnoreNonPotmeter) {
QScopedPointer<ControlPushButton> co(new ControlPushButton(
ConfigKey("[Channel1]", "test_button")));
@@ -44,7 +44,7 @@ TEST_F(SoftTakeoverTest, SoftTakeover_DoesntIgnoreNonPotmeter) {
EXPECT_FALSE(st_control.ignore(co.data(), 0));
}
-TEST_F(SoftTakeoverTest, SoftTakeover_IgnoresFirstValue) {
+TEST_F(SoftTakeoverTest, IgnoresFirstValue) {
// Range -1.0 to 1.0
QScopedPointer<ControlPotmeter> co(new ControlPotmeter(
ConfigKey("[Channel1]", "test_pot"), -1.0, 1.0));
@@ -54,24 +54,59 @@ TEST_F(SoftTakeoverTest, SoftTakeover_IgnoresFirstValue) {
EXPECT_TRUE(st_control.ignore(co.data(), 5));
}
+TEST_F(SoftTakeoverTest, DoesntIgnoreSameValue) {
+ // Range -1.0 to 1.0
+ QScopedPointer<ControlPotmeter> co(new ControlPotmeter(
+ ConfigKey("[Channel1]", "test_pot"), -1.0, 1.0));
-// This behavior is undefined since it doesn't actually matter what happens
-// setting the same value since the result is the same.
-// E.g. in 1.11 it ignores it, in 2.0 it doesn't.
-
-// TEST_F(SoftTakeoverTest, SoftTakeover_DoesntIgnoreSameValue) {
-// // Range -1.0 to 1.0
-// QScopedPointer<ControlPotmeter> co(new ControlPotmeter(
-// ConfigKey("[Channel1]", "test_pot"), -1.0, 1.0));
-//
-// SoftTakeoverCtrl st_control;
-// st_control.enable(co.data());
-// // First is always ignored.
-// EXPECT_TRUE(st_control.ignore(co.data(), 0.6));
-// EXPECT_FALSE(st_control.ignore(co.data(), 0.6));
-// }
+ co->set(0.6);
+ SoftTakeoverCtrl st_control;
+ st_control.enable(co.data());
+ // First is always ignored.
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(0.6)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(0.6)));
+}
+// These are corner cases that allow for quickly flicking/whipping controls
+// from a standstill when the previous knob value matches the current CO value
+TEST_F(SoftTakeoverTest, SuperFastPrevEqCurrent) {
+ QScopedPointer<ControlPotmeter> co(new ControlPotmeter(
+ ConfigKey("[Channel1]", "test_pot"), -250, 250));
+
+ // From the bottom
+ co->set(-250);
+ SoftTakeoverCtrl st_control;
+ st_control.enable(co.data());
+
+ // First is always ignored.
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(-250)));
+ // This can happen any time afterwards, so we test 10 seconds
+ Time::setTestElapsedMsecs(10000);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(200)));
+
+ // From the top
+ co->set(250);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(250)));
+ // This can happen any time afterwards, so we test 10 seconds
+ Time::setTestElapsedMsecs(10000);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(-200)));
+}
+// But when they don't match, this type of thing should be ignored!
+TEST_F(SoftTakeoverTest, SuperFastNotSame) {
+ QScopedPointer<ControlPotmeter> co(new ControlPotmeter(
+ ConfigKey("[Channel1]", "test_pot"), -250, 250));
+
+ co->set(250);
+ SoftTakeoverCtrl st_control;
+ st_control.enable(co.data());
+
+ // First is always ignored.
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(249)));
+ // This can happen any time afterwards, so we test 10 seconds
+ Time::setTestElapsedMsecs(10000);
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(-200)));
+}
/* The meat of the tests
* (See decscription in SoftTakeover::ignore() )
@@ -96,8 +131,8 @@ TEST_F(SoftTakeoverTest, PrevNearLess_NewNearLess_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 40));
- EXPECT_FALSE(st_control.ignore(co.data(), 45));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(40)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(45)));
}
TEST_F(SoftTakeoverTest, PrevNearLess_NewNearMore_Soon) {
@@ -109,8 +144,8 @@ TEST_F(SoftTakeoverTest, PrevNearLess_NewNearMore_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 40));
- EXPECT_FALSE(st_control.ignore(co.data(), 60));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(40)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(60)));
}
TEST_F(SoftTakeoverTest, PrevNearLess_NewFarLess_Soon) {
@@ -122,8 +157,8 @@ TEST_F(SoftTakeoverTest, PrevNearLess_NewFarLess_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 40));
- EXPECT_FALSE(st_control.ignore(co.data(), 1));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(40)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(1)));
}
TEST_F(SoftTakeoverTest, PrevNearLess_NewFarMore_Soon) {
@@ -135,8 +170,8 @@ TEST_F(SoftTakeoverTest, PrevNearLess_NewFarMore_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 40));
- EXPECT_FALSE(st_control.ignore(co.data(), 100));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(40)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(100)));
}
TEST_F(SoftTakeoverTest, PrevNearLess_NewNearLess_Late) {
@@ -148,9 +183,9 @@ TEST_F(SoftTakeoverTest, PrevNearLess_NewNearLess_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 40));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_FALSE(st_control.ignore(co.data(), 45));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(40)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(45)));
}
TEST_F(SoftTakeoverTest, PrevNearLess_NewNearMore_Late) {
@@ -162,9 +197,9 @@ TEST_F(SoftTakeoverTest, PrevNearLess_NewNearMore_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 40));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_FALSE(st_control.ignore(co.data(), 60));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(40)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(60)));
}
// Ignore this case:
@@ -179,9 +214,9 @@ TEST_F(SoftTakeoverTest, PrevNearLess_NewFarLess_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 40));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_TRUE(st_control.ignore(co.data(), 1));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(40)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(1)));
}
// Ignore this case:
@@ -196,9 +231,9 @@ TEST_F(SoftTakeoverTest, PrevNearLess_NewFarMore_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 40));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_TRUE(st_control.ignore(co.data(), 100));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(40)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(100)));
}
// ---- Previous Near & greater than current
@@ -212,8 +247,8 @@ TEST_F(SoftTakeoverTest, PrevNearMore_NewNearLess_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 55));
- EXPECT_FALSE(st_control.ignore(co.data(), 45));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(55)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(45)));
}
TEST_F(SoftTakeoverTest, PrevNearMore_NewNearMore_Soon) {
@@ -225,8 +260,8 @@ TEST_F(SoftTakeoverTest, PrevNearMore_NewNearMore_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 55));
- EXPECT_FALSE(st_control.ignore(co.data(), 60));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(55)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(60)));
}
TEST_F(SoftTakeoverTest, PrevNearMore_NewFarLess_Soon) {
@@ -238,8 +273,8 @@ TEST_F(SoftTakeoverTest, PrevNearMore_NewFarLess_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 55));
- EXPECT_FALSE(st_control.ignore(co.data(), 1));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(55)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(1)));
}
TEST_F(SoftTakeoverTest, PrevNearMore_NewFarMore_Soon) {
@@ -251,8 +286,8 @@ TEST_F(SoftTakeoverTest, PrevNearMore_NewFarMore_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 55));
- EXPECT_FALSE(st_control.ignore(co.data(), 100));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(55)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(100)));
}
TEST_F(SoftTakeoverTest, PrevNearMore_NewNearLess_Late) {
@@ -264,9 +299,9 @@ TEST_F(SoftTakeoverTest, PrevNearMore_NewNearLess_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 55));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_FALSE(st_control.ignore(co.data(), 45));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(55)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(45)));
}
TEST_F(SoftTakeoverTest, PrevNearMore_NewNearMore_Late) {
@@ -278,9 +313,9 @@ TEST_F(SoftTakeoverTest, PrevNearMore_NewNearMore_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 55));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_FALSE(st_control.ignore(co.data(), 60));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(55)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(60)));
}
// Ignore this case:
@@ -295,9 +330,9 @@ TEST_F(SoftTakeoverTest, PrevNearMore_NewFarLess_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 55));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_TRUE(st_control.ignore(co.data(), 1));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(55)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(1)));
}
// Ignore this case:
@@ -312,9 +347,9 @@ TEST_F(SoftTakeoverTest, PrevNearMore_NewFarMore_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 55));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_TRUE(st_control.ignore(co.data(), 100));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(55)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(100)));
}
// ---- Previous Far & less than current
@@ -328,8 +363,8 @@ TEST_F(SoftTakeoverTest, PrevFarLess_NewNearLess_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), -50));
- EXPECT_FALSE(st_control.ignore(co.data(), 45));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(-50)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(45)));
}
TEST_F(SoftTakeoverTest, PrevFarLess_NewNearMore_Soon) {
@@ -341,8 +376,8 @@ TEST_F(SoftTakeoverTest, PrevFarLess_NewNearMore_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), -50));
- EXPECT_FALSE(st_control.ignore(co.data(), 60));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(-50)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(60)));
}
// Ignore this case:
@@ -357,8 +392,8 @@ TEST_F(SoftTakeoverTest, PrevFarLess_NewFarLess_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), -50));
- EXPECT_TRUE(st_control.ignore(co.data(), 1));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(-50)));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(1)));
}
TEST_F(SoftTakeoverTest, PrevFarLess_NewFarMore_Soon) {
@@ -370,8 +405,8 @@ TEST_F(SoftTakeoverTest, PrevFarLess_NewFarMore_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), -50));
- EXPECT_FALSE(st_control.ignore(co.data(), 100));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(-50)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(100)));
}
TEST_F(SoftTakeoverTest, PrevFarLess_NewNearLess_Late) {
@@ -383,9 +418,9 @@ TEST_F(SoftTakeoverTest, PrevFarLess_NewNearLess_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), -50));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_FALSE(st_control.ignore(co.data(), 45));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(-50)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(45)));
}
TEST_F(SoftTakeoverTest, PrevFarLess_NewNearMore_Late) {
@@ -397,9 +432,9 @@ TEST_F(SoftTakeoverTest, PrevFarLess_NewNearMore_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), -50));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_FALSE(st_control.ignore(co.data(), 60));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(-50)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(60)));
}
// Ignore this case:
@@ -414,9 +449,9 @@ TEST_F(SoftTakeoverTest, PrevFarLess_NewFarLess_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), -50));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_TRUE(st_control.ignore(co.data(), 1));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(-50)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(1)));
}
// Ignore this case:
@@ -431,9 +466,9 @@ TEST_F(SoftTakeoverTest, PrevFarLess_NewFarMore_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), -50));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_TRUE(st_control.ignore(co.data(), 100));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(-50)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(100)));
}
// ---- Previous Far & greater than current
@@ -447,8 +482,8 @@ TEST_F(SoftTakeoverTest, PrevFarMore_NewNearLess_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 120));
- EXPECT_FALSE(st_control.ignore(co.data(), 45));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(120)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(45)));
}
TEST_F(SoftTakeoverTest, PrevFarMore_NewNearMore_Soon) {
@@ -460,8 +495,8 @@ TEST_F(SoftTakeoverTest, PrevFarMore_NewNearMore_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 120));
- EXPECT_FALSE(st_control.ignore(co.data(), 60));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(120)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(60)));
}
TEST_F(SoftTakeoverTest, PrevFarMore_NewFarLess_Soon) {
@@ -473,8 +508,8 @@ TEST_F(SoftTakeoverTest, PrevFarMore_NewFarLess_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 120));
- EXPECT_FALSE(st_control.ignore(co.data(), 1));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(120)));
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(1)));
}
// Ignore this case:
@@ -489,8 +524,8 @@ TEST_F(SoftTakeoverTest, PrevFarMore_NewFarMore_Soon) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 120));
- EXPECT_TRUE(st_control.ignore(co.data(), 100));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(120)));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(100)));
}
TEST_F(SoftTakeoverTest, PrevFarMore_NewNearLess_Late) {
@@ -502,9 +537,9 @@ TEST_F(SoftTakeoverTest, PrevFarMore_NewNearLess_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 120));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_FALSE(st_control.ignore(co.data(), 45));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(120)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(45)));
}
TEST_F(SoftTakeoverTest, PrevFarMore_NewNearMore_Late) {
@@ -516,9 +551,9 @@ TEST_F(SoftTakeoverTest, PrevFarMore_NewNearMore_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 120));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_FALSE(st_control.ignore(co.data(), 60));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(120)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_FALSE(st_control.ignore(co.data(), co->getParameterForValue(60)));
}
// Ignore this case:
@@ -533,9 +568,9 @@ TEST_F(SoftTakeoverTest, PrevFarMore_NewFarLess_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 120));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_TRUE(st_control.ignore(co.data(), 1));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(120)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(1)));
}
// Ignore this case:
@@ -550,9 +585,9 @@ TEST_F(SoftTakeoverTest, PrevFarMore_NewFarMore_Late) {
st_control.enable(co.data());
// First is always ignored.
- EXPECT_TRUE(st_control.ignore(co.data(), 120));
- Time::setTestElapsedTime(SoftTakeover::TestAccess::getTimeThreshold()*2);
- EXPECT_TRUE(st_control.ignore(co.data(), 100));
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(120)));
+ Time::setTestElapsedMsecs(SoftTakeover::TestAccess::getTimeThreshold() * 2);
+ EXPECT_TRUE(st_control.ignore(co.data(), co->getParameterForValue(100)));
}
// For the ignore cases, check that they work correctly with various signed values