Expose smooth in synchronous mode

This commit is contained in:
Jacob Palecki 2024-07-13 21:19:39 -07:00
parent 7f7bc81284
commit 8162bf505c
2 changed files with 34 additions and 1 deletions

View file

@ -21,7 +21,7 @@ namespace grapher.Layouts
PowerCapLayout = new OptionLayout(false, string.Empty);
DecayRateLayout = new OptionLayout(false, string.Empty);
GammaLayout = new OptionLayout(true, Gamma);
SmoothLayout = new OptionLayout(false, string.Empty);
SmoothLayout = new OptionLayout(true, Smooth);
InputOffsetLayout = new OptionLayout(false, string.Empty);
LimitLayout = new OptionLayout(true, Motivity);
PowerClassicLayout = new OptionLayout(false, string.Empty);

View file

@ -38,6 +38,39 @@ namespace wrapper_tests
Assert.AreEqual(expectedOutput, output.Item1, expectedOutput * 0.0001);
}
}
[TestMethod]
public void GivenSpeeds_SynchronousAccelWithNonDefaultSmooth_YieldsCorrectSens()
{
double syncSpeed = 20;
double gamma = 0.5;
double motivity = 1.3;
double smooth = 1.0;
var profile = new Profile();
profile.outputDPI = 1000;
profile.argsX.mode = AccelMode.synchronous;
profile.argsX.gain = false;
profile.argsX.syncSpeed = syncSpeed;
profile.argsX.gamma = gamma;
profile.argsX.motivity = motivity;
profile.argsX.smooth = smooth;
var accel = new ManagedAccel(profile);
var accelSimulator = new SynchronousAccelSimulator(syncSpeed, motivity, gamma, smooth);
List<int> inputs = new List<int>()
{
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181,
};
foreach (int input in inputs)
{
Tuple<double, double> output = accel.Accelerate(input, 0, 1, 10);
double expectedOutput = input * accelSimulator.Accelerate(input / 10.0);
Assert.AreEqual(expectedOutput, output.Item1, expectedOutput * 0.0001);
}
}
}
/// <summary>