Get the screen resolution directly from macOS, or return the previous resolution

This commit is contained in:
Raoul Snyman 2019-03-25 14:26:48 -07:00
parent 0669a6c5d4
commit efa446a356
1 changed files with 16 additions and 2 deletions

View File

@ -29,6 +29,7 @@ from unittest.mock import MagicMock, patch
from PyQt5 import QtCore, QtGui
from openlp.core.common import is_macosx
from openlp.core.common.path import Path
from openlp.core.common.settings import Settings
from openlp.core.display.screens import ScreenList
@ -49,6 +50,18 @@ SCREEN = {
}
def get_screen_resolution():
"""
Get the screen resolution
"""
if is_macosx():
from AppKit import NSScreen
screen_size = NSScreen.mainScreen().frame().size
return screen_size.width, screen_size.height
else:
return 1024, 768
class TestPdfController(TestCase, TestMixin):
"""
Test the PdfController.
@ -137,8 +150,9 @@ class TestPdfController(TestCase, TestMixin):
assert 1076 == image.height(), 'The height should be 1076'
assert 760 == image.width(), 'The width should be 760'
else:
assert 768 == image.height(), 'The height should be 768'
assert 543 == image.width(), 'The width should be 543'
width, height = get_screen_resolution()
assert image.height() == height, 'The height should be 768'
assert image.width() == 543, 'The width should be 543'
@patch('openlp.plugins.presentations.lib.pdfcontroller.check_binary_exists')
def test_process_check_binary_mudraw(self, mocked_check_binary_exists):