How to use _angleXY method in fMBT

Best Python code snippet using fMBT_python

fmbtuinput.py

Source:fmbtuinput.py Github

copy

Full Screen

...788 def setScreenSize(self, (width, height)):789 self._screenW, self._screenH = (width, height)790 def setScreenAngle(self, angle):791 self._screenA = angle792 def _angleXY(self, x, y, angle=None):793 """return x, y in screen without rotation"""794 if angle == None:795 angle = self._screenA796 sw, sh = self._screenW, self._screenH797 if angle:798 while angle < 0:799 angle += 360800 while angle > 360:801 angle -= 360802 if angle == 90:803 ax = self._screenH - y804 ay = x805 sw, sh = self._screenH, self._screenW806 elif angle == 180:807 ax = self._screenH - x808 ay = self._screenW - y809 elif angle == 270:810 ax = y811 ay = self._screenW - x812 sw, sh = self._screenH, self._screenW813 else:814 raise ValueError('Illegal screen rotation angle %s' %815 (self._screenA,))816 else:817 ax, ay = x, y818 return (sw, sh, ax, ay)819 def _tXY(self, x, y):820 """convert x, y to touch screen coordinates"""821 if self._screenW and self._maxX and self._screenH and self._maxY:822 w, h, x, y = self._angleXY(x, y)823 x = int((self._maxX * x) / w)824 y = int((self._maxY * y) / h)825 return (x, y)826 else:827 return (x, y)828 def absToScreenXY(self, absX, absY):829 if self._screenW and self._maxX and self._screenH and self._maxY:830 x = int(self._screenW * absX / self._maxX)831 y = int(self._screenH * absY / self._maxY)832 if self._screenA:833 _, _, x, y = self._angleXY(x, y, -self._screenA)834 return (x, y)835 else:836 return (absX, absY)837 def _startTracking(self, finger, x, y):838 self._mtTrackingId += 1839 usedSlots = set([self._mtTracking[fngr][0]840 for fngr in self._mtTracking])841 for freeSlot in xrange(16):842 if not freeSlot in usedSlots:843 break844 else:845 raise ValueError("No free slots for multitouch")846 self._mtTracking[finger] = [freeSlot, self._mtTrackingId, x, y]847 self._sendSlot(finger)...

Full Screen

Full Screen

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 fMBT 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