Skip to content

Commit

Permalink
LrmScale: add get_measure and get_position to work on scale positions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristramg committed Apr 24, 2024
1 parent ebcf3a7 commit e47dc6e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lrm_scale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,17 +423,20 @@ pub mod tests {

#[test]
fn get_measure() {
// a(scale 0)----measure(scale 5)----b(scale 10)
let measure = scale().get_measure(5.).unwrap();
assert_eq!(measure.anchor_name, "a");
assert_eq!(measure.scale_offset, 5.);

// a(scale 0)----b(scale 10)----measure(scale 25)
let measure = scale().get_measure(25.).unwrap();
assert_eq!(measure.anchor_name, "b");
assert_eq!(measure.scale_offset, 15.);
}

#[test]
fn get_position() {
// a(scale 0)----position(scale a+5)----b(scale 10)
let position = scale()
.get_position(LrmScaleMeasure {
anchor_name: "a".to_string(),
Expand All @@ -442,6 +445,7 @@ pub mod tests {
.unwrap();
assert_eq!(position, 5.);

// a(scale 0)----b(scale 10)----position(scale b+15)
let position = scale()
.get_position(LrmScaleMeasure {
anchor_name: "b".to_string(),
Expand Down

0 comments on commit e47dc6e

Please sign in to comment.