mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-31 12:35:51 +00:00
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.
This commit is contained in:
1 parent
70d8d28697
commit
e026a454ef
1 file changed
+29
@@ -1,5 +1,6 @@
|
||||
#include "prx/libSceErrorDialog/include/Api.hpp"
|
||||
#include "prx/libc/include/general/VabiMacros.hpp"
|
||||
#include "prx/libSceIme/include/ModalDialog.hpp"
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -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<std::int32_t>(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();
|
||||
}
|
||||
Reference in new issue
Block a user