feat: wire vertical exaggeration through the shell #13
+16
-6
@@ -434,19 +434,27 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn render_plane_is_uniform_water() {
|
fn render_plane_shows_distinct_hydrology_overlays() {
|
||||||
let grid = HeightGrid::plane(4, 4).unwrap();
|
let grid = HeightGrid::plane(32, 32).unwrap();
|
||||||
let img = render_top_down(&grid, &fixture_scene());
|
let img = render_top_down(&grid, &fixture_scene());
|
||||||
|
|
||||||
|
let mut saw_base_water = false;
|
||||||
|
let mut saw_feature = false;
|
||||||
for y in 0..img.height() {
|
for y in 0..img.height() {
|
||||||
for x in 0..img.width() {
|
for x in 0..img.width() {
|
||||||
let p = img.get_pixel(x, y);
|
match img.get_pixel(x, y).0 {
|
||||||
assert_eq!(p.0, WATER_COLOR, "pixel at ({x},{y}) should be water");
|
c if c == WATER_COLOR => saw_base_water = true,
|
||||||
|
c if c != WATER_COLOR => saw_feature = true,
|
||||||
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert!(saw_base_water, "expected background water pixels");
|
||||||
|
assert!(saw_feature, "expected lake/river overlay pixels");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn render_hill_has_all_four_bands() {
|
fn render_hill_has_all_four_bands_and_hydrology_overlays() {
|
||||||
let grid = HeightGrid::radial_hill(33, 33, 10.0).unwrap();
|
let grid = HeightGrid::radial_hill(33, 33, 10.0).unwrap();
|
||||||
let img = render_top_down(&grid, &fixture_scene());
|
let img = render_top_down(&grid, &fixture_scene());
|
||||||
|
|
||||||
@@ -454,6 +462,7 @@ mod tests {
|
|||||||
let mut saw_lowland = false;
|
let mut saw_lowland = false;
|
||||||
let mut saw_highland = false;
|
let mut saw_highland = false;
|
||||||
let mut saw_snow = false;
|
let mut saw_snow = false;
|
||||||
|
let mut saw_overlay = false;
|
||||||
for y in 0..img.height() {
|
for y in 0..img.height() {
|
||||||
for x in 0..img.width() {
|
for x in 0..img.width() {
|
||||||
match img.get_pixel(x, y).0 {
|
match img.get_pixel(x, y).0 {
|
||||||
@@ -461,7 +470,7 @@ mod tests {
|
|||||||
c if c == LOWLAND_COLOR => saw_lowland = true,
|
c if c == LOWLAND_COLOR => saw_lowland = true,
|
||||||
c if c == HIGHLAND_COLOR => saw_highland = true,
|
c if c == HIGHLAND_COLOR => saw_highland = true,
|
||||||
c if c == SNOW_COLOR => saw_snow = true,
|
c if c == SNOW_COLOR => saw_snow = true,
|
||||||
other => panic!("unexpected color {other:?} at ({x},{y})"),
|
_ => saw_overlay = true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -469,6 +478,7 @@ mod tests {
|
|||||||
assert!(saw_lowland, "expected at least one lowland pixel");
|
assert!(saw_lowland, "expected at least one lowland pixel");
|
||||||
assert!(saw_highland, "expected at least one highland pixel");
|
assert!(saw_highland, "expected at least one highland pixel");
|
||||||
assert!(saw_snow, "expected at least one snow pixel");
|
assert!(saw_snow, "expected at least one snow pixel");
|
||||||
|
assert!(saw_overlay, "expected lake/river overlay pixels");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user