From 327320d1a7acbba969d26c281f92f64ce8ff365f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 26 Sep 2012 22:49:44 +0100 Subject: Enforce existing 5 action hardcoded undo limit. This was present in the code but not enforced, which led to a memory leak over time as part properties were changed, whether by viewer, script or another source. This commit enforces that limit, which will soon become configurable. Regression test for undo limit added Should help with http://opensimulator.org/mantis/view.php?id=6279 --- .../Scenes/Tests/SceneObjectUndoRedoTests.cs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Tests') diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs index 1e317c6..c93562d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs @@ -76,6 +76,33 @@ namespace OpenSim.Region.Framework.Scenes.Tests } [Test] + public void TestUndoLimit() + { + TestHelpers.InMethod(); + + Vector3 firstSize = new Vector3(2, 3, 4); + Vector3 secondSize = new Vector3(5, 6, 7); + Vector3 thirdSize = new Vector3(8, 9, 10); + Vector3 fourthSize = new Vector3(11, 12, 13); + + Scene scene = new SceneHelpers().SetupScene(); + scene.MaxUndoCount = 2; + SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); + + g1.GroupResize(firstSize); + g1.GroupResize(secondSize); + g1.GroupResize(thirdSize); + g1.GroupResize(fourthSize); + + g1.RootPart.Undo(); + g1.RootPart.Undo(); + g1.RootPart.Undo(); + + Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0)); + Assert.That(g1.GroupScale, Is.EqualTo(secondSize)); + } + + [Test] public void TestUndoBeyondAvailable() { TestHelpers.InMethod(); -- cgit v1.1