Exemplo n.º 1
0
 def setUp(self):
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self.energy = Energy()
     self.tmp_dir = get_tmp_dir()
     self.energy.set_screen_status("on")
     self.energy.unlock_screen()
     DisplaySetting().set_sleep_mode("30 minutes")
     super(PowerShowBatteryIcon, self).setUp()
Exemplo n.º 2
0
 def test_sdp_charger_insertion_when_device_on(self):
     """
     SDP charger insertion when device is on
     """
     print "[RunTest]: %s" % self.__str__()
     from testlib.em.tools import get_tmp_dir, remove_tmp_dir
     from testlib.em.crop_battery_icon import CropBatteryImage
     rect = BatterySetting().get_status_bar_rect()
     tmp_dir = get_tmp_dir()
     screenshot = os.path.join(tmp_dir, "screenshot.png")
     self.energy.capture_screen(screenshot)
     crop_battery = CropBatteryImage(screenshot, rect)
     crop_battery.check_charging_status_by_icon(True)
     remove_tmp_dir(tmp_dir)
Exemplo n.º 3
0
 def setUp(self):
     self._test_name = __name__
     print
     print "[Setup]: %s" % self._test_name
     self.glb = GLBenchmark()
     self.glb.adb_root()
     self.glb.testDevice.close_background_apps()
     self.tmp_dir = get_tmp_dir()
     self.device_script = "cat_cpu_gpu.sh"
     self.device_exec_dir = "/data/local/tmp/"
     self.csv_result = "out_" + time.strftime("%y%m%d_%H%M%S") + ".csv"
     #self.csv_result = "out_171113_165905.csv"
     self.device_result_path = os.path.join(self.device_exec_dir, self.csv_result)
     self.local_result_path = os.path.join(self.tmp_dir, self.csv_result)
     self.np = NohupProcess(self.glb.testDevice, self.device_script, self.device_exec_dir, self.csv_result)
Exemplo n.º 4
0
 def test_power_icon_check_charger_resume(self):
     print "[RunTest]: %s" % self.__str__()
     from testlib.em.tools import get_tmp_dir, remove_tmp_dir
     from testlib.em.crop_battery_icon import CropBatteryImage
     import os
     stat_inc = self.s0ix.suspend_resume()
     assert stat_inc > 0, "Not enter S3"
     tmp_dir = get_tmp_dir()
     screenshot = os.path.join(tmp_dir, "screenshot.png")
     rect = DisplaySetting().get_status_bar_rect()
     self.s0ix.capture_screen(screenshot)
     crop_battery = CropBatteryImage(screenshot, rect)
     crop_battery.crop_battery()
     crop_battery.check_charging_status_by_icon(True)
     remove_tmp_dir(tmp_dir)
Exemplo n.º 5
0
 def test_power_show_charging_icon(self):
     """
     Test power show charging icon
     """
     print "[RunTest]: %s" % self.__str__()
     from testlib.em.tools import get_tmp_dir, remove_tmp_dir
     from testlib.em.crop_battery_icon import CropBatteryImage
     import os
     tmp_dir = get_tmp_dir()
     screenshot = os.path.join(tmp_dir, "screenshot.png")
     rect = DisplaySetting().get_status_bar_rect()
     self.energy.capture_screen(screenshot)
     crop_battery = CropBatteryImage(screenshot, rect)
     crop_battery.crop_battery()
     crop_battery.check_charging_status_by_icon(True)
     remove_tmp_dir(tmp_dir)
Exemplo n.º 6
0
 def check_low_battery_icon(self, level):
     tmp_dir = get_tmp_dir()
     screenshot = os.path.join(tmp_dir, "screenshot.png")
     rect = Settings().get_status_bar_rect()
     # try 5 times
     retry = 5
     for i in range(retry):
         try:
             self.energy.set_virtual_battery_level(level)
             self.energy.capture_screen(screenshot)
             crop_battery = CropBatteryImage(screenshot, rect)
             crop_battery.crop_battery()
             crop_battery.check_red_exclamation_in_battery_icon(True)
             break
         except Exception as e:
             print e.message
     else:
         assert False
     USBCut().cut(3)
Exemplo n.º 7
0
 def test_screen_wake_after_usb_plugged(self):
     """
     Screen wake after usb plugged
     """
     print "[RunTest]: %s" % self.__str__()
     from testlib.em.basic_ui import LockScreenUI
     from testlib.em.crop_battery_icon import CropBatteryImage
     from testlib.em.tools import get_tmp_dir, remove_tmp_dir
     from testlib.em.usb_cut import USBCut
     lockscreen = LockScreenUI()
     lockscreen.lock_screen()
     USBCut().cut(20)
     assert self.energy.get_screen_status()
     tmp_dir = get_tmp_dir()
     screenshot = os.path.join(tmp_dir, "screenshot.png")
     rect = lockscreen.get_battery_icon_rect()
     self.energy.set_screen_status("on")
     time.sleep(2)
     self.energy.capture_screen(screenshot)
     crop_battery = CropBatteryImage(screenshot, rect)
     crop_battery.check_charging_status_by_icon(True)
     remove_tmp_dir(tmp_dir)
     time.sleep(20)
     self.energy.verify_screen_status("off")