aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs59
-rw-r--r--prebuild.xml3
2 files changed, 62 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs
new file mode 100644
index 0000000..ccb0561
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs
@@ -0,0 +1,59 @@
1using System;
2using NUnit.Framework;
3using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes;
4
5namespace OpenSim.Region.Environment.Modules.World.Terrain.Tests
6{
7 [TestFixture]
8 public class TerrainTest
9 {
10 [Test]
11 public void BrushTest()
12 {
13 TerrainChannel x = new TerrainChannel(256, 256);
14 ITerrainPaintableEffect effect = new RaiseSphere();
15
16 effect.PaintEffect(x, 128.0, 128.0, 50, 0.1);
17 Assert.That(x[128, 128] > 0.0, "Raise brush not raising values.");
18 Assert.That(x[0, 128] > 0.0, "Raise brush lowering edge values.");
19
20 x = new TerrainChannel(256, 256);
21 effect = new LowerSphere();
22
23 effect.PaintEffect(x, 128.0, 128.0, 50, 0.1);
24 Assert.That(x[128, 128] < 0.0, "Lower not lowering values.");
25 Assert.That(x[0, 128] < 0.0, "Lower brush affecting edge values.");
26 }
27
28 [Test]
29 public void TerrainChannelTest()
30 {
31 TerrainChannel x = new TerrainChannel(256, 256);
32 Assert.That(x[0, 0] == 0.0, "Terrain not initialising correctly.");
33
34 x[0, 0] = 1.0;
35 Assert.That(x[0, 0] == 1.0, "Terrain not setting values correctly.");
36
37 x[0, 0] = 0;
38 x[0, 0] += 5.0;
39 x[0, 0] -= 1.0;
40 Assert.That(x[0, 0] == 4.0, "Terrain addition/subtraction error.");
41
42 x[0, 0] = Math.PI;
43 double[,] doublesExport = x.GetDoubles();
44 Assert.That(doublesExport[0, 0] == Math.PI, "Export to double[,] array not working correctly.");
45
46 x[0, 0] = 1.0;
47 float[] floatsExport = x.GetFloatsSerialised();
48 Assert.That(floatsExport[0] == 1.0f, "Export to float[] not working correctly.");
49
50 x[0, 0] = 1.0;
51 Assert.That(x.Tainted(0, 0), "Terrain channel tainting not working correctly.");
52 Assert.That(!x.Tainted(0, 0), "Terrain channel tainting not working correctly.");
53
54 TerrainChannel y = x.Copy();
55 Assert.That(!ReferenceEquals(x, y), "Terrain copy not duplicating correctly.");
56 Assert.That(!ReferenceEquals(x.GetDoubles(), y.GetDoubles()), "Terrain array not duplicating correctly.");
57 }
58 }
59} \ No newline at end of file
diff --git a/prebuild.xml b/prebuild.xml
index d0a6e2b..485e70d 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -791,6 +791,9 @@
791 <Reference name="OpenSim.Framework.Console"/> 791 <Reference name="OpenSim.Framework.Console"/>
792 <Reference name="OpenSim.Region.Physics.Manager"/> 792 <Reference name="OpenSim.Region.Physics.Manager"/>
793 <Reference name="OpenSim.Framework.Servers"/> 793 <Reference name="OpenSim.Framework.Servers"/>
794 <!-- Unit tests -->
795 <Reference name="OpenSim.Tests.Common"/>
796 <Reference name="nunit.framework.dll"/>
794 <!-- For scripting in funny languages by default --> 797 <!-- For scripting in funny languages by default -->
795 <Reference name="Microsoft.JScript"/> 798 <Reference name="Microsoft.JScript"/>
796 <Reference name="XMLRPC.dll"/> 799 <Reference name="XMLRPC.dll"/>