Ejemplo n.º 1
0
    def test_lost__not_owned(self):
        """Ensures lost works when the clipboard is not owned
        by the pygame application.
        """
        self._skip_if_clipboard_owned()

        lost = scrap.lost()

        self.assertTrue(lost)
Ejemplo n.º 2
0
    def test_get__owned_empty_type(self):
        """Ensures get works when there is no data of the requested type
        in the clipboard and the clipboard is owned by the pygame application.
        """
        # Use a unique data type identifier to ensure there is no preexisting
        # data.
        DATA_TYPE = "test_get__owned_empty_type"

        if scrap.lost():
            # Try to acquire the clipboard.
            scrap.put(pygame.SCRAP_TEXT, b"text to clipboard")

            if scrap.lost():
                self.skipTest("requires the pygame application to own the " "clipboard")

        data = scrap.get(DATA_TYPE)

        self.assertIsNone(data)
Ejemplo n.º 3
0
 def _skip_if_clipboard_owned(self):
     # Skip test if the pygame application owns the clipboard. Currently,
     # there is no way to give up ownership.
     if not scrap.lost():
         self.skipTest("requires the pygame application to not own the " "clipboard")