Example #1
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)
Example #2
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)
Example #3
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)
Example #4
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")
 def tearDown(self):
     print "[Teardown]: %s" % self._test_name
     remove_tmp_dir(self.tmp_dir)
     super(PowerShowBatteryStatus, self).tearDown()