def test_mode_any(self): '''calling with --mode any''' sys.argv = ['ui-test', '--list', '--mode', 'any'] ui = sandbox.TestUI() self.assertEqual(sandbox.TestUI().run(), 0) displayed = set(ui.get_displayed_handlers()) self.stop_capture() self.assertEqual(len(self.stdout.strip().splitlines()), 5) self.assert_('free module with available hardware, graphics card' in self.stdout) self.assert_('kmod:mint ' in self.stdout) self.assert_('kmod:vanilla ' in self.stdout) self.assert_('kmod:vanilla3d ' in self.stdout) self.assert_('kmod:firmwifi ' in self.stdout) self.assertEqual(displayed, set(['kmod:mint', 'kmod:vanilla', 'kmod:vanilla3d', 'kmod:firmwifi', 'kmod:foodmi'])) # mint is not enabled by default self.failIf('Restricted' in ui.main_window_title()) (h, s) = ui.main_window_text() self.assert_('No proprietary drivers are in use' in h) self.assert_('cannot fix or improve' in s) # enable mint ui.backend().set_enabled('kmod:mint', True) (h, s) = ui.main_window_text() self.assert_('Proprietary drivers are being used' in h) self.assert_('cannot fix or improve' in s)
def test_mode_nonfree(self): '''calling with --mode nonfree''' sys.argv = ['ui-test', '--list', '--mode', 'nonfree'] ui = sandbox.TestUI() self.assertEqual(sandbox.TestUI().run(), 0) displayed = set(ui.get_displayed_handlers()) self.stop_capture() self.assertEqual(displayed, set(['kmod:mint', 'kmod:vanilla3d'])) self.assertEqual(len(self.stdout.strip().splitlines()), 2) self.assert_('kmod:vanilla3d ' in self.stdout) self.assert_('kmod:mint ' in self.stdout) self.assert_('Restricted' in ui.main_window_title()) (h, s) = ui.main_window_text() self.assert_('No proprietary drivers are in use' in h, h) self.assert_('cannot fix or improve' in s)
def test_mode_free(self): '''calling with --mode free''' sys.argv = ['ui-test', '--list', '--mode', 'free'] ui = sandbox.TestUI() self.assertEqual(sandbox.TestUI().run(), 0) displayed = set(ui.get_displayed_handlers()) self.stop_capture() self.assertEqual(displayed, set(['kmod:vanilla', 'kmod:firmwifi', 'kmod:foodmi'])) self.assertEqual(len(self.stdout.strip().splitlines()), 3) self.assert_('free module with available hardware, graphics card' in self.stdout) self.assert_('kmod:vanilla ' in self.stdout) self.assert_('kmod:firmwifi ' in self.stdout) self.assert_('kmod:foodmi ' in self.stdout) self.failIf('Restricted' in ui.main_window_title()) (h, s) = ui.main_window_text() self.assert_('No proprietary drivers are in use' in h) self.assertEqual(s, '')
def test_mode_any(self): '''calling with --mode any''' sys.argv = ['ui-test', '--list', '--mode', 'any'] ui = sandbox.TestUI() self.assertEqual(sandbox.TestUI().run(), 0) displayed = set(ui.get_displayed_handlers()) self.stop_capture() self.assertEqual(len(self.stdout.strip().splitlines()), 5) self.assert_('free module with available hardware, graphics card' in self.stdout) self.assert_('kmod:mint ' in self.stdout) self.assert_('kmod:vanilla ' in self.stdout) self.assert_('kmod:vanilla3d ' in self.stdout) self.assert_('kmod:firmwifi ' in self.stdout) self.assertEqual( displayed, set([ 'kmod:mint', 'kmod:vanilla', 'kmod:vanilla3d', 'kmod:firmwifi', 'kmod:foodmi' ])) # mint is not enabled by default self.failIf('Restricted' in ui.main_window_title()) (h, s) = ui.main_window_text() self.assert_('No proprietary drivers are in use' in h) self.assert_('cannot fix or improve' in s) # enable mint ui.backend().set_enabled('kmod:mint', True) (h, s) = ui.main_window_text() self.assert_('Proprietary drivers are being used' in h) self.assert_('cannot fix or improve' in s)