Exemple #1
0
    def countdown_t0_test_touchrotate(timeout):
        """
            countdown_t0_test_texturedtriangle
        :param timeout:
        :return:
        """

        runcast = SampleApiDemoImpl()
        file_path = runcast.locate_touchrotate()
        count = 0
        cmd = "dumpsys window|grep mCurrentFocus"
        errormessage = "TouchRotateActivity is interrupted"
        g_common_obj.shell_cmd('adb root ||adb remount')
        g_common_obj.shell_cmd('bash ' + file_path)
        while timeout > count:
            ncount = timeout - count
            if ncount > 1:
                print("there were %d seconds left " % ncount)
            else:
                print("there were %d second left " % ncount)
            mcurrent_focus = g_common_obj.adb_cmd_capture_msg(cmd).strip(
                '\n\t\r\f')
            sys.stdout.flush()
            time.sleep(1)
            assert mcurrent_focus.__contains__(
                ".TouchRotateActivity"), errormessage
            count += 1
            if count >= timeout:
                print "\rcase has finished succuessfully!"
        assert count == timeout
 def test_delete_one_image_folder(self):
     g_common_obj.shell_cmd("adb shell mkdir /sdcard/Pictures/test")
     self.photos.deploy_photo_content("Pictures", "email",
                                      "/sdcard/Pictures/test")
     self.photos.launch_photos_am()
     self.photos.delete_photos_in_a_folder("test", 1)
     self.photos.launch_photos_am()
     self.photos.check_if_folder_deleted("test")
Exemple #3
0
 def init_hwc_display(self):
     adb32.adb_disable_verity()
     hwc_display_file_local = get_resource_from_atifactory(
         self.CONFIG_FILE, 'hwc_display', 'file_path')
     LOG.debug('Push init hwc_display.ini to /vendor/etc/')
     g_common_obj.shell_cmd('adb push %s %s' %
                            (hwc_display_file_local, self.hwc_display_file))
     adb32.adb_shell_stop()
     adb32.adb_shell_start()
Exemple #4
0
    def reboot_device(self, time_out=90):
        """
        android root on
        """

        adbcmdstr = "adb reboot"
        ret = g_common_obj.shell_cmd(adbcmdstr, time_out)
        print "xxxxxxxxxxxxxxxxxxxxxxxxxxx   adb reboot :%s" % ret
        adbcmdstr = "adb wait-for-device"
        ret = g_common_obj.shell_cmd(adbcmdstr, time_out)
        return ret
 def mirror_effect_check_(self, file_path):
     """ check mirror effect
     """
     print "get template picture name"
     comp = g_common_obj.adb_cmd_capture_msg('ls /sdcard/DCIM/Camera/*.jpg')
     compare = comp.strip("\n")
     print "template file: " + compare
     g_common_obj.adb_cmd_common('pull ' + compare + ' ' + self.tmpdir +
                                 '/compare.jpg')
     assert g_common_obj.shell_cmd(
         "diff -q %s %s" % (file_path, self.tmpdir +
                            '/compare.jpg')) != '0', "check add effect fail"
Exemple #6
0
    def get_pictures():
        """
            download pictures tar folders from artifactory
        """
        if not os.path.isdir("~/Pictures") is True:
            g_common_obj.shell_cmd("mkdir -p ~/Pictures")
        config = TestConfig()
        cfg_file = 'tests.tablet.artifactory.conf'
        cfg_arti = config.read(cfg_file, 'artifactory')
        config_handle = ConfigHandle()
        cfg_arti["location"] = config_handle.read_configuration(
            'artifactory', 'location', '/etc/oat/', 'sys.conf')
        cfg = config.read(cfg_file, 'content_picture')
        arti = Artifactory(cfg_arti.get('location'))

        pic_name1 = cfg.get("pngtar")
        file_path1 = arti.get(pic_name1)
        g_common_obj.shell_cmd("mv " + file_path1 + " ~/Pictures/PNG.tar.gz ")

        pic_name2 = cfg.get("webptar")
        file_path2 = arti.get(pic_name2)
        g_common_obj.shell_cmd("mv " + file_path2 + " ~/Pictures/WEBP.tar.gz ")

        # assert os.path.isdir("~/Pictures") is True
        os.system("cd ~/Pictures ")
        os.system("echo change to dir ~/pictures $?")

        os.system("tar xzvf ~/Pictures/PNG.tar.gz -C ~/Pictures/ ")
        os.system("echo unarchive png $?")
        os.system("tar xzvf ~/Pictures/WEBP.tar.gz -C ~/Pictures/ ")
        os.system("echo unarchive webp $?")
Exemple #7
0
 def locate_touchrotate(self):
     """
         locate touch rotate
     """
     self.unlock(self)
     self.launch_app_am()
     self.device(text="Graphics").click()
     self.device(scrollable=True).scroll.vert.forward(steps=50)
     self.device(text="OpenGL ES").click()
     self.device(text="Touch Rotate").click.wait()
     config = TestConfig()
     cfg_file = 'tests.tablet.artifactory.conf'
     cfg_arti = config.read(cfg_file, 'artifactory')
     config_handle = ConfigHandle()
     cfg_arti["location"] = config_handle.read_configuration(
         'artifactory', 'location', '/etc/oat/', 'sys.conf')
     cfg = config.read(cfg_file, 'content_touchrotateevents')
     arti = Artifactory(cfg_arti.get('location'))
     name = cfg.get("name")
     file_path = arti.get(name)
     g_common_obj.shell_cmd('chmod 777 ' + file_path)
     return file_path
 def Select_Random_Mediaeffect_check_(self, file_path):
     """ Add Radom Media Effects to image and check
     """
     self.photos.open_a_picture()
     time.sleep(3)
     self.photos.add_adjustments_to_photos("Apply light enhancements", 100)
     print "get template picture name"
     comp = g_common_obj.adb_cmd_capture_msg(
         'ls -l /sdcard/Pictures/*.jpg | sed -n 2p')
     compare = '/sdcard/Pictures/' + os.path.basename(
         comp.strip("\n").split(' ')[-1])
     print "template file: " + compare
     g_common_obj.adb_cmd_common('pull ' + compare + ' ' + self.tmpdir +
                                 '/compare.jpg')
     assert g_common_obj.shell_cmd(
         "diff -q %s %s" % (file_path, self.tmpdir +
                            '/compare.jpg')) != '0', "check add effect fail"
 def tearDown(self):
     print "[Teardown]: %s" % self._test_name
     super(TestGLSurface, self).tearDown()
     g_common_obj.shell_cmd("ps -ef | grep "
                            'adb'
                            " | awk '{print $2}' | xargs killall")
Exemple #10
0
    def testPushSytemResourceFiles(self):
        """
        Push system resources files to devices
        """
        self.flag = []
        config = TestConfig()
        cfg_file = 'tests.tablet.artifactory.conf'
        cfg_arti = config.read(cfg_file, 'artifactory')
        config_handle = ConfigHandle()
        cfg_arti["location"] = config_handle.read_configuration(
            'artifactory', 'location', '/etc/oat/', 'sys.conf')
        cfg = config.read(cfg_file, 'content_oglconform')
        arti = Artifactory(cfg_arti.get('location'))
        binary_name = cfg.get("name")
        file_path = arti.get(binary_name)
        output = g_common_obj.push_file(file_path, "/data/app/oglconform")
        g_common_obj.adb_cmd_common('shell chmod 777 /data/app/oglconform')
        self.flag.append(output)
        egl_config = cfg.get("egl_config")
        egl_config_file_path = arti.get(egl_config)
        output = g_common_obj.push_file(egl_config_file_path,
                                        "/data/app/egl-config")
        g_common_obj.adb_cmd_common('shell chmod 777 /data/app/egl-config')
        self.flag.append(output)
        egl_config = cfg.get("binary_es3")
        egl_config_file_path = arti.get(egl_config)
        output = g_common_obj.push_file(egl_config_file_path,
                                        "/data/app/get-program-binary_es3")
        g_common_obj.adb_cmd_common(
            'shell chmod 777 /data/app/get-program-binary_es3')
        self.flag.append(output)
        cfg = config.read(cfg_file, 'content_gits')
        arti = Artifactory(cfg_arti.get('location'))
        binary_name = cfg.get("busybox")
        file_path = arti.get(binary_name)
        output = g_common_obj.push_file(file_path, "/data/busybox")
        g_common_obj.adb_cmd_common('shell chmod 777 /data/busybox')
        self.flag.append(output)
        cfg = config.read(cfg_file, 'content_GLCTS')
        arti = Artifactory(cfg_arti.get('location'))
        binary_name = cfg.get("name")
        file_path = arti.get(binary_name)

        print "push android_standalone_x86/ to DUT"
        output = g_common_obj.push_file(file_path, "/data/app/")
        g_common_obj.adb_cmd_common(
            "shell /data/busybox tar xzvf /data/app/android_standalone_x86.tgz -C /data/app",
            10)
        g_common_obj.shell_cmd("rm -rf android_standalone_x86*")
        g_common_obj.adb_cmd_common(
            'shell rm /data/app/android_standalone_x86.tgz')
        g_common_obj.adb_cmd_common(
            'shell chmod 777 /data/app/android_standalone_x86/glcts')
        g_common_obj.adb_cmd_common(
            'shell chmod 777 /data/app/android_standalone_x86/test.sh')
        self.flag.append(output)
        cfg = config.read(cfg_file, 'content_conform')
        arti = Artifactory(cfg_arti.get('location'))
        binary_name = cfg.get("name")
        file_path = arti.get(binary_name)
        output = g_common_obj.push_file(file_path, "/data/app/conform")
        g_common_obj.adb_cmd_common('shell chmod 777 /data/app/conform')
        self.flag.append(output)
        binary_name = cfg.get("covegl")
        file_path = arti.get(binary_name)
        output = g_common_obj.push_file(file_path, "/data/app/covegl")
        g_common_obj.adb_cmd_common('shell chmod 777 /data/app/covegl')
        self.flag.append(output)
        binary_name = cfg.get("covgl")
        file_path = arti.get(binary_name)
        output = g_common_obj.push_file(file_path, "/data/app/covgl")
        g_common_obj.adb_cmd_common('shell chmod 777 /data/app/covgl')
        self.flag.append(output)
        binary_name = cfg.get("primtest")
        file_path = arti.get(binary_name)
        output = g_common_obj.push_file(file_path, "/data/app/primtest")
        g_common_obj.adb_cmd_common('shell chmod 777 /data/app/primtest')
        self.flag.append(output)
        cfg = config.read(cfg_file, 'content_android_extension_pack')
        arti = Artifactory(cfg_arti.get('location'))
        binary_name = cfg.get("name")
        file_path = arti.get(binary_name)
        output = g_common_obj.push_file(file_path, "/data/app/oglconform_x86")
        g_common_obj.adb_cmd_common('shell chmod 777 /data/app/oglconform_x86')
        self.flag.append(output)

        for i in range(0, len(self.flag)):
            if self.flag[i] is False:
                return False
        return True