From affe0803f614fc8b51249bd805d9630192f9a115 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 26 Feb 2021 22:31:02 +0000 Subject: [PATCH] apitest: Get positions of pieces Signed-off-by: Ian Jackson --- apitest/at-otter.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index 053f060d..62a470be 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -130,6 +130,7 @@ impl Ctx { #[derive(Debug,Clone)] struct PieceInfo { id: String, + pos: Pos, info: I, } @@ -143,10 +144,15 @@ impl Session { let puse = puse.value(); let puse = puse.as_element().ok_or(Loop::Continue)?; let attr = puse.attr("data-info").ok_or(Loop::Break)?; + let pos = Pos::from_iter(["x","y"].iter().map(|attr|{ + puse + .attr(attr).unwrap() + .parse().unwrap() + })).unwrap(); let id = puse.id.as_ref().unwrap(); let id = id.strip_prefix("use").unwrap().to_string(); let info = serde_json::from_str(attr).unwrap(); - Loop::ok(PieceInfo { id, info }) + Loop::ok(PieceInfo { id, pos, info }) }) .collect() } -- 2.30.2