我正在使用 DragonRuby Game Toolkit 来构建游戏。
如何检测一个物体(例如 a)是否Sprite与另一个物体发生碰撞Sprite?
这是放置在屏幕上的两个精灵。关于如何检查碰撞的待办事项:
def tick args
# create a sprite
args.state.sprite_one = { x: 100,
y: 200,
w: 50,
h: 50 }
# create another sprite that definitely collides
args.state.sprite_two = { x: 101,
y: 201,
w: 1,
h: 1 }
sprites_collide = ????? # help
if sprites_collide
args.gtk.notify! "sprites collide!"
else
args.gtk.notify! "sprites do not collide!"
end
end
Run Code Online (Sandbox Code Playgroud) 有没有人有功能语言编写UI自动化的例子或经验?我正在学习F#以更好地理解功能概念,我很难弄清楚如何用函数式语言构建自动UI测试 - 似乎很容易使用我在Java中使用的相同页面/屏幕对象模式或C#,但由于缺乏经验,我很好奇,如果我错过了不同的方法.
我正在尝试使用F#和Canopy编写一个简单的刮刀(参见http://lefthandedgoat.github.io/canopy/).我试图从类".application-tile"中提取所有元素的文本.但是,在下面的代码中,我得到以下构建错误,我不明白.
This expression was expected to have type
OpenQA.Selenium.IWebElement -> 'a
but here has type
OpenQA.Selenium.IWebElement
Run Code Online (Sandbox Code Playgroud)
知道为什么会这样吗?谢谢!
open canopy
open runner
open System
[<EntryPoint>]
let main argv =
start firefox
"taking canopy for a spin" &&& fun _ ->
url "https://abc.com/"
// Login Page
"#i0116" << "abc@abc.com"
"#i0118" << "abc"
click "#abcButton"
// Get the Application Tiles -- BUILD ERROR HAPPENS HERE
elements ".application-tile" |> List.map (fun tile -> (tile |> (element ".application-name breakWordWrap"))) |> ignore
run()
Run Code Online (Sandbox Code Playgroud) 我正在开始与NSpec合作,但是我会喜欢用正确的方法来指导或测试我的控制器.基本上,一些例子可能会走很长的路.那里有没有示例项目?所有帮助将不胜感激.
理查德.