class accelerometer_streaming(UIATestBase):

    def setUp(self):
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.sensortest_package = "android.intel.umg.sensor.test"
        self.sensor_package = "android.intel.umg.sensor"
        self.sensorImpl = SensorImpl()
        self.cfg_file = "tests.tablet.sensor.conf"
        self.sensorImpl.install_app(self.config.read(self.cfg_file, "artifactory"), "location_apks", "testprjsenortest", self.sensortest_package)
        self.sensorImpl.install_app(self.config.read(self.cfg_file, "artifactory"), "location_apks", "sensortest", self.sensor_package)
        super(accelerometer_streaming, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(accelerometer_streaming, self).tearDown()

    def test_accelerometer_streaming(self):
        fileName = os.path.split(os.path.realpath(__file__))[1]
        sensor_type = fileName.split('_')[0].strip()

        num = 0
        for loop in range(10):
            self.sensorImpl.logger.info("")
            self.sensorImpl.logger.info("Loop %d/10 test accelerometer delay" %(loop+1))
            if self.sensorImpl.excute(fileName, "delay", sensor_type, str(10), "fastest", str(0), "fastest") is False:
                num += 1
        if num > 5:
            assert False

        self.sensorImpl.logger.info("test accelerometer jitter--------^_^--------")
        self.sensorImpl.sensor_log(self.config.read(self.cfg_file, "artifactory"), "Fastest", sensor_type)
        self.sensorImpl.check_log()
示例#2
0
class frequency_gyroscope_ui(UIATestBase):
    def setUp(self):
        self._test_name = __name__
        self.apk1_package = "android.intel.umg.sensor.test"
        self.apk2_package = "android.intel.umg.sensor"
        print
        print "[Setup]: %s" % self._test_name
        self.sensorImpl = SensorImpl()
        # self.cfg_file = self.sensorImpl.match_configuration()
        self.cfg_file = "tests.tablet.sensor.conf"
        self.sensorImpl.install_app(
            self.config.read(self.cfg_file, "artifactory"), "location_apks",
            "testprjsenortest", self.apk1_package)
        self.sensorImpl.install_app(
            self.config.read(self.cfg_file, "artifactory"), "location_apks",
            "sensortest", self.apk2_package)
        super(frequency_gyroscope_ui, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(frequency_gyroscope_ui, self).tearDown()

    def test_frequency_gyroscope_ui(self):
        fileName = os.path.split(os.path.realpath(__file__))[1]
        freq_type = fileName.split('_')[2].split('.')[0].strip()
        sensor_type = fileName.split('_')[1].strip()

        product = self.sensorImpl.check_product()
        if 'mrd' in product:
            cfg = self.config.read(self.cfg_file,
                                   'frequency_gyroscope_ui_t3mrd')
        else:
            cfg = self.config.read(self.cfg_file, 'frequency_gyroscope_ui')

        catagory = cfg.get("catagory")
        sensorName = cfg.get("sensorname")
        compare_result = cfg.get("compare_result")
        para1 = cfg.get("para1")
        para2 = cfg.get("para2")
        num = 0

        for loop in range(10):
            self.sensorImpl.logger.info("")
            self.sensorImpl.logger.info("Loop %d/10 frequency_gyroscope_ui" %
                                        (loop + 1))
            if self.sensorImpl.excute(fileName, catagory, sensorName,
                                      compare_result, para1, para2, freq_type,
                                      sensor_type) is False:
                num += 1
        if num > 5:
            assert False
class range_linear_accelerometer(UIATestBase):
    def setUp(self):
        self._test_name = __name__
        self.apk1_package = "android.intel.umg.sensor.test"
        self.apk2_package = "android.intel.umg.sensor"
        print
        print "[Setup]: %s" % self._test_name
        self.sensorImpl = SensorImpl()
        # self.cfg_file = self.sensorImpl.match_configuration()
        self.cfg_file = "tests.tablet.sensor.conf"
        self.sensorImpl.install_app(
            self.config.read(self.cfg_file, "artifactory"), "location_apks",
            "testprjsenortest", self.apk1_package)
        self.sensorImpl.install_app(
            self.config.read(self.cfg_file, "artifactory"), "location_apks",
            "sensortest", self.apk2_package)
        super(range_linear_accelerometer, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(range_linear_accelerometer, self).tearDown()

    def test_range_linear_accelerometer(self):
        '''
        check the max range of linear_accelerometer
        '''
        fileName = os.path.split(os.path.realpath(__file__))[1]
        type = fileName.split('_')[0].strip()
        sensor_type = fileName.split('_')[1].strip() + fileName.split(
            '_')[2].split('.')[0].strip()

        cfg = self.config.read(self.cfg_file, 'range_linear_accelerometer')
        catagory = cfg.get("catagory")
        sensorName = cfg.get("sensorname")
        compare_result = cfg.get("compare_result")
        para1 = cfg.get("para1")
        para2 = cfg.get("para2")
        num = 0

        for loop in range(10):
            self.sensorImpl.logger.info("")
            self.sensorImpl.logger.info(
                "Loop %d/10 range_linear_accelerometer" % (loop + 1))
            if self.sensorImpl.excute(fileName, catagory, sensorName,
                                      compare_result, para1, para2, type,
                                      sensor_type) is False:
                num += 1
        if num > 5:
            assert False
class concurrent_rotation_vector_fastest(UIATestBase):
    def setUp(self):
        self._test_name = __name__
        self.apk1_package = "android.intel.umg.sensor.test"
        self.apk2_package = "android.intel.umg.sensor"
        print
        print "[Setup]: %s" % self._test_name
        self.sensorImpl = SensorImpl()
        # self.cfg_file = self.sensorImpl.match_configuration()
        self.cfg_file = "tests.tablet.sensor.conf"
        self.sensorImpl.install_app(
            self.config.read(self.cfg_file, "artifactory"), "location_apks",
            "testprjsenortest", self.apk1_package)
        self.sensorImpl.install_app(
            self.config.read(self.cfg_file, "artifactory"), "location_apks",
            "sensortest", self.apk2_package)
        super(concurrent_rotation_vector_fastest, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(concurrent_rotation_vector_fastest, self).tearDown()

    def test_concurrent_rotation_vector_fastest(self):
        '''
        test the freq and delay for concurrent fastest mode rotation_vector
        '''
        fileName = os.path.split(os.path.realpath(__file__))[1]
        freq_type = fileName.split('_')[3].split('.')[0].strip()

        cfg = self.config.read(self.cfg_file,
                               'concurrent_rotation_vector_fastest')
        catagory = cfg.get("catagory")
        sensorName = cfg.get("sensorname")
        compare_result = cfg.get("compare_result")
        para1 = cfg.get("para1")
        para2 = cfg.get("para2")
        num = 0

        for loop in range(10):
            self.sensorImpl.logger.info("")
            self.sensorImpl.logger.info(
                "Loop %d/10 concurrent_rotation_vector_fastest" % (loop + 1))
            if self.sensorImpl.excute(fileName, catagory, sensorName,
                                      compare_result, para1, para2,
                                      freq_type) is False:
                num += 1
        if num > 5:
            assert False