From e026a454effeaec00cc731e80658472502558df5 Mon Sep 17 00:00:00 2001 From: MarcZX10 <67475268+MarcZX10@users.noreply.github.com> Date: Wed, 28 Oct 2026 11:21:22 +0000 Subject: [PATCH] test(libSceErrorDialog): cover a shown error dialog guest_error_dialog opens a dialog with a presenter: the view carries the error code with one focused OK button, status calls keep it running, a confirm or a cancel input finishes it, and both update and get status report the result. --- core/libs/tests/GuestErrorDialog.cpp | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/core/libs/tests/GuestErrorDialog.cpp b/core/libs/tests/GuestErrorDialog.cpp index 8f108e6c83..a738648b1a 100644 --- a/core/libs/tests/GuestErrorDialog.cpp +++ b/core/libs/tests/GuestErrorDialog.cpp @@ -1,5 +1,6 @@ #include "prx/libSceErrorDialog/include/Api.hpp" #include "prx/libc/include/general/VabiMacros.hpp" +#include "prx/libSceIme/include/ModalDialog.hpp" #include #include @@ -22,6 +23,32 @@ struct ErrorDialogParam { std::int32_t reserved; }; +ModalDialogState Session() { + std::size_t chosen = 0; + return ModalDialogPoll_nid_postfix(chosen); +} + +void ShownDialog() { + ErrorDialogParam param{16, static_cast(0x80020001), 0, 0}; + ModalDialogSetPresenter_nid_postfix(true); + Require(sceErrorDialogInitialize() == 0); + Require(sceErrorDialogOpen(¶m) == 0); + Require(Session() == ModalDialogState::Showing); + ModalDialogView view; + Require(ModalDialogReadView_nid_postfix(view)); + Require(view.message == u"An error occurred.\nError code: 0x80020001" && view.buttons.size() == 1 && view.buttons[0].selected); + for (int poll = 0; poll < 3; ++poll) Require(sceErrorDialogUpdateStatus() == kStatusRunning && sceErrorDialogGetStatus() == kStatusRunning); + ModalDialogPublishInput_nid_postfix(ModalDialogInputKind::Confirm); + Require(sceErrorDialogGetStatus() == kStatusFinished); + Require(sceErrorDialogUpdateStatus() == kStatusFinished); + + Require(sceErrorDialogOpen(¶m) == 0 && Session() == ModalDialogState::Showing); + ModalDialogPublishInput_nid_postfix(ModalDialogInputKind::Cancel); + Require(sceErrorDialogUpdateStatus() == kStatusFinished); + Require(sceErrorDialogTerminate() == 0); + ModalDialogSetPresenter_nid_postfix(false); +} + } int main() { @@ -71,4 +98,6 @@ int main() { Require(sceErrorDialogOpen(¶m) == kErrInvalidState); Require(sceErrorDialogOpenDetail() == kErrUnexpectedFatal); Require(sceErrorDialogOpenWithReport() == kErrUnexpectedFatal); + + ShownDialog(); }