How to use _sendSlot method in fMBT

Best Python code snippet using fMBT_python

fmbtuinput.py

Source:fmbtuinput.py Github

copy

Full Screen

...843 break844 else:845 raise ValueError("No free slots for multitouch")846 self._mtTracking[finger] = [freeSlot, self._mtTrackingId, x, y]847 self._sendSlot(finger)848 self.send("EV_ABS", "ABS_MT_TRACKING_ID", self._mtTrackingId)849 tx, ty = self._tXY(x, y)850 self.send("EV_ABS", "ABS_MT_POSITION_X", tx)851 self.send("EV_ABS", "ABS_MT_POSITION_Y", ty)852 return self._mtTrackingId853 def _stopTracking(self, finger):854 self._sendSlot(finger)855 self.send("EV_ABS", "ABS_MT_TRACKING_ID", -1)856 del self._mtTracking[finger]857 def _sendSlot(self, finger):858 slot = self._mtTracking[finger][0]859 self.send("EV_ABS", "ABS_MT_SLOT", slot)860 def tap(self, x, y, pressure=None):861 self.pressFinger(-1, x, y, pressure)862 self.releaseFinger(-1)863 # Compatibility API to allow using a Touch almost like a Mouse864 def move(self, x, y):865 if len(self._mtTracking.keys()) == 0:866 self._hoover = (x, y)867 else:868 finger = sorted(self._mtTracking.keys())[0]869 return self.moveFinger(finger, x, y)870 def press(self, finger):871 return self.pressFinger(finger, *self._hoover)872 def release(self, finger):873 return self.releaseFinger(finger)874 # end of compatibility API875 # Multi-touch API876 def pressFinger(self, finger, x, y, pressure=None):877 """Add a finger to current multitouch gesture. If multitouch gesture878 is not started, it starts automatically.879 """880 if self._multiTouch and not finger in self._mtTracking:881 self._startTracking(finger, x, y)882 if pressure != None and self._maxPressure != None:883 self.send("EV_ABS", "ABS_PRESSURE", pressure)884 self.send("EV_KEY", "BTN_TOUCH", 1)885 tx, ty = self._tXY(x, y)886 self.send("EV_ABS", "ABS_X", tx)887 self.send("EV_ABS", "ABS_Y", ty)888 self.sync()889 def releaseFinger(self, finger):890 """Remove a finger from current multitouch gesture. When last finger891 is raised from the screen, multitouch gesture ends."""892 if self._multiTouch:893 self._stopTracking(finger)894 self.send("EV_KEY", "BTN_TOUCH", 0)895 for fngr in self._mtTracking:896 # still some finger pressed, non-multitouch reader gets897 # coordinates from one of those898 tx, ty = self._tXY(self._mtTracking[fngr][2],899 self._mtTracking[fngr][3])900 self.send("EV_ABS", "ABS_X", tx)901 self.send("EV_ABS", "ABS_Y", ty)902 break # only one coordinates will be sent.903 self.sync()904 def moveFinger(self, finger, x, y):905 """Move a finger in current multitouch gesture"""906 self._sendSlot(finger)907 tx, ty = self._tXY(x, y)908 if self._multiTouch:909 self.send("EV_ABS", "ABS_MT_POSITION_X", tx)910 self.send("EV_ABS", "ABS_MT_POSITION_Y", ty)911 self.send("EV_ABS", "ABS_X", tx)912 self.send("EV_ABS", "ABS_Y", ty)913 self._mtTracking[finger][2] = x # last X914 self._mtTracking[finger][3] = y # last Y915 self.sync()916class Keyboard(InputDevice):917 def __init__(self):918 InputDevice.__init__(self)919 def create(self, name="Virtual fMBT Keyboard",920 vendor=0xf4b7, product=0x4ebd, version=1):...

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