How to use getMaxXY method in Airtest

Best Python code snippet using Airtest

clitodo.py

Source: clitodo.py Github

copy

Full Screen

...31 for i in range(-1, 8):32 for y in range(-1, 8):33 curses.init_pair(cpt, y, i)34 cpt += 135 def getMaxXY(self):36 """37 This funtion return Max x y coordinate of the terminal screen38 :returns: a dictionary with "x" and "y" 39 """40 return(self.max)41 def stop(self):42 """43 This function quit cleanly the terminal.44 """45 curses.endwin()46 def main_window(self, menus):47 """48 This function print a list of menus49 Perhaps we can change the name because nothing is hardcoded50 maybe print_windows51 :param menus:memus52 :type menu:A list of Menu53 :returns: None54 """55 self.screen.clear()56 for menu in menus:57 self.print_menu(menu)58 self.print_bottom_msg()59 def print_menu(self, menu):60 """61 This is a "meta" function which print a menu62 :param menu:menu63 :type menu: Menu64 """65 #logging.debug("print menu >"+menu.title)66 if type(MultiMenu([])) == type(menu):67 self.print_action_menu(menu)68 elif isinstance(menu, TacheMenu):69 self.print_tache_menu(menu)70 elif isinstance(menu, TagMenu):71 self.print_tag_menu(menu)72 def print_tache_menu(self, menu):73 """74 This is a "meta" function which print a menu75 :param menu:menu76 :type menu: Menu77 """78 tX, tY, dX, dY = menu.entoureMe()79 # + 12t o be patched :80 # Probleme : tg length81 self.print_rectangle(tX, tY, dX + 12, dY)82 self.screen.addstr(menu.topY, menu.topX, menu.title)83 for indice, item in enumerate(list(menu.items)):84 self.print_item(menu, item, indice)85 tagsMenus = menu.getSubMenu()86 self.print_tacheTagMenu(tagsMenus[indice])87 #self.print_item(menu.getSubMenu()[indice], item, indice)88 def print_tacheTagMenu(self, tacheTagMenu):89 if tacheTagMenu.getMenuLength() > 0:90 i = 091 for item in tacheTagMenu.getItems():92 self.screen.addstr(tacheTagMenu.getFirstItemY() + i,93 tacheTagMenu.getFirstItemX(), " ")94 x, y = tacheTagMenu.getItemPosition(i)95 if i == tacheTagMenu.getSelectedIndex():96 self.screen.addstr(y, x, ">"+item.name,97 curses.color_pair(13)98 )99 else:100 self.screen.addstr(y, x, " ")101 self.screen.addstr(y,102 x+1,103 item.name,104 curses.color_pair(13)105 )106 i += 1107 def print_tag_menu(self, menu):108 self.screen.addstr(menu.topY, menu.topX, menu.title)109 tX, tY, dX, dY = menu.entoureMe()110 self.print_rectangle(tX, tY, dX + 12, dY)111 for indice, item in enumerate(list(menu.items)):112 self.print_item(menu, item, indice)113 def print_action_menu(self, menu):114 tX, tY, dX, dY = menu.entoureMe()115 #logging.INFO("print_action_menu Max X" + self.getMaxXY()["x"] +116 # " Max Y"+self.getMaxXY()["y"])117 logging.info("print_action_menu :" +118 " Top x " + str(tX) +119 " Top Y" + str(tY) +120 " Down X" + str(dX) +121 " Down Y" + str(dY) +122 " Max Y"+str(self.getMaxXY()["y"]))123 #si le bas du rectangle deplace la fenetre124 if dY >= self.getMaxXY()["y"]:125 tY = tY - (dY - self.getMaxXY()["y"] + 1)126 dY = dY - (dY - self.getMaxXY()["y"] + 1)127 menu.setTopY(tY)128 logging.info("print_action_menu :" +129 " Top x " + str(tX) +130 " Top Y" + str(tY) +131 " Down X" + str(dX) +132 " Down Y" + str(dY) +133 " Max Y"+str(self.getMaxXY()["y"]))134 self.print_rectangle(tX, tY, dX, dY)135 self.screen.addstr(menu.topY, menu.topX, menu.getTitle())136 for indice, item in enumerate(list(menu.items)):137 self.print_item(menu, item, indice)138 def print_item(self, menu, item, index):139 cleanStr = (menu.maxItemWidth - len(str(item)))*" "140 # logging.debug("[print_item] item "+str(index))141 x, y = menu.getItemPosition(index)142 if menu.isSelected(index):143 self.screen.addstr(y, x, menu.getSelector() + str(item),144 curses.A_STANDOUT145 )146 else:147 self.screen.addstr(y, x, len(menu.getSelector())*" " + str(item))148 if len(cleanStr) > 0:149 endLine = menu.firstItemX +\150 len(menu.getSelector()) +\151 len(str(item))152 self.screen.addstr(menu.firstItemY + index,153 endLine,154 cleanStr,155 curses.color_pair(1)156 )157 self.screen.refresh()158 def redraw_menu(self, menu):159 # if len(cleanStr) > 0:160 # endLine = menuself.firstItemX + len(menu.getSelector()) + len(str(item))161 # self.screen.addstr(menu.firstItemY + index, endLine, cleanStr)162 if menu.getPreviousIndex() >= 0:163 self.screen.addstr(menu.firstItemY + menu.getPreviousIndex(),164 menu.firstItemX,165 len(menu.getSelector())*" " +166 str(menu.getPrevious()))167 if menu.getSelectedIndex() >= 0:168 self.screen.addstr(menu.firstItemY + menu.getSelectedIndex(),169 menu.firstItemX,170 menu.getSelector() + str(menu.getSelected()),171 curses.A_STANDOUT172 )173 def print_tags(ecran, x, y, tache):174 ltTags = tache.get_tags()175 if len(ltTags) > 0:176 i = 0177 for tag in ltTags:178 ecran.addstr(y, x + i, " ")179 ecran.addstr(y, x + i, tag.name, curses.color_pair(1))180 i = len(tag.name) + 1181 def print_rectangle(self, tlX, tlY, drX, drY):182 logging.info("print_rectangle :" +183 " Top x " + str(tlX) +184 " Top Y" + str(tlY) +185 " Down X" + str(drX) +186 " Down Y" + str(drY) +187 " Max Y"+str(self.getMaxXY()["y"]) +188 " Max X"+str(self.getMaxXY()["x"])189 )190 try:191 rectangle(self.screen, tlY, tlX, drY, drX)192 except Exception as e:193 logging.info(e)194 self.screen.refresh()195 def print_ajouter_tache(self):196 self.screen.addstr(self.max["y"]-6, 1, "Ajouter une tache :")197 editwin = curses.newwin(1,198 self.max["x"]-6,199 self.max["y"]-4,200 1201 )202 rectangle(self.screen,...

Full Screen

Full Screen

13.py

Source: 13.py Github

copy

Full Screen

...11 dots.add(tuple(map(int, line.split(','))))12 else:13 fold_instructions.append(line.split('fold along ')[1].split('='))14 return dots, fold_instructions15def getMaxXY(dots):16 max_x = 017 max_y = 018 for (x, y) in dots:19 if x > max_x:20 max_x = x21 if y > max_y:22 max_y = y23 return max_x, max_y24def printMatrix(dots):25 max_x, max_y = getMaxXY(dots)26 # y = rows27 # x = cols28 for y in range(max_y + 1):29 row = f"{y} "30 for x in range(max_x + 1):31 if (x, y) in dots:32 row += ('#')33 else:34 row += ('.')35 print(row)36 print()37def foldPageAtX(dots, X):38 new_dots = set()39 for (x, y) in dots:...

Full Screen

Full Screen

day13.py

Source: day13.py Github

copy

Full Screen

1from utils import *2def drawDots(coords):3 maxX, maxY = getMaxXY(coords)4 paper = [['.']*(maxX+1) for _ in range(maxY+1)] 5 for coord in coords:6 paper[coord[1]][coord[0]] = '#'7 return paper8def getMaxXY(coords):9 maxX = 010 maxY = 011 for coord in coords:12 maxX = coord[0] if coord[0] > maxX else maxX13 maxY = coord[1] if coord[1] > maxY else maxY14 return maxX, maxY15def foldPaper(currentFold, coords):16 foldDir = currentFold[0]17 foldVal = int(currentFold[1])18 for ii in range(len(coords)):19 if foldDir == 'y':20 if coords[ii][1] > foldVal:21 coords[ii][1] -= (coords[ii][1] - foldVal) * 222 else:...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

QA’s and Unit Testing – Can QA Create Effective Unit Tests

Unit testing is typically software testing within the developer domain. As the QA role expands in DevOps, QAOps, DesignOps, or within an Agile team, QA testers often find themselves creating unit tests. QA testers may create unit tests within the code using a specified unit testing tool, or independently using a variety of methods.

LIVE With Automation Testing For OTT Streaming Devices ????

People love to watch, read and interact with quality content — especially video content. Whether it is sports, news, TV shows, or videos captured on smartphones, people crave digital content. The emergence of OTT platforms has already shaped the way people consume content. Viewers can now enjoy their favorite shows whenever they want rather than at pre-set times. Thus, the OTT platform’s concept of viewing anything, anytime, anywhere has hit the right chord.

Why Agile Is Great for Your Business

Agile project management is a great alternative to traditional methods, to address the customer’s needs and the delivery of business value from the beginning of the project. This blog describes the main benefits of Agile for both the customer and the business.

Options for Manual Test Case Development & Management

The purpose of developing test cases is to ensure the application functions as expected for the customer. Test cases provide basic application documentation for every function, feature, and integrated connection. Test case development often detects defects in the design or missing requirements early in the development process. Additionally, well-written test cases provide internal documentation for all application processing. Test case development is an important part of determining software quality and keeping defects away from customers.

Test strategy and how to communicate it

I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful