Ejemplo n.º 1
0
class TestWindow(unittest.TestCase):
    def setUp(self):
        """Call before every test case."""
        self.app = Application(["./luminos.py", "-d"])

    def tearDown(self):
        """Call after every test case."""
        del self.app
        # self.file.close()

    def test_creating_window(self):
        """"""
        window = BrowserWindow(self.app)
        window.deleteLater()
        window.show()
        self.assertTrue(window.isVisible(), "cannot show window.")
        window.close()

    def test_window_load_url(self):
        path = os.path.join(os.getcwd(), "data", "static")
        expectedUrl = "file://" + path + "/index.html"

        window = BrowserWindow(self.app)
        self.app.registerApp(path)
        window.loadUrl(expectedUrl)
        window.show()

        script = window.webview.page().scripts().findScript("QWebChannel API")
        self.assertIsNotNone(script)
        script = window.webview.page().scripts().findScript("Luminos Bridge")
        self.assertIsNotNone(script)

        url = window.webview.url()
        self.assertEqual(url.toDisplayString(), expectedUrl)
        window.close()
Ejemplo n.º 2
0
 def setUp(self):
     """Call before every test case."""
     self.app = Application(["./luminos.py", "-d"])
Ejemplo n.º 3
0
 def buttonTextColor(self):
     app: Application = Application.instance()
     color = app.palette().color(QPalette.ButtonText)
     return color.name(QColor.HexArgb)
Ejemplo n.º 4
0
 def hightlightedTextColor(self):
     app: Application = Application.instance()
     color = app.palette().color(QPalette.HighlightedText)
     return color.name(QColor.HexArgb)
Ejemplo n.º 5
0
 def foregroundColor(self):
     app: Application = Application.instance()
     color = app.palette().color(QPalette.Foreground)
     return color.name(QColor.HexArgb)
Ejemplo n.º 6
0
 def backgroundColor(self):
     app: Application = Application.instance()
     color = app.mainWindow.style().standardPalette().color(
         QPalette.Background)
     return color.name(QColor.HexRgb)
Ejemplo n.º 7
0
 def alternateBaseColor(self):
     app: Application = Application.instance()
     color = app.palette().color(QPalette.AlternateBase)
     return color.name(QColor.HexArgb)