diff --git a/src/test_listlatihan2.py b/src/test_listlatihan2.py new file mode 100644 index 0000000000000000000000000000000000000000..1452facb3c3be89b60f3aa7bd0dbe6f5efdf1f4e --- /dev/null +++ b/src/test_listlatihan2.py @@ -0,0 +1,25 @@ +from PyQt6.QtWidgets import QApplication +from listlatihan2 import listLatihan2 +from PyQt6.QtCore import Qt, QSize, pyqtSignal +from PyQt6.QtGui import QIcon, QPixmap, QCursor, QFont, QMovie +from PyQt6.QtWidgets import (QWidget, QApplication, QWidget, + QLabel, QVBoxLayout, QHBoxLayout, QPushButton, QScrollArea, QDialog) +import pytest + +@pytest.fixture +def app(): + app = listLatihan2() + yield app + +def test_window(app,qtbot): + # cek window title + assert app.windowTitle() == "FitU - Daftar Latihan" + assert app.height() == 720 + assert app.width() == 1280 + assert len(app.findChildren(QPushButton)) == 20 + +def test_listLat(app,qtbot): + # cek jumlah latihan yang ditampilkan apakah berisi 16 latihan + assert len(app.listLat) == 16 + assert isinstance(app.findChild(QScrollArea), QScrollArea) + assert len(app.findChild(QScrollArea).findChildren(QPushButton)) == len(app.listLat)