本文整理汇总了C#中UITestControl.CaptureImage方法的典型用法代码示例。如果您正苦于以下问题:C# UITestControl.CaptureImage方法的具体用法?C# UITestControl.CaptureImage怎么用?C# UITestControl.CaptureImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITestControl
的用法示例。
在下文中一共展示了UITestControl.CaptureImage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsActivityIconVisible
/// <summary>
/// Determines whether [is activity icon visible] [the specified activity].
/// </summary>
/// <param name="activity">The activity.</param>
/// <returns></returns>
public bool IsActivityIconVisible(UITestControl activity)
{
const string ActivityDefaultGrey = "ffe9ecee";
var pixelGrabber = new Bitmap(activity.CaptureImage());
var thePixel = pixelGrabber.GetPixel(10, 10).Name;
return thePixel != ActivityDefaultGrey;
}
示例2: AssignControl_IsLeftTextBoxHighlightedRed
/// <summary>
/// Assigns the control_ is left text box highlighted red.
/// </summary>
/// <param name="leftTextBox">The left text box.</param>
/// <returns></returns>
public bool AssignControl_IsLeftTextBoxHighlightedRed(UITestControl leftTextBox)
{
var pixelGrabber = new Bitmap(leftTextBox.CaptureImage());
return pixelGrabber.GetPixel(5, 0) == Color.Red;
}
示例3: IsIconVisible
/// <summary>
/// Determines whether [is icon visible] [the specified tool].
/// NOTE : Crap method. If icon has a lot of white in it it will fail ;)
/// </summary>
/// <param name="tool">The tool.</param>
/// <returns></returns>
public bool IsIconVisible(UITestControl tool)
{
const string White = "ffffffff";
var pixelGrabber = new Bitmap(tool.CaptureImage());
var result = false;
//must find some color after 3 pixel grabs
//first pass
Mouse.Move(tool, new Point(24, 9));
var thePixel = pixelGrabber.GetPixel(24, 9).Name;
result = thePixel != White;
//second pass
Mouse.Move(tool, new Point(25, 10));
thePixel = pixelGrabber.GetPixel(25, 10).Name;
result = result || thePixel != White;
//third pass
Mouse.Move(tool, new Point(26, 21));
thePixel = pixelGrabber.GetPixel(24, 11).Name;
result = result || thePixel != White;
return result;
}