Exemple #1
0
    def test_get_empty(self):
        """Ensure correct name for CD drive."""
        prompt("Please ensure the CD drive is closed")
        is_empty = self._cd.get_empty()
        response = question('Is the CD drive empty?')

        self.assertEqual(is_empty, response)
    def test_get_count_interactive(self):
        # Test get_count correctly identifies number of connected joysticks
        prompt((
            "Please connect any joysticks/controllers now before starting the "
            "joystick.get_count() test."))

        pygame.joystick.init()
        # pygame.joystick.get_count(): return count
        # number of joysticks on the system, 0 means no joysticks connected
        count = pygame.joystick.get_count()

        response = question((
            "NOTE: Having Steam open may add an extra virtual controller for "
            "each joystick/controller physically plugged in.\n"
            "joystick.get_count() thinks there is [{}] joystick(s)/controller(s)"
            "connected to this system. Is this correct?".format(count)))

        self.assertTrue(response)

        # When you create Joystick objects using Joystick(id), you pass an
        # integer that must be lower than this count.
        # Test Joystick(id) for each connected joystick
        if count != 0:
            for x in range(count):
                pygame.joystick.Joystick(x)
            with self.assertRaises(pygame.error):
                pygame.joystick.Joystick(count)

        pygame.joystick.quit()
Exemple #3
0
    def test_eject(self):
        """Ensure CD drive opens/ejects."""
        self._cd.eject()
        response = question('Did the CD eject?')

        self.assertTrue(response)

        prompt("Please close the CD drive")
Exemple #4
0
    def test_eject(self):
        """Ensure CD drive opens/ejects."""
        # should raise if cd object not initialized
        if self.cd:
            self.cd.init()
            self.cd.eject()

            self.assertTrue(question('Did the CD eject?'))

            prompt("Please close the CD drive.")
    def test__get_count_interactive(self):
        prompt("Please connect at least one controller "
               "before the test for controller.get_count() starts")

        # Reset the number of joysticks counted
        controller.quit()
        controller.init()

        joystick_num = controller.get_count()
        ans = question("get_count() thinks there are {} joysticks "
                       "connected. Is that correct?".format(joystick_num))

        self.assertTrue(ans)
Exemple #6
0
    def test_1_eject(self):

        # __doc__ (as of 2008-07-02) for pygame.cdrom.CD.eject:

        # CD.eject(): return None
        # eject or open the cdrom drive

        # should raise if cd object not initialized
        if self.cd:
            self.cd.init()
            self.cd.eject()

            self.assert_(question('Did the cd eject?'))

            prompt("Please close the cd drive")
Exemple #7
0
    def test_1_eject(self):

        # __doc__ (as of 2008-07-02) for pygame.cdrom.CD.eject:

          # CD.eject(): return None
          # eject or open the cdrom drive
        
        # should raise if cd object not initialized
        if self.cd:
            self.cd.init()
            self.cd.eject()

            self.assert_(question('Did the cd eject?'))
    
            prompt("Please close the cd drive")