aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs157
1 files changed, 0 insertions, 157 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
deleted file mode 100644
index c93562d..0000000
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
+++ /dev/null
@@ -1,157 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock;
37
38namespace OpenSim.Region.Framework.Scenes.Tests
39{
40 /// <summary>
41 /// Tests for undo/redo
42 /// </summary>
43 public class SceneObjectUndoRedoTests : OpenSimTestCase
44 {
45 [Test]
46 public void TestUndoRedoResizeSceneObject()
47 {
48 TestHelpers.InMethod();
49// TestHelpers.EnableLogging();
50
51 Vector3 firstSize = new Vector3(2, 3, 4);
52 Vector3 secondSize = new Vector3(5, 6, 7);
53
54 Scene scene = new SceneHelpers().SetupScene();
55 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
56
57 // TODO: It happens to be the case that we are not storing undo states for SOPs which are not yet in a SOG,
58 // which is the way that AddSceneObject() sets up the object (i.e. it creates the SOP first). However,
59 // this is somewhat by chance. Really, we shouldn't be storing undo states at all if the object is not
60 // in a scene.
61 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
62
63 g1.GroupResize(firstSize);
64 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
65
66 g1.GroupResize(secondSize);
67 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
68
69 g1.RootPart.Undo();
70 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
71 Assert.That(g1.GroupScale, Is.EqualTo(firstSize));
72
73 g1.RootPart.Redo();
74 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
75 Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
76 }
77
78 [Test]
79 public void TestUndoLimit()
80 {
81 TestHelpers.InMethod();
82
83 Vector3 firstSize = new Vector3(2, 3, 4);
84 Vector3 secondSize = new Vector3(5, 6, 7);
85 Vector3 thirdSize = new Vector3(8, 9, 10);
86 Vector3 fourthSize = new Vector3(11, 12, 13);
87
88 Scene scene = new SceneHelpers().SetupScene();
89 scene.MaxUndoCount = 2;
90 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
91
92 g1.GroupResize(firstSize);
93 g1.GroupResize(secondSize);
94 g1.GroupResize(thirdSize);
95 g1.GroupResize(fourthSize);
96
97 g1.RootPart.Undo();
98 g1.RootPart.Undo();
99 g1.RootPart.Undo();
100
101 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
102 Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
103 }
104
105 [Test]
106 public void TestUndoBeyondAvailable()
107 {
108 TestHelpers.InMethod();
109
110 Vector3 newSize = new Vector3(2, 3, 4);
111
112 Scene scene = new SceneHelpers().SetupScene();
113 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
114 Vector3 originalSize = g1.GroupScale;
115
116 g1.RootPart.Undo();
117
118 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
119 Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
120
121 g1.GroupResize(newSize);
122 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
123 Assert.That(g1.GroupScale, Is.EqualTo(newSize));
124
125 g1.RootPart.Undo();
126 g1.RootPart.Undo();
127
128 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
129 Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
130 }
131
132 [Test]
133 public void TestRedoBeyondAvailable()
134 {
135 TestHelpers.InMethod();
136
137 Vector3 newSize = new Vector3(2, 3, 4);
138
139 Scene scene = new SceneHelpers().SetupScene();
140 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
141 Vector3 originalSize = g1.GroupScale;
142
143 g1.RootPart.Redo();
144
145 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
146 Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
147
148 g1.GroupResize(newSize);
149 g1.RootPart.Undo();
150 g1.RootPart.Redo();
151 g1.RootPart.Redo();
152
153 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
154 Assert.That(g1.GroupScale, Is.EqualTo(newSize));
155 }
156 }
157} \ No newline at end of file