mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-21 06:45:44 +00:00
wayland: Add support for images in clipboard.
Re-writes the clipboard data handling in wayland to an on demand solution where callbacks are provided to generate/provide the clipboard data when requested by the OS.
This commit is contained in:
committed by
Sam Lantinga
parent
dfd80f3d76
commit
19adfa3ad9
@@ -22,6 +22,19 @@ static int clipboard_testHasClipboardText(void *arg)
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check call to SDL_HasClipboardData
|
||||
*
|
||||
* \sa SDL_HasClipboardData
|
||||
*/
|
||||
static int clipboard_testHasClipboardData(void *arg)
|
||||
{
|
||||
SDL_HasClipboardData("image/png");
|
||||
SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check call to SDL_HasPrimarySelectionText
|
||||
*
|
||||
@@ -51,6 +64,25 @@ static int clipboard_testGetClipboardText(void *arg)
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check call to SDL_GetClipboardData
|
||||
*
|
||||
* \sa SDL_GetClipboardText
|
||||
*/
|
||||
static int clipboard_testGetClipboardData(void *arg)
|
||||
{
|
||||
void *buffer = NULL;
|
||||
size_t length;
|
||||
buffer = SDL_GetClipboardData(&length, "image/png");
|
||||
SDLTest_AssertPass("Call to SDL_GetClipboardData succeeded");
|
||||
|
||||
if (buffer != NULL) {
|
||||
SDL_free(buffer);
|
||||
}
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check call to SDL_GetPrimarySelectionText
|
||||
*
|
||||
@@ -94,6 +126,27 @@ static int clipboard_testSetClipboardText(void *arg)
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check call to SDL_SetClipboardData
|
||||
* \sa SDL_SetClipboardText
|
||||
*/
|
||||
static int clipboard_testSetClipboardData(void *arg)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
result = SDL_SetClipboardData(NULL, 0, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetClipboardData succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
result == 0,
|
||||
"Validate SDL_SetClipboardData result, expected 0, got %i",
|
||||
result);
|
||||
|
||||
SDL_GetClipboardUserdata();
|
||||
SDLTest_AssertPass("Call to SDL_GetClipboardUserdata succeeded");
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check call to SDL_SetPrimarySelectionText
|
||||
* \sa SDL_SetPrimarySelectionText
|
||||
@@ -310,9 +363,21 @@ static const SDLTest_TestCaseReference clipboardTest8 = {
|
||||
(SDLTest_TestCaseFp)clipboard_testPrimarySelectionTextFunctions, "clipboard_testPrimarySelectionTextFunctions", "End-to-end test of SDL_xyzPrimarySelectionText functions", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference clipboardTest9 = {
|
||||
(SDLTest_TestCaseFp)clipboard_testGetClipboardData, "clipboard_testGetClipboardData", "Check call to SDL_GetClipboardData", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference clipboardTest10 = {
|
||||
(SDLTest_TestCaseFp)clipboard_testSetClipboardData, "clipboard_testSetClipboardData", "Check call to SDL_SetClipboardData", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference clipboardTest11 = {
|
||||
(SDLTest_TestCaseFp)clipboard_testHasClipboardData, "clipboard_testHasClipboardData", "Check call to SDL_HasClipboardData", TEST_ENABLED
|
||||
};
|
||||
|
||||
/* Sequence of Clipboard test cases */
|
||||
static const SDLTest_TestCaseReference *clipboardTests[] = {
|
||||
&clipboardTest1, &clipboardTest2, &clipboardTest3, &clipboardTest4, &clipboardTest5, &clipboardTest6, &clipboardTest7, &clipboardTest8, NULL
|
||||
&clipboardTest1, &clipboardTest2, &clipboardTest3, &clipboardTest4, &clipboardTest5, &clipboardTest6, &clipboardTest7, &clipboardTest8, &clipboardTest9, &clipboardTest10, &clipboardTest11, NULL
|
||||
};
|
||||
|
||||
/* Clipboard test suite (global) */
|
||||
|
||||
Reference in New Issue
Block a user