Skip to content

Commit

Permalink
☔ Attempt to fix CI. Fixed a bug in the tests where the position of a…
Browse files Browse the repository at this point in the history
… block was computed incorrectly.
  • Loading branch information
vanyle committed Nov 15, 2021
1 parent d7f330a commit 225b986
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/python-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
python-version: 3.9
- name: Install dependencies
run: |
sudo mkdir /usr/bin/platforms
sudo apt-get update
sudo apt-get install python3-tk python3-dev
sudo apt-get install xvfb
Expand All @@ -25,10 +27,14 @@ jobs:
sudo apt-get install --reinstall libxcb-render-util0
sudo apt-get install --reinstall libxcb-xkb1
sudo apt-get install --reinstall libxkbcommon-x11-0
sudo ln -s /our/local/libqxcb.so /usr/bin/platforms/libqxcb.so
sudo python -m pip install --upgrade pip
sudo pip install -r requirements.txt
sudo pip install -r requirements-dev.txt
- name: Build unit coverage using pytest-cov
run: |
sudo pytest --cov=opencodeblocks --cov-report=xml tests/unit
Expand Down
19 changes: 10 additions & 9 deletions tests/integration/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,17 @@ def test_move_blocks():
msgQueue = queue.Queue()

def testing_drag(msgQueue):
time.sleep(.4) # Wait for proper setup of app
time.sleep(1) # Wait for proper setup of app

# test_block1 == (0,0) but it's not crucial for this test.
pos_block_1 = QPoint(int(test_block1.pos().x()),int(test_block1.pos().y()))

pos_block_1.setX(pos_block_1.x() +
test_block1.title_height//2 +
ocb_widget.width()//2)
pos_block_1.setY(pos_block_1.y() +
test_block1.title_height//2 +
ocb_widget.height()//2)

pos_block_1 = ocb_widget.mapToGlobal(pos_block_1)
pos_block_1.setX(pos_block_1.x() + test_block1.title_height//2)
pos_block_1.setY(pos_block_1.y() + test_block1.title_height//2)

sr = ocb_widget.view.sceneRect()
pos_block_1 = ocb_widget.view.mapFromScene(pos_block_1)
pos_block_1 = ocb_widget.view.mapToGlobal(pos_block_1)

pyautogui.moveTo(pos_block_1.x(),pos_block_1.y())
pyautogui.mouseDown(button="left")
Expand Down Expand Up @@ -188,9 +186,12 @@ def testing_drag(msgQueue):

msgQueue.put([STOP_MSG])


t = threading.Thread(target=testing_drag, args=(msgQueue,))
t.start()

ocb_widget.view.repaint()

while True:
QApplication.processEvents()
time.sleep(0.02)
Expand Down

0 comments on commit 225b986

Please sign in to comment.