aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs39
1 files changed, 20 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
index 9660092..3d4f762 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using NUnit.Framework; 29using NUnit.Framework;
30using OpenSim.Framework;
30using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; 31using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes;
31using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
32 33
@@ -38,12 +39,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
38 [Test] 39 [Test]
39 public void BrushTest() 40 public void BrushTest()
40 { 41 {
41 bool[,] allowMask = new bool[256, 256]; 42 bool[,] allowMask = new bool[(int)Constants.RegionSize, 256];
42 int x; 43 int x;
43 int y; 44 int y;
44 for (x=0; x<128; x++) 45 for (x = 0; x < (int)((int)Constants.RegionSize * 0.5f); x++)
45 { 46 {
46 for (y=0; y<256; y++) 47 for (y = 0; y < (int)Constants.RegionSize; y++)
47 { 48 {
48 allowMask[x,y] = true; 49 allowMask[x,y] = true;
49 } 50 }
@@ -52,20 +53,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
52 // 53 //
53 // Test RaiseSphere 54 // Test RaiseSphere
54 // 55 //
55 TerrainChannel map = new TerrainChannel(256, 256); 56 TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize);
56 ITerrainPaintableEffect effect = new RaiseSphere(); 57 ITerrainPaintableEffect effect = new RaiseSphere();
57 58
58 effect.PaintEffect(map, allowMask, 128.0, 128.0, -1.0, 2, 0.1); 59 effect.PaintEffect(map, allowMask, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, -1.0, 2, 0.1);
59 Assert.That(map[127, 128] > 0.0, "Raise brush should raising value at this point (127,128)."); 60 Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (127,128).");
60 Assert.That(map[124, 128] > 0.0, "Raise brush should raising value at this point (124,128)."); 61 Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (124,128).");
61 Assert.That(map[123, 128] == 0.0, "Raise brush should not change value at this point (123,128)."); 62 Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (123,128).");
62 Assert.That(map[128, 128] == 0.0, "Raise brush should not change value at this point (128,128)."); 63 Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (128,128).");
63 Assert.That(map[0, 128] == 0.0, "Raise brush should not change value at this point (0,128)."); 64 Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (0,128).");
64 65
65 // 66 //
66 // Test LowerSphere 67 // Test LowerSphere
67 // 68 //
68 map = new TerrainChannel(256, 256); 69 map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize);
69 for (x=0; x<map.Width; x++) 70 for (x=0; x<map.Width; x++)
70 { 71 {
71 for (y=0; y<map.Height; y++) 72 for (y=0; y<map.Height; y++)
@@ -75,19 +76,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
75 } 76 }
76 effect = new LowerSphere(); 77 effect = new LowerSphere();
77 78
78 effect.PaintEffect(map, allowMask, 128.0, 128.0, -1.0, 2, 6.0); 79 effect.PaintEffect(map, allowMask, ((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), -1.0, 2, 6.0);
79 Assert.That(map[127, 128] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); 80 Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128).");
80 Assert.That(map[127, 128] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); 81 Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128).");
81 Assert.That(map[124, 128] < 1.0, "Lower brush should lowering value at this point (124,128)."); 82 Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] < 1.0, "Lower brush should lowering value at this point (124,128).");
82 Assert.That(map[123, 128] == 1.0, "Lower brush should not change value at this point (123,128)."); 83 Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (123,128).");
83 Assert.That(map[128, 128] == 1.0, "Lower brush should not change value at this point (128,128)."); 84 Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (128,128).");
84 Assert.That(map[0, 128] == 1.0, "Lower brush should not change value at this point (0,128)."); 85 Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (0,128).");
85 } 86 }
86 87
87 [Test] 88 [Test]
88 public void TerrainChannelTest() 89 public void TerrainChannelTest()
89 { 90 {
90 TerrainChannel x = new TerrainChannel(256, 256); 91 TerrainChannel x = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize);
91 Assert.That(x[0, 0] == 0.0, "Terrain not initialising correctly."); 92 Assert.That(x[0, 0] == 0.0, "Terrain not initialising correctly.");
92 93
93 x[0, 0] = 1.0; 94 x[0, 0] = 1.0;