chiark / gitweb /
wdt: Use new w_move extension method
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 28 Jan 2021 16:54:44 +0000 (16:54 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 28 Jan 2021 17:58:12 +0000 (17:58 +0000)
This necessitates using our branch of thirtyfour_sync until
  Make action_chain module pub
  https://github.com/stevepryde/thirtyfour_sync/pull/4

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Cargo.lock.example
Cargo.nail
wdriver.rs
wdriver/wdt-simple.rs

index ba6ec6ac926cdf5891995c5e3d020a907d597dd3..87acd25b34470fd81af111de191c25c0b12f8764 100644 (file)
@@ -2692,8 +2692,6 @@ dependencies = [
 [[package]]
 name = "thirtyfour_sync"
 version = "0.22.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5892bf1e39a0d08bd28417363ab1e810c64d8c0a21c06a4fc21298fcbaf04772"
 dependencies = [
  "base64 0.13.0",
  "log 0.4.13",
index 32ef8c3ece61b75fbe4f1ed37f7a2956820e4eb2..bf2dcfcaa17199d1056acd819329651084233c5a 100644 (file)
@@ -5,6 +5,7 @@
 subdirs = """
 server
 bundle-sources
+thirtyfour_sync
 """
 
 [arch]
index cf032a1834befd4adb8a646e377c76b14b0ab8b9..cdcdf55f6cdfa54e6b781e7e3839771f2abff090 100644 (file)
@@ -1103,7 +1103,7 @@ impl Drop for FinalInfoCollection {
   }
 }
 
-trait IntoInWindow<T> {
+pub trait IntoInWindow<T> {
   fn w_into<'g>(self, w: &'g WindowGuard) -> Result<T, AE>;
 }
 
@@ -1119,6 +1119,21 @@ impl IntoInWindow<WebPos> for Pos {
   }
 }
 
+pub trait ActionChainExt: Sized {
+  fn w_move<'g, P: IntoInWindow<WebPos>>
+    (self, w: &'g WindowGuard, pos: P) -> Result<Self,AE>;
+}
+
+impl<'a> ActionChainExt for t4::action_chain::ActionChain<'a> {
+  #[throws(AE)]
+  fn w_move<'g, P: IntoInWindow<WebPos>>
+    (self, w: &'g WindowGuard, pos: P) -> Self
+  {
+    let (px,py) = pos.w_into(w)?;
+    self.move_to(px,py)
+  }
+}
+
 impl Drop for Setup {
   fn drop(&mut self) {
     (||{
index bbde0b713b6990f936113cbafe118b44d39ac111..66e39e1fd3257b524047fc47b70d1170b09891e5 100644 (file)
@@ -26,7 +26,7 @@ impl Ctx {
       let (p2x,p2y) = p2.posw()?;
 
       w.action_chain()
-        .move_to(p1x, p1y)
+        .w_move(&w, p1.posw()?)?
         .click_and_hold()
         .move_to(p2x + 5, p2y + 10)
         .release()