2 using System.Collections.Generic;
5 using System.Reflection;
11 using OpenSim.Framework;
12 using OpenSim.Framework.Servers;
13 using OpenSim.Framework.Servers.HttpServer;
14 using OpenSim.Region.CoreModules.Scripting.LSLHttp;
15 using OpenSim.Region.Framework.Scenes;
16 using OpenSim.Region.ScriptEngine.Shared;
17 using OpenSim.Region.ScriptEngine.Shared.Api;
18 using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
19 using OpenSim.Services.Interfaces;
20 using OpenSim.Tests.Common;
22 namespace OpenSim.
Region.ScriptEngine.Shared.Tests
30 private Scene m_scene;
41 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
50 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
61 SceneHelpers.SetupSceneModules(m_scene,
new IniConfigSource(), m_engine);
63 m_so = SceneHelpers.AddSceneObject(m_scene);
64 m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart);
69 m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem);
75 TestHelpers.InMethod();
77 string[] ncLines = {
"One",
"Twoè",
"Three" };
80 = TaskInventoryHelpers.AddNotecard(m_scene.AssetService, m_so.RootPart,
"nc",
"1",
"10", string.Join(
"\n", ncLines));
82 AssertValidNotecardLine(ncItem.
Name, 0, ncLines[0]);
83 AssertValidNotecardLine(ncItem.
Name, 2, ncLines[2]);
88 AssertValidNotecardLine(ncItem.
Name, -1,
"");
89 AssertValidNotecardLine(ncItem.
Name, -2,
"");
95 TestHelpers.InMethod();
97 AssertInValidNotecardLine(
"nc", 0);
103 TestHelpers.InMethod();
105 TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart,
"nc1",
"Not important");
107 AssertInValidNotecardLine(ncItem.Name, 0);
110 private void AssertValidNotecardLine(
string ncName,
int lineNumber,
string assertLine)
112 string key = m_lslApi.llGetNotecardLine(ncName, lineNumber);
113 Assert.That(
key, Is.Not.EqualTo(UUID.Zero.ToString()));
115 Assert.That(m_engine.PostedEvents.Count, Is.EqualTo(1));
116 Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID));
118 List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID];
119 Assert.That(events.Count, Is.EqualTo(1));
122 Assert.That(eventParams.EventName, Is.EqualTo(
"dataserver"));
123 Assert.That(eventParams.Params[0].ToString(), Is.EqualTo(
key));
124 Assert.That(eventParams.Params[1].ToString(), Is.EqualTo(assertLine));
126 m_engine.ClearPostedEvents();
129 private void AssertInValidNotecardLine(
string ncName,
int lineNumber)
131 string key = m_lslApi.llGetNotecardLine(ncName, lineNumber);
132 Assert.That(
key, Is.EqualTo(UUID.Zero.ToString()));
134 Assert.That(m_engine.PostedEvents.Count, Is.EqualTo(0));
void TestLlGetNotecardLine()
Contains all LSL ll-functions. This class will be in Default AppDomain.
void TestLlGetNotecardLine_NoNotecard()
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
Represents an item in a task inventory
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString key
void TestLlGetNotecardLine_NotANotecard()
Helpers for setting up scenes.
void TestFixureTearDown()
Tests for notecard related functions in LSL
Holds all the data required to execute a scripting event.