How to use adjustParameters method in fMBT

Best Python code snippet using fMBT_python

parallaxslide.py

Source:parallaxslide.py Github

copy

Full Screen

...76 self.connect(self.iconTimeLine, SIGNAL("frameChanged(int)"), self, SLOT("moveIcons(int)"))77 self.iconTimeLine.setCurveShape(QTimeLine.EaseInOutCurve)78 79 self.connect(self.backgroundTimeLine, SIGNAL("frameChanged(int)"), self, SLOT("moveBackground(int)"))80 self.connect(self.backgroundTimeLine, SIGNAL("finished()"), self, SLOT("adjustParameters()"))81 self.backgroundTimeLine.setCurveShape(QTimeLine.EaseInOutCurve)82 83 self.controls = Ui_ControlsForm()84 85 toolWidget = QWidget(self)86 toolWidget.setWindowFlags(Qt.Tool | Qt.WindowTitleHint)87 self.controls.setupUi(toolWidget)88 toolWidget.show()89 90 self.connect(self.controls.speedSlider, SIGNAL("valueChanged(int)"),91 self, SLOT("adjustParameters()"))92 self.connect(self.controls.normalButton, SIGNAL("clicked()"),93 self, SLOT("adjustParameters()"))94 self.connect(self.controls.parallaxButton, SIGNAL("clicked()"),95 self, SLOT("adjustParameters()"))96 self.connect(self.controls.leftButton, SIGNAL("clicked()"),97 self, SLOT("slideLeft()"))98 self.connect(self.controls.rightButton, SIGNAL("clicked()"),99 self, SLOT("slideRight()"))100 101 self.slideBy(-320)102 self.adjustParameters()103 104 @pyqtSignature("")105 def slideLeft(self):106 107 if self.iconTimeLine.state() != QTimeLine.NotRunning:108 return109 110 if self.ofs > -640:111 self.slideBy(-320)112 113 @pyqtSignature("")114 def slideRight(self):115 116 if self.iconTimeLine.state() != QTimeLine.NotRunning:117 return118 119 if self.ofs < 0:120 self.slideBy(320)121 122 @pyqtSignature("int")123 def slideBy(self, dx):124 125 iconStart = self.ofs126 iconEnd = self.ofs + dx127 self.iconTimeLine.setFrameRange(iconStart, iconEnd)128 self.iconTimeLine.start()129 130 backgroundStart = -320 - int((-320 - iconStart)/self.factor)131 backgroundEnd = -320 - int((-320 - iconEnd)/self.factor)132 self.backgroundTimeLine.setFrameRange(backgroundStart, backgroundEnd)133 self.backgroundTimeLine.start()134 135 self.ofs = iconEnd136 137 @pyqtSignature("bool")138 def setParallaxEnabled(self, p):139 140 if p:141 self.factor = 2142 self.setWindowTitle("Sliding - Parallax mode")143 else:144 self.factor = 1145 self.setWindowTitle("Sliding - Normal mode")146 147 def keyPressEvent(self, event):148 149 if event.key() == Qt.Key_Left:150 self.slideLeft()151 if event.key() == Qt.Key_Right:152 self.slideRight()153 154 @pyqtSignature("int")155 def moveIcons(self, x):156 157 i = 0158 for icon in self.icons:159 icon.setPos(320 + x+i*64, icon.pos().y())160 i += 1161 162 @pyqtSignature("int")163 def moveBackground(self, x):164 165 self.background.setPos(x, self.background.pos().y())166 167 @pyqtSignature("")168 def adjustParameters(self):169 170 speed = self.controls.speedSlider.value()171 self.iconTimeLine.setDuration(1200 - speed*10)172 self.backgroundTimeLine.setDuration(1200 - speed*10)173 self.setParallaxEnabled(self.controls.parallaxButton.isChecked())174 self.controls.leftButton.setEnabled(self.ofs > -640)175 self.controls.rightButton.setEnabled(self.ofs < 0)176if __name__ == "__main__":177 app = QApplication(sys.argv)178 slider = ParallaxSlide()179 slider.show()180 ...

Full Screen

Full Screen

test_touch_button.py

Source:test_touch_button.py Github

copy

Full Screen

1import asyncio2import pytest3from touch_button import AdjustParameters, TouchButton, TouchState4import machine5@pytest.fixture6def touch_button():7 touch_adjust_parameters = AdjustParameters(limits=(50, 600), dead_band=(175, 250))8 return TouchButton(machine.Pin(4), touch_adjust_parameters)9def test_touch_button_default_state_is_unknown(touch_button):10 assert touch_button.state == TouchState.UNKNOWN11@pytest.mark.parametrize("touch_value, is_state_changed, expected_button_state", [12 (0, True, TouchState.OUT_OF_RANGE),13 (49, True, TouchState.OUT_OF_RANGE),14 (50, True, TouchState.SELECTED),15 (174, True, TouchState.SELECTED),16 (175, True, TouchState.DEAD_BAND),17 (250, True, TouchState.DEAD_BAND),18 (251, True, TouchState.RELEASED),19 (599, True, TouchState.RELEASED),20 (600, True, TouchState.OUT_OF_RANGE),21 (1024, True, TouchState.OUT_OF_RANGE),22])23def test_state_change_from_unknown(touch_button, touch_value, is_state_changed, expected_button_state):24 touch_button.touch.expect_next_read_value(touch_value)25 assert touch_button.is_state_changed() == is_state_changed26 assert touch_button.state == expected_button_state27@pytest.mark.asyncio28async def test_wait_for_button_release(touch_button):29 touch_button.touch.expect_next_read_value(400)30 await touch_button.wait_for_state_change()31 assert touch_button.state == TouchState.RELEASED32@pytest.mark.asyncio33async def test_wait_for_button_select(touch_button):34 touch_button.touch.expect_next_read_value(125)35 await touch_button.wait_for_state_change()...

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