summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Oram <dev@mitmaro.ca>2020-11-24 22:07:20 -0330
committerTim Oram <dev@mitmaro.ca>2020-12-10 23:14:24 -0330
commit399bb4208f0f2a3a8b75e6644f8429de6ad8f8d4 (patch)
tree9cf36de6bb790ed29e47b6bc0b1b71a116ff9f37
parentd6b648915cfcd973d83d0864154d919717cc0076 (diff)
Drop init_color trace from virtual curses
Verifying the colors initialized is a better way to determine the result of initializing colors in tests.
-rw-r--r--src/display/color_manager.rs11
-rw-r--r--src/display/virtual_curses.rs7
2 files changed, 9 insertions, 9 deletions
diff --git a/src/display/color_manager.rs b/src/display/color_manager.rs
index 279255d..1357353 100644
--- a/src/display/color_manager.rs
+++ b/src/display/color_manager.rs
@@ -390,12 +390,11 @@ mod tests {
blue: 220,
},
);
- let trace = curses.get_function_trace();
- let expected_trace = vec![
- build_trace!("init_color", "16", "392", "588", "784"),
- build_trace!("init_color", "17", "470", "666", "862"),
- ];
- compare_trace(&trace, &expected_trace);
+
+ let colors = curses.get_colors();
+
+ assert_eq!(colors[16], (392, 588, 784));
+ assert_eq!(colors[17], (470, 666, 862));
}
#[test]
diff --git a/src/display/virtual_curses.rs b/src/display/virtual_curses.rs
index 908d136..029747c 100644
--- a/src/display/virtual_curses.rs
+++ b/src/display/virtual_curses.rs
@@ -49,6 +49,10 @@ impl Curses {
self.function_call_trace.borrow().clone()
}
+ pub(crate) const fn get_colors(&self) -> &[(i16, i16, i16); 255] {
+ &self.colors
+ }
+
pub(crate) fn push_input(&self, input: Input) {
self.input.borrow_mut().insert(0, input);
}
@@ -58,9 +62,6 @@ impl Curses {
}
pub(super) fn init_color(&mut self, index: i16, red: i16, green: i16, blue: i16) {
- self.function_call_trace
- .borrow_mut()
- .push(build_trace!("init_color", index, red, green, blue));
self.colors[index as usize] = (red, green, blue);
}