Fix crash when saving the last keyframe in the edit gui (fixes #61)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.replaymod.core;
|
package com.replaymod.core;
|
||||||
|
|
||||||
import com.replaymod.core.regression.RegressionTest60;
|
import com.replaymod.core.regression.RegressionTest60;
|
||||||
|
import com.replaymod.core.regression.RegressionTest61;
|
||||||
import com.replaymod.core.regression.RegressionTest62;
|
import com.replaymod.core.regression.RegressionTest62;
|
||||||
import com.replaymod.extra.DownloadOpenEye;
|
import com.replaymod.extra.DownloadOpenEye;
|
||||||
import com.replaymod.online.SkipLogin;
|
import com.replaymod.online.SkipLogin;
|
||||||
@@ -45,6 +46,7 @@ public class ReplayModIntegrationTest {
|
|||||||
new LoadReplay(),
|
new LoadReplay(),
|
||||||
|
|
||||||
new RegressionTest60(),
|
new RegressionTest60(),
|
||||||
|
new RegressionTest61(),
|
||||||
new RegressionTest62(),
|
new RegressionTest62(),
|
||||||
|
|
||||||
// new AbstractTask() {}, // Uncomment to not exit on success (useful for writing more tests)
|
// new AbstractTask() {}, // Uncomment to not exit on success (useful for writing more tests)
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.replaymod.core.regression;
|
||||||
|
|
||||||
|
import com.replaymod.core.AbstractTask;
|
||||||
|
import com.replaymod.core.CompositeTask;
|
||||||
|
import com.replaymod.core.Task;
|
||||||
|
import com.replaymod.replay.overlay.OverlayGui;
|
||||||
|
import com.replaymod.simplepathing.GuiPathingTasks;
|
||||||
|
import com.replaymod.simplepathing.gui.GuiEditKeyframe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regression test: #61 NPE when saving in edit keyframe gui of last keyframe
|
||||||
|
*/
|
||||||
|
public class RegressionTest61 extends CompositeTask {
|
||||||
|
public RegressionTest61() {
|
||||||
|
super(new Task[]{
|
||||||
|
OverlayGui.whileOpened(
|
||||||
|
// Place keyframe
|
||||||
|
Task.click(130, 50),
|
||||||
|
new GuiPathingTasks.ClickPositionKeyframeButton(),
|
||||||
|
AbstractTask.create(task -> {
|
||||||
|
// Double click keyframe
|
||||||
|
task.click(130, 50);
|
||||||
|
task.click(130, 50);
|
||||||
|
task.expectGui(GuiEditKeyframe.Position.class, gui -> {
|
||||||
|
task.click(gui.saveButton);
|
||||||
|
task.expectPopupClosed(() -> task.future.set(null));
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
// Place second spectator keyframe
|
||||||
|
new GuiPathingTasks.ClickPositionKeyframeButton()
|
||||||
|
),
|
||||||
|
new GuiPathingTasks.ClearKeyframeTimeline(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -255,6 +255,10 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
|
|||||||
xField.getDouble(), yField.getDouble(), zField.getDouble(),
|
xField.getDouble(), yField.getDouble(), zField.getDouble(),
|
||||||
yawField.getFloat(), pitchField.getFloat(), rollField.getFloat()
|
yawField.getFloat(), pitchField.getFloat(), rollField.getFloat()
|
||||||
);
|
);
|
||||||
|
if (interpolationPanel.getSettingsPanel() == null) {
|
||||||
|
// The last keyframe doesn't have interpolator settings because there is no segment following it
|
||||||
|
return positionChange;
|
||||||
|
}
|
||||||
Interpolator interpolator = interpolationPanel.getSettingsPanel().createInterpolator();
|
Interpolator interpolator = interpolationPanel.getSettingsPanel().createInterpolator();
|
||||||
if (interpolationPanel.getInterpolatorType() == InterpolatorType.DEFAULT) {
|
if (interpolationPanel.getInterpolatorType() == InterpolatorType.DEFAULT) {
|
||||||
return CombinedChange.createFromApplied(positionChange, timeline.setInterpolatorToDefault(time),
|
return CombinedChange.createFromApplied(positionChange, timeline.setInterpolatorToDefault(time),
|
||||||
|
|||||||
Reference in New Issue
Block a user