def testOpenWithR(self): iconobj = self.ddedockobject.child(self.icon_deepinappstore) self.assertTrue(iconobj) iconobj.click(3) utils.keySingle('r') sleep(4) win = utils.findWindow(self.window_name) self.assertTrue(win)
def testUnDock(self): iconobj = self.ddedockobject.child(self.icon_deepinappstore) self.assertTrue(iconobj) iconobj.click(3) utils.keySingle('u') sleep(3) iconobj_delete = self.ddedockobject.child(self.icon_deepinappstore) self.assertTrue(iconobj_delete.position == (0, 0)) self.assertTrue(iconobj_delete.size == (0, 0))
def testRightClickBack(self): utils.keySingle(utils.k.windows_l_key) utils.keyTypeString(self.launchername) utils.m.click(253, 170, 2) sleep(2) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) iconobj = self.ddedockobject.child(self.icon_deepinappstore) self.assertTrue(iconobj) self.assertTrue(iconobj.position != (0, 0)) self.assertTrue(iconobj.size != (0, 0))
def testChangeDisplayModeToFashion(self): utils.m.click(int(utils.resolution.width/2), utils.resolution.height, 2) utils.dockmenu.findMainWindow() utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) displaymode = utils.getDdeDockDisplayMode() self.assertTrue(utils.dock.displaymode_fashion == displaymode) position = utils.getDdeDockPosition() self.assertTrue(utils.dock.position_bottom == position) hidestate = utils.getDdeDockHideState() self.assertTrue(utils.dock.hidestate_show == hidestate) main_window = self.ddedockobject.child(self.dock_mainwindow) (width, height) = main_window.size self.assertTrue(width > 0) self.assertTrue(height > 0)
def testSetDock(self): utils.keySingle(utils.k.windows_l_key) try: launcherwin = utils.findWindow("dde-launcher") except: self.assertTrue(False, "Can't open dde-launcher") utils.keyTypeString(self.filemanagerlauncher) app = launcher.getAppObj(self.filemanagericonname) app.click(3) try: dockmenuapp = root.application('deepin-menu', '/usr/lib/deepin-menu') dockmenu = dockmenuapp.child(utils.desktop.desktopmenuname) except: self.assertTrue(False, "Can't find desktopmenu") utils.keySingle('c')
def testCloseGedit(self): icongedit = self.ddedockobject.child(self.gediticonname) icongedit.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) geditwin1 = utils.findWindow(self.dock.string_Text_Editor_Window4, mode="nowait", comparetype="notequal") geditwin2 = utils.findWindow(self.dock.string_Text_Editor_Window4, mode="nowait", comparetype="notequal") geditwin3 = utils.findWindow(self.dock.string_Text_Editor_Window4, mode="nowait", comparetype="notequal") geditwin4 = utils.findWindow(self.dock.string_Text_Editor_Window4, mode="nowait", comparetype="notequal") self.assertTrue(None == geditwin1) self.assertTrue(None == geditwin2) self.assertTrue(None == geditwin3) self.assertTrue(None == geditwin4)
def testOpenRun(self): try: iconfilemanager = self.ddedockobject.child(self.filemanagericonname) except: self.assertTrue(False, "Can't find the file manager icon on the Dock") iconfilemanager.click(3) try: dockmenuapp = root.application('deepin-menu', '/usr/lib/deepin-menu') dockmenu = dockmenuapp.child(utils.dock.dockmenuname) except: self.assertTrue(False, "Can't find dockmenu") self.assertTrue(dockmenu.position[0] > 1) self.assertTrue(dockmenu.position[1] > 1) self.assertTrue(dockmenu.size[0] > 1) self.assertTrue(dockmenu.size[1] > 1) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key)
def testOpenDeepinScreenshotFullScreen(self): home = os.path.expanduser("~") desktoppath = home + "/Desktop" pngscreen = glob.glob(desktoppath + "/" + self.dock.string_Deepin_Screenshot_png) for png in pngscreen: os.remove(png) iconscreenshot = self.ddedockobject.child(self.screenshoticonname) iconscreenshot.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) max_delay = 10 while True: time.sleep(1) max_delay = max_delay - 1 png = glob.glob(desktoppath + "/" + self.dock.string_Deepin_Screenshot_png) if len(png) > 0: self.assertTrue(True) for f in png: os.remove(f) break if 0 == max_delay and 0 == len(png): self.assertTrue(False, "Icon Menu FullScreen doesn't work") break
def testSelectMenuCloseAll(self): try: iconfilemanager = self.ddedockobject.child( self.filemanagericonname) except: self.assertTrue(False, "Can't find the file manager icon on the Dock") iconfilemanager.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key)
def testDragIconToDock(self): utils.keySingle(utils.k.windows_l_key) try: launcherwin = utils.findWindow("dde-launcher") except: self.assertTrue(False, "Can't open dde-launcher") utils.keyTypeString("deepin-screenshot") try: launcher_icon = self.ddedockobject.child("Launcher") except: self.assertTrue(False, "Can't find launcher icon") apps = launcher.getLauncherAllApps() fromXY = launcher.getAppCenterCoor(apps[0]) toXY = utils.getDockIconCenterPoint(launcher_icon) utils.mouseDragIconToDock((int(fromXY[0]), int(fromXY[1])), toXY) time.sleep(1) self.testDeepinScreenshotExistOnDock() time.sleep(1)
def testDragBack(self): utils.keySingle(utils.k.windows_l_key) utils.keyTypeString(self.launchername) #utils.keySingle(utils.k.enter_key) utils.m.move(253, 170) sleep(3) utils.m.press(253, 170) sleep(3) while utils.m.position()[0] < 427: utils.m.move((utils.m.position()[0]+1), utils.m.position()[1]) while utils.m.position()[1] < 873: utils.m.move(utils.m.position()[0], (utils.m.position()[1]+1)) while utils.m.position()[0] < 477: sleep(0.03) utils.m.move((utils.m.position()[0]+1), utils.m.position()[1]) #utils.m.move(427, 873) sleep(2) utils.m.release(477, 873) sleep(3) iconobj = self.ddedockobject.child(self.icon_deepinappstore) self.assertTrue(iconobj) self.assertTrue(iconobj.position != (0, 0)) self.assertTrue(iconobj.size != (0, 0))
def testChangeBackDisplayMode(self): utils.m.click(int(utils.resolution.width/2), utils.resolution.height, 2) utils.dockmenu.findMainWindow() utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) displaymode = utils.getDdeDockDisplayMode() self.assertTrue(utils.dock.displaymode_efficient == displaymode) position = utils.getDdeDockPosition() self.assertTrue(utils.dock.position_bottom == position) hidestate = utils.getDdeDockHideState() self.assertTrue(utils.dock.hidestate_show == hidestate) main_window = self.ddedockobject.child(self.dock_mainwindow) (width, height) = main_window.size self.assertTrue(width > 0) self.assertTrue(height > 0)
def testChangePositionLeft(self): try: dock = self.ddedockobject.child(utils.dock.mainwindowname) except: self.assertTrue(False, "Can't find the dock mainwindowname.") (xp, yp) = dock.position (width, height) = dock.size xy = (xp, int(yp + height/2)) self.testRightClickOnDock(xy[0], xy[1]) self.testDockMenuExist() utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.right_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) try: dock = self.ddedockobject.child(utils.dock.mainwindowname) except: self.assertTrue(False, "Can't find the dock mainwindowname.") (xp, yp) = dock.position (width, height) = dock.size self.assertTrue(width > 1) self.assertTrue(height > 1) self.assertTrue(0 == xp)
def tearDownClass(cls): utils.keySingle(utils.k.windows_l_key)
def testChangeIconSizeToSmall(self): utils.m.click(int(utils.resolution.width/2), utils.resolution.height, 2) utils.dockmenu.findMainWindow() utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.left_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.left_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) dbus_iconsize = utils.getDdeDockIconSize() self.assertTrue(dbus_iconsize == utils.dock.iconsize_small)
def testOpenGedit(self): icongedit = self.ddedockobject.child(self.gediticonname) icongedit.click() geditwin1 = utils.findWindow(self.dock.string_Text_Editor_Window1, comparetype="notequal") self.assertTrue(geditwin1 != None) icongedit.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) geditwin2 = utils.findWindow(self.dock.string_Text_Editor_Window2, comparetype="notequal") self.assertTrue(geditwin2 != None) icongedit.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) geditwin3 = utils.findWindow(self.dock.string_Text_Editor_Window3, comparetype="notequal") self.assertTrue(geditwin3 != None) icongedit.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) geditwin4 = utils.findWindow(self.dock.string_Text_Editor_Window4, comparetype="notequal") self.assertTrue(geditwin4 != None)
def testChangePositionToLeft(self): utils.m.click(int(utils.resolution.width/2), utils.resolution.height, 2) utils.dockmenu.findMainWindow() utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.left_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) defaultdisplaymode = utils.getDdeDockDisplayMode() self.assertTrue(utils.dock.displaymode_fashion == defaultdisplaymode) defaultposition = utils.getDdeDockPosition() self.assertTrue(utils.dock.position_left == defaultposition) defaulthidestate = utils.getDdeDockHideState() self.assertTrue(utils.dock.hidestate_show == defaulthidestate) main_window = self.ddedockobject.child(self.dock_mainwindow) (width, height) = main_window.size self.assertTrue(width > 0) self.assertTrue(height > 0) (x, y) = main_window.position self.assertTrue(0 == x)
def testChangeIconSizeToMedium(self): utils.m.click(int(utils.resolution.width / 2), utils.resolution.height, 2) utils.dockmenu.findMainWindow() utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.left_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.left_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) dbus_iconsize = utils.getDdeDockIconSize() self.assertTrue(dbus_iconsize == utils.dock.iconsize_medium)
def testOpenRun(self): try: iconfilemanager = self.ddedockobject.child( self.filemanagericonname) except: self.assertTrue(False, "Can't find the file manager icon on the Dock") iconfilemanager.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) iconfilemanager.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) filemanagerwinlist = utils.findWindowList(self.filemanagerwindowname) self.assertTrue(2 == len(filemanagerwinlist)) iconfilemanager.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) win = utils.findWindow(self.filemanagerwindowname, mode="nowait") self.assertTrue(None == win)
def tearDownClass(cls): utils.setDdeDockDisplayMode(cls.defaultdisplaymode) utils.setDdeDockPosition(cls.defaultposition) utils.keySingle(utils.k.windows_l_key)
def testCloseLauncher(self): utils.keySingle(utils.k.windows_l_key) time.sleep(1)
def testOpenDeepinScreenshotRun(self): iconscreenshot = self.ddedockobject.child(self.screenshoticonname) iconscreenshot.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key)
def testChangePositionToLeft(self): utils.m.click(int(utils.resolution.width / 2), utils.resolution.height, 2) utils.dockmenu.findMainWindow() utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.left_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) defaultdisplaymode = utils.getDdeDockDisplayMode() self.assertTrue(utils.dock.displaymode_fashion == defaultdisplaymode) defaultposition = utils.getDdeDockPosition() self.assertTrue(utils.dock.position_left == defaultposition) defaulthidestate = utils.getDdeDockHideState() self.assertTrue(utils.dock.hidestate_show == defaulthidestate) main_window = self.ddedockobject.child(self.dock_mainwindow) (width, height) = main_window.size self.assertTrue(width > 0) self.assertTrue(height > 0) (x, y) = main_window.position self.assertTrue(0 == x)
def testUnDockGedit(self): try: icongeidt = self.ddedockobject.child(self.geidticonname) except: self.assertTrue(False, "Can't find the geidt icon on the Dock") icongeidt.click(3) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key)