Esempio n. 1
0
	def testPlayerControlClass(self):
		pc = PlayerControl()
		pc.addQueueItem(5)
		self.assertEqual(pc.getQueue(), [5])
		
		# Test queue item removal in an unallowed range
		self.assertFalse(pc.removeQueueItem(2) , "You cannot delete an item at index 2 if there is only 1 item in the queue" )
		pc.addQueueItem(6)
		
		# Test queue item removal on a valid index
		self.assertTrue(pc.removeQueueItem(1) , "You should be able to delete a queue item by a valid index" )
		
		# Create an empty queue
		pc.flushQueue()
		self.assertEqual(pc.getQueue(), [], "Queue should be empty after flushQueue")
		
		pc.addQueueItem(1)
		pc.addQueueItem(2)
		pc.addQueueItem(3)
		
		# Set the current queue entry pointer to a valid value. True must be returned.
		self.assertTrue(pc.setCurrentQueueEntry(1))

		# Set the current queue entry pointer to an invalid value. False must be returned.
		self.assertFalse(pc.setCurrentQueueEntry(3))
Esempio n. 2
0
    def testPlayerControlClass(self):
        pc = PlayerControl()
        pc.addQueueItem(5)
        self.assertEqual(pc.getQueue(), [5])

        # Test queue item removal in an unallowed range
        self.assertFalse(
            pc.removeQueueItem(2),
            "You cannot delete an item at index 2 if there is only 1 item in the queue"
        )
        pc.addQueueItem(6)

        # Test queue item removal on a valid index
        self.assertTrue(
            pc.removeQueueItem(1),
            "You should be able to delete a queue item by a valid index")

        # Create an empty queue
        pc.flushQueue()
        self.assertEqual(pc.getQueue(), [],
                         "Queue should be empty after flushQueue")

        pc.addQueueItem(1)
        pc.addQueueItem(2)
        pc.addQueueItem(3)

        # Set the current queue entry pointer to a valid value. True must be returned.
        self.assertTrue(pc.setCurrentQueueEntry(1))

        # Set the current queue entry pointer to an invalid value. False must be returned.
        self.assertFalse(pc.setCurrentQueueEntry(3))