Repository navigation
test: Cover obs-websocket list items with a NULL name or value - #2251
Merged
Merged
Conversation
obs-websocket's GetInputPropertiesListPropertyItems turns every item of
a list property into json. Utils::Obs::ArrayHelper::GetListPropertyItems
used to put the const char * from obs_property_list_item_name() and
obs_property_list_item_string() straight into the json value, and a
NULL pointer throws std::logic_error ("basic_string: construction from
null is not valid") on the websocket thread, so OBS aborted. libobs
keeps such items as they were added: the macOS Screen Capture source
puts a placeholder with a NULL value at the top of its display and
application lists (upstream obsproject/obs-studio#13905). The fork fix,
obs-rust/obs-websocket#18 (a port of obsproject/obs-websocket#1355),
reports those items with empty strings and came in with the submodule
bump in obs-rust#1996.
test_ws_list_property_items compiles the plugin's ArrayHelper against
libobs and builds list properties with a NULL value and a NULL name. It
needs no libobs startup and no display. With the submodule at 0d663ee,
the commit before the fix, both NULL cases fail (the helper throws);
at the current pin all 3 cases pass.
The fix gets its line in docs/features.md.
Fixes obs-rust#1266
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1266
What and why
The fix for #1266 is already on master. obs-rust/obs-websocket#18, a port of obsproject/obs-websocket#1355, reports a list item with a NULL name or NULL string value as an empty string. Before,
GetInputPropertiesListPropertyItemsaborted OBS on such an item, and the macOS Screen Capture display and application lists always start with one (upstream obsproject/obs-studio#13905). The fix came in with theplugins/obs-websocketbump in #1996 (0d663eefb to 99dd8468b; master's pin 30d6f51 still contains it). The regression test was never posted, so #1266 is still open. This PR adds only the test and the fix's line indocs/features.md. It does not move the submodule.test_ws_list_property_itemscompiles the plugin'sUtils::Obs::ArrayHelperfrom the submodule against libobs and builds list properties directly. It needs no libobs startup and no display:string_items_reported: ordinary string items keep their names and values (guard).null_string_value_reported_empty: the macOS placeholder,(" ", NULL), is reported with an empty value.null_item_name_reported_empty: items without a name, in a string list and an int list, are reported with an empty name.If the helper throws, the case fails with the exception message rather than aborting the test. Registered as
test/cmocka/tests.d/test_ws_list_property_items.cmake(Linux, nlohmann_json found).RED → GREEN
plugins/obs-websocketchecked out at 0d663ee (ws#18's parent, the fork commit just before the fix; not committed), 2 of 3 cases fail on C, hybrid and libobs-c-reference:null_string_value_reported_emptyandnull_item_name_reported_empty, each withGetListPropertyItems threw 'basic_string: construction from null is not valid'.string_items_reportedpasses.test_ws_list_property_itemspasses 3/3 on C, hybrid and libobs-c-reference. The other 10test_ws_*tests pass on all three lanes. Exported symbols: 1766, the same set on all three libraries. Local gate:--test-diff origin/master3736 passed, 6 skipped (whole workspace in scope) and--lane lintok.Checklist
masterdocs/features.mdis added or updated-W..., ratchets): not applicable(Rebased onto current master, which only brought unrelated commits, as
192214cfd; the runs above name the commits they ran on.)