From 712ab9be408d438b358ec9bbcb7be4c728320f6d Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Mon, 2 May 2005 09:52:51 +0000 Subject: [PATCH] Extended the screen test app: now we try to set the display_mode, and we also print the color_space with the other info. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12525 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/kits/interface/ScreenTest.cpp | 47 +++++++++++++++++++++---- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/src/tests/kits/interface/ScreenTest.cpp b/src/tests/kits/interface/ScreenTest.cpp index 1a10a2131a..d503848dfd 100644 --- a/src/tests/kits/interface/ScreenTest.cpp +++ b/src/tests/kits/interface/ScreenTest.cpp @@ -4,24 +4,59 @@ #include #include -// TODO: very basic, will need to be extended int main() { BApplication app("application/x-vnd.BScreenTest"); BScreen screen; - display_mode mode; if (!screen.IsValid()) { printf("Invalid BScreen object\n"); exit(-1); } - status_t status = screen.GetMode(&mode); + display_mode oldMode; + status_t status = screen.GetMode(&oldMode); if (status < B_OK) printf("%s\n", strerror(status)); else - printf("width: %d, height: %d\n", mode.virtual_width, mode.virtual_height); + printf("width: %d, height: %d, space: %lu\n", + oldMode.virtual_width, + oldMode.virtual_height, + oldMode.space); - printf("Screen frame: \n"); + printf("Screen frame: "); screen.Frame().PrintToStream(); -} \ No newline at end of file + + printf("\nTrying to set mode to 800x600: "); + display_mode newMode = oldMode; + newMode.virtual_width = 800; + newMode.virtual_height = 600; + + status = screen.SetMode(&newMode); + if (status < B_OK) + printf("FAILED (%s)\n", strerror(status)); + else { + printf("OK\n"); + status_t status = screen.GetMode(&newMode); + if (status < B_OK) + printf("%s\n", strerror(status)); + else { + printf("width: %d, height: %d, space: %lu\n", + newMode.virtual_width, + newMode.virtual_height, + newMode.space); + printf("Screen frame: "); + screen.Frame().PrintToStream(); + printf("\n"); + } + } + + snooze(4000000); + + printf("resetting video mode: "); + status = screen.SetMode(&oldMode); + if (status < B_OK) + printf("FAILED (%s)\n", strerror(status)); + else + printf("OK\n"); +}