aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/Tests
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/ScriptEngine/XEngine/Tests
parentAdd a build script. (diff)
downloadopensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs40
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs2
3 files changed, 30 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs
index 878e571..71ef0ac 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
58 m_xEngine = new XEngine(); 58 m_xEngine = new XEngine();
59 59
60 IniConfigSource configSource = new IniConfigSource(); 60 IniConfigSource configSource = new IniConfigSource();
61 61
62 IConfig startupConfig = configSource.AddConfig("Startup"); 62 IConfig startupConfig = configSource.AddConfig("Startup");
63 startupConfig.Set("DefaultScriptEngine", "XEngine"); 63 startupConfig.Set("DefaultScriptEngine", "XEngine");
64 64
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs
index 587695f..477059f 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs
@@ -85,6 +85,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
85 85
86 IConfig startupConfig = configSource.AddConfig("Startup"); 86 IConfig startupConfig = configSource.AddConfig("Startup");
87 startupConfig.Set("DefaultScriptEngine", "XEngine"); 87 startupConfig.Set("DefaultScriptEngine", "XEngine");
88 startupConfig.Set("TrustBinaries", "true");
88 89
89 IConfig xEngineConfig = configSource.AddConfig("XEngine"); 90 IConfig xEngineConfig = configSource.AddConfig("XEngine");
90 xEngineConfig.Set("Enabled", "true"); 91 xEngineConfig.Set("Enabled", "true");
@@ -111,10 +112,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
111 SceneObjectGroup soSceneA = SceneHelpers.AddSceneObject(sceneA, 1, userId, "so1-", sceneObjectIdTail); 112 SceneObjectGroup soSceneA = SceneHelpers.AddSceneObject(sceneA, 1, userId, "so1-", sceneObjectIdTail);
112 soSceneA.AbsolutePosition = new Vector3(128, 10, 20); 113 soSceneA.AbsolutePosition = new Vector3(128, 10, 20);
113 114
115 string soSceneAName = soSceneA.Name;
116 string scriptItemSceneAName = "script1";
117
114 // CREATE SCRIPT TODO 118 // CREATE SCRIPT TODO
115 InventoryItemBase scriptItemSceneA = new InventoryItemBase(); 119 InventoryItemBase scriptItemSceneA = new InventoryItemBase();
116 // itemTemplate.ID = itemId; 120 // itemTemplate.ID = itemId;
117 scriptItemSceneA.Name = "script1"; 121 scriptItemSceneA.Name = scriptItemSceneAName;
118 scriptItemSceneA.Folder = soSceneA.UUID; 122 scriptItemSceneA.Folder = soSceneA.UUID;
119 scriptItemSceneA.InvType = (int)InventoryType.LSL; 123 scriptItemSceneA.InvType = (int)InventoryType.LSL;
120 124
@@ -122,11 +126,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
122 OSChatMessage messageReceived = null; 126 OSChatMessage messageReceived = null;
123 sceneA.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); }; 127 sceneA.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); };
124 128
125 sceneA.RezNewScript(userId, scriptItemSceneA, 129 sceneA.RezNewScript(userId, scriptItemSceneA,
126@"integer c = 0; 130@"integer c = 0;
127 131
128default 132default
129{ 133{
130 state_entry() 134 state_entry()
131 { 135 {
132 llSay(0, ""Script running""); 136 llSay(0, ""Script running"");
@@ -139,7 +143,7 @@ default
139 143
140 touch_start(integer n) 144 touch_start(integer n)
141 { 145 {
142 c = c + 1; 146 c = c + 1;
143 llSay(0, (string)c); 147 llSay(0, (string)c);
144 } 148 }
145}"); 149}");
@@ -147,7 +151,7 @@ default
147 chatEvent.WaitOne(60000); 151 chatEvent.WaitOne(60000);
148 152
149 Assert.That(messageReceived, Is.Not.Null, "No chat message received."); 153 Assert.That(messageReceived, Is.Not.Null, "No chat message received.");
150 Assert.That(messageReceived.Message, Is.EqualTo("Script running")); 154 Assert.That(messageReceived.Message, Is.EqualTo("Script running"));
151 155
152 { 156 {
153 // XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead. 157 // XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead.
@@ -158,24 +162,31 @@ default
158 162
159 EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det); 163 EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det);
160 164
165 messageReceived = null;
166 chatEvent.Reset();
161 xEngineA.PostObjectEvent(soSceneA.LocalId, ep); 167 xEngineA.PostObjectEvent(soSceneA.LocalId, ep);
162 chatEvent.WaitOne(60000); 168 chatEvent.WaitOne(60000);
163 169
164 Assert.That(messageReceived.Message, Is.EqualTo("1")); 170 Assert.That(messageReceived.Message, Is.EqualTo("1"));
165 } 171 }
166 172
167 sceneB.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); }; 173 AutoResetEvent chatEventB = new AutoResetEvent(false);
174 sceneB.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEventB.Set(); };
168 175
176 messageReceived = null;
177 chatEventB.Reset();
169 // Cross with a negative value 178 // Cross with a negative value
170 soSceneA.AbsolutePosition = new Vector3(128, -10, 20); 179 soSceneA.AbsolutePosition = new Vector3(128, -10, 20);
171 180
172 chatEvent.WaitOne(60000); 181 chatEventB.WaitOne(60000);
173 Assert.That(messageReceived.Message, Is.EqualTo("Changed")); 182 Assert.That(messageReceived, Is.Not.Null, "No Changed message received.");
183 Assert.That(messageReceived.Message, Is.Not.Null, "Changed message without content");
184 Assert.That(messageReceived.Message, Is.EqualTo("Changed"));
174 185
175 // TEST sending event to moved prim and output 186 // TEST sending event to moved prim and output
176 { 187 {
177 SceneObjectGroup soSceneB = sceneB.GetSceneObjectGroup(soSceneA.Name); 188 SceneObjectGroup soSceneB = sceneB.GetSceneObjectGroup(soSceneAName);
178 TaskInventoryItem scriptItemSceneB = soSceneB.RootPart.Inventory.GetInventoryItem(scriptItemSceneA.Name); 189 TaskInventoryItem scriptItemSceneB = soSceneB.RootPart.Inventory.GetInventoryItem(scriptItemSceneAName);
179 190
180 // XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead. 191 // XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead.
181 DetectParams[] det = new DetectParams[1]; 192 DetectParams[] det = new DetectParams[1];
@@ -185,10 +196,13 @@ default
185 196
186 EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det); 197 EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det);
187 198
199 Thread.Sleep(250); // wait for other change messages to pass
200 messageReceived = null;
201 chatEventB.Reset();
188 xEngineB.PostObjectEvent(soSceneB.LocalId, ep); 202 xEngineB.PostObjectEvent(soSceneB.LocalId, ep);
189 chatEvent.WaitOne(60000); 203 chatEventB.WaitOne(60000);
190 204
191 Assert.That(messageReceived.Message, Is.EqualTo("2")); 205 Assert.That(messageReceived.Message, Is.EqualTo("2"));
192 } 206 }
193 } 207 }
194 } 208 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
index 2ef4058..07470d6 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
@@ -43,6 +43,7 @@ using OpenSim.Tests.Common;
43 43
44namespace OpenSim.Region.ScriptEngine.Tests 44namespace OpenSim.Region.ScriptEngine.Tests
45{ 45{
46 /*
46 [TestFixture] 47 [TestFixture]
47 public class XEnginePersistenceTests : OpenSimTestCase 48 public class XEnginePersistenceTests : OpenSimTestCase
48 { 49 {
@@ -149,4 +150,5 @@ namespace OpenSim.Region.ScriptEngine.Tests
149 scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, rezzedSo); 150 scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, rezzedSo);
150 } 151 }
151 } 152 }
153 */
152} \ No newline at end of file 154} \ No newline at end of file