aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-10-27 17:06:47 +0000
committerJustin Clarke Casey2008-10-27 17:06:47 +0000
commit6ec9c2d7068bd7b9da0cb32b6f0847d8fc6b0a53 (patch)
tree7637337a20aed42acefcd470ff70220b02353829 /OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs
parent* Temporarily revert terrain changes in r6976 and reinstate unit test from r6... (diff)
downloadopensim-SC_OLD-6ec9c2d7068bd7b9da0cb32b6f0847d8fc6b0a53.zip
opensim-SC_OLD-6ec9c2d7068bd7b9da0cb32b6f0847d8fc6b0a53.tar.gz
opensim-SC_OLD-6ec9c2d7068bd7b9da0cb32b6f0847d8fc6b0a53.tar.bz2
opensim-SC_OLD-6ec9c2d7068bd7b9da0cb32b6f0847d8fc6b0a53.tar.xz
* Apply http://opensimulator.org/mantis/view.php?id=2468
* This time there are accompanying changes to the unit test to adapt it to the changes * Thanks tglion
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs40
1 files changed, 30 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs
index 5b4bc8c..3511988 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs
@@ -37,30 +37,50 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Tests
37 [Test] 37 [Test]
38 public void BrushTest() 38 public void BrushTest()
39 { 39 {
40 TerrainChannel map = new TerrainChannel(256, 256); 40 bool[,] allowMask = new bool[256, 256];
41 bool[,] allowMask = new bool[map.Width,map.Height];
42 int x; 41 int x;
43 int y; 42 int y;
44 for (x=0; x<map.Width; x++) 43 for (x=0; x<128; x++)
45 { 44 {
46 for (y=0; y<map.Height; y++) 45 for (y=0; y<256; y++)
47 { 46 {
48 allowMask[x,y] = true; 47 allowMask[x,y] = true;
49 } 48 }
50 } 49 }
51 50
51 //
52 // Test RaiseSphere
53 //
54 TerrainChannel map = new TerrainChannel(256, 256);
52 ITerrainPaintableEffect effect = new RaiseSphere(); 55 ITerrainPaintableEffect effect = new RaiseSphere();
53 56
54 effect.PaintEffect(map, allowMask, 128.0, 128.0, 23.0, 100, 0.1); 57 effect.PaintEffect(map, allowMask, 128.0, 128.0, -1.0, 2, 0.1);
55 Assert.That(map[128, 128] > 0.0, "Raise brush not raising values."); 58 Assert.That(map[127, 128] > 0.0, "Raise brush should raising value at this point (127,128).");
56 Assert.That(map[0, 128] > 0.0, "Raise brush lowering edge values."); 59 Assert.That(map[124, 128] > 0.0, "Raise brush should raising value at this point (124,128).");
60 Assert.That(map[123, 128] == 0.0, "Raise brush should not change value at this point (123,128).");
61 Assert.That(map[128, 128] == 0.0, "Raise brush should not change value at this point (128,128).");
62 Assert.That(map[0, 128] == 0.0, "Raise brush should not change value at this point (0,128).");
57 63
64 //
65 // Test LowerSphere
66 //
58 map = new TerrainChannel(256, 256); 67 map = new TerrainChannel(256, 256);
68 for (x=0; x<map.Width; x++)
69 {
70 for (y=0; y<map.Height; y++)
71 {
72 map[x,y] = 1.0;
73 }
74 }
59 effect = new LowerSphere(); 75 effect = new LowerSphere();
60 76
61 effect.PaintEffect(map, allowMask, 128.0, 128.0, -1, 100, 0.1); 77 effect.PaintEffect(map, allowMask, 128.0, 128.0, -1.0, 2, 6.0);
62 Assert.That(map[128, 128] < 0.0, "Lower not lowering values."); 78 Assert.That(map[127, 128] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128).");
63 Assert.That(map[0, 128] < 0.0, "Lower brush affecting edge values."); 79 Assert.That(map[127, 128] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128).");
80 Assert.That(map[124, 128] < 1.0, "Lower brush should lowering value at this point (124,128).");
81 Assert.That(map[123, 128] == 1.0, "Lower brush should not change value at this point (123,128).");
82 Assert.That(map[128, 128] == 1.0, "Lower brush should not change value at this point (128,128).");
83 Assert.That(map[0, 128] == 1.0, "Lower brush should not change value at this point (0,128).");
64 } 84 }
65 85
66 [Test] 86 [Test]