diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs index ccb0561..842e2ee 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs | |||
@@ -1,59 +1,59 @@ | |||
1 | using System; | 1 | using System; |
2 | using NUnit.Framework; | 2 | using NUnit.Framework; |
3 | using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes; | 3 | using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Modules.World.Terrain.Tests | 5 | namespace OpenSim.Region.Environment.Modules.World.Terrain.Tests |
6 | { | 6 | { |
7 | [TestFixture] | 7 | [TestFixture] |
8 | public class TerrainTest | 8 | public class TerrainTest |
9 | { | 9 | { |
10 | [Test] | 10 | [Test] |
11 | public void BrushTest() | 11 | public void BrushTest() |
12 | { | 12 | { |
13 | TerrainChannel x = new TerrainChannel(256, 256); | 13 | TerrainChannel x = new TerrainChannel(256, 256); |
14 | ITerrainPaintableEffect effect = new RaiseSphere(); | 14 | ITerrainPaintableEffect effect = new RaiseSphere(); |
15 | 15 | ||
16 | effect.PaintEffect(x, 128.0, 128.0, 50, 0.1); | 16 | effect.PaintEffect(x, 128.0, 128.0, 50, 0.1); |
17 | Assert.That(x[128, 128] > 0.0, "Raise brush not raising values."); | 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."); | 18 | Assert.That(x[0, 128] > 0.0, "Raise brush lowering edge values."); |
19 | 19 | ||
20 | x = new TerrainChannel(256, 256); | 20 | x = new TerrainChannel(256, 256); |
21 | effect = new LowerSphere(); | 21 | effect = new LowerSphere(); |
22 | 22 | ||
23 | effect.PaintEffect(x, 128.0, 128.0, 50, 0.1); | 23 | effect.PaintEffect(x, 128.0, 128.0, 50, 0.1); |
24 | Assert.That(x[128, 128] < 0.0, "Lower not lowering values."); | 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."); | 25 | Assert.That(x[0, 128] < 0.0, "Lower brush affecting edge values."); |
26 | } | 26 | } |
27 | 27 | ||
28 | [Test] | 28 | [Test] |
29 | public void TerrainChannelTest() | 29 | public void TerrainChannelTest() |
30 | { | 30 | { |
31 | TerrainChannel x = new TerrainChannel(256, 256); | 31 | TerrainChannel x = new TerrainChannel(256, 256); |
32 | Assert.That(x[0, 0] == 0.0, "Terrain not initialising correctly."); | 32 | Assert.That(x[0, 0] == 0.0, "Terrain not initialising correctly."); |
33 | 33 | ||
34 | x[0, 0] = 1.0; | 34 | x[0, 0] = 1.0; |
35 | Assert.That(x[0, 0] == 1.0, "Terrain not setting values correctly."); | 35 | Assert.That(x[0, 0] == 1.0, "Terrain not setting values correctly."); |
36 | 36 | ||
37 | x[0, 0] = 0; | 37 | x[0, 0] = 0; |
38 | x[0, 0] += 5.0; | 38 | x[0, 0] += 5.0; |
39 | x[0, 0] -= 1.0; | 39 | x[0, 0] -= 1.0; |
40 | Assert.That(x[0, 0] == 4.0, "Terrain addition/subtraction error."); | 40 | Assert.That(x[0, 0] == 4.0, "Terrain addition/subtraction error."); |
41 | 41 | ||
42 | x[0, 0] = Math.PI; | 42 | x[0, 0] = Math.PI; |
43 | double[,] doublesExport = x.GetDoubles(); | 43 | double[,] doublesExport = x.GetDoubles(); |
44 | Assert.That(doublesExport[0, 0] == Math.PI, "Export to double[,] array not working correctly."); | 44 | Assert.That(doublesExport[0, 0] == Math.PI, "Export to double[,] array not working correctly."); |
45 | 45 | ||
46 | x[0, 0] = 1.0; | 46 | x[0, 0] = 1.0; |
47 | float[] floatsExport = x.GetFloatsSerialised(); | 47 | float[] floatsExport = x.GetFloatsSerialised(); |
48 | Assert.That(floatsExport[0] == 1.0f, "Export to float[] not working correctly."); | 48 | Assert.That(floatsExport[0] == 1.0f, "Export to float[] not working correctly."); |
49 | 49 | ||
50 | x[0, 0] = 1.0; | 50 | x[0, 0] = 1.0; |
51 | Assert.That(x.Tainted(0, 0), "Terrain channel tainting not working correctly."); | 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."); | 52 | Assert.That(!x.Tainted(0, 0), "Terrain channel tainting not working correctly."); |
53 | 53 | ||
54 | TerrainChannel y = x.Copy(); | 54 | TerrainChannel y = x.Copy(); |
55 | Assert.That(!ReferenceEquals(x, y), "Terrain copy not duplicating correctly."); | 55 | Assert.That(!ReferenceEquals(x, y), "Terrain copy not duplicating correctly."); |
56 | Assert.That(!ReferenceEquals(x.GetDoubles(), y.GetDoubles()), "Terrain array not duplicating correctly."); | 56 | Assert.That(!ReferenceEquals(x.GetDoubles(), y.GetDoubles()), "Terrain array not duplicating correctly."); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | } \ No newline at end of file | 59 | } \ No newline at end of file |