• Android自动测试之MonkeyRunner之MonkeyImage


    monkeyrunner类可以保存设备或模拟器的截图MonkeyImage提供了图像转换、图像存储、复制部分图像能方法。这样可以把通过截图显性的观察问题。

          MonkeyImage创建对象的方法如下:

                 newimage =MonkeyDevice.takeSnapshot()

         MonkeyImage提供了如下方法:

     

    Methods
    string convertToBytes                (string format)
                    Converts the current image to a particular format and returns it as a               string that you can then access as an iterable of binary bytes.           
    tuple getRawPixel                (integer x,               integer y)           
                    Returns the single pixel at the image location (x,y), as an                atuple of integer, in the form (a,r,g,b).           
    integer getRawPixelInt                (integer x,                integer y)           
                    Returns the single pixel at the image location (x,y), as                a 32-bitinteger.           
    MonkeyImage getSubImage                (tuple rect)           
                    Creates a new MonkeyImage object from a rectangular selection of the                current image.           
    boolean sameAs         (MonkeyImage            other,            float percent)           
                    Compares this MonkeyImage object to another and returns the result of                the comparison. Thepercent argument specifies the percentage                difference that is allowed for the two images to be "equal".           
    void writeToFile                (string path,               string format)           
                    Writes the current image to the file specified byfilename, in the                format specified by format.           

         

         http://www.devdiv.com/android/docs/guide/developing/tools/MonkeyImage.html

    /**
    * @author 张兴业
    * 邮箱:xy-zhang@163.com
    * qq:363302850
    *
    */

  • 相关阅读:
    ARM的反汇编工具
    Windows上使用Objectivec和Cocoa
    linux 统计代码行数
    oracle数据库基本操作
    thinkphp 带检索参数分页
    Object 转为List
    MvvM datagrid多行选中绑定
    mvvm Dev12.1 GridControl 导出
    ASP.NET MVC入门,好文共享
    [职场、征人、面试](呛)你到底要不要换工作? Part (II) 诚实,最难堪的状态,却最有价值的对策
  • 原文地址:https://www.cnblogs.com/xyzlmn/p/3168414.html
Copyright © 2020-2023  润新知