# Copyright 2022 (c) Anna Schumaker. """Tests our Mpris Application object.""" import pathlib import unittest import emmental.mpris2.application from gi.repository import Gio class TestRoot(unittest.TestCase): """Test the mpris2 application object.""" def setUp(self): """Set up common variables.""" self.app = emmental.mpris2.application.Application() def test_xml_files(self): """Test that the interface definition files exist.""" mpris2 = pathlib.Path(emmental.mpris2.__file__).parent self.assertEqual(emmental.mpris2.application.MPRIS2_XML, mpris2 / "MediaPlayer2.xml") self.assertTrue(emmental.mpris2.application.MPRIS2_XML.is_file()) def test_init(self): """Test that the application object is configured correctly.""" self.assertIsInstance(self.app, emmental.mpris2.dbus.Object) self.assertIsInstance(self.app.nodeinfo, Gio.DBusNodeInfo) self.assertIsInstance(self.app.interface, Gio.DBusInterfaceInfo) def test_properties(self): """Test Application properties.""" self.assertTrue(self.app.CanQuit) self.assertFalse(self.app.Fullscreen) self.assertTrue(self.app.CanSetFullscreen) self.assertTrue(self.app.CanRaise) self.assertFalse(self.app.HasTrackList) self.assertEqual(self.app.Identity, "Emmental Music Player") self.assertEqual(self.app.DesktopEntry, "emmental") self.assertEqual(self.app.SupportedUriSchemes, ["file"]) self.assertEqual(self.app.SupportedMimeTypes, ["audio"]) def test_signals(self): """Test that Application signals exist.""" self.app.emit("Raise") self.app.emit("Quit")