diff --git a/src/tests/servers/input/inputdevice/Jamfile b/src/tests/servers/input/inputdevice/Jamfile new file mode 100644 index 0000000000..53a185ce6e --- /dev/null +++ b/src/tests/servers/input/inputdevice/Jamfile @@ -0,0 +1,18 @@ +SubDir OBOS_TOP src tests servers input inputdevice ; + +if $(COMPILE_FOR_R5) { + SubDirC++Flags -DCOMPILE_FOR_R5 ; +} + +UsePrivateHeaders input ; + +SimpleTest input_device_test : + main.cpp + + Input.cpp + : be + ; + + +SEARCH on [ FGristFiles Input.cpp ] + = [ FDirName $(OBOS_TOP) src kits interface ] ; diff --git a/src/tests/servers/input/inputdevice/main.cpp b/src/tests/servers/input/inputdevice/main.cpp new file mode 100644 index 0000000000..6bc2c65c76 --- /dev/null +++ b/src/tests/servers/input/inputdevice/main.cpp @@ -0,0 +1,103 @@ +/* +** Copyright 2004, Jérôme Duval. All rights reserved. +** +** Distributed under the terms of the OpenBeOS License. +*/ + +#include +#include + +#include +#include + +int +main(int argc, char *argv[]) +{ + BList list; + status_t err; + if ((err = get_input_devices(&list))!=B_OK) + printf("get_input_devices returned %s\n", strerror(err)); + + for (uint32 i=0; iName()); + if (device->Type() == B_POINTING_DEVICE) + printf("B_POINTING_DEVICE\n"); + if (device->Type() == B_KEYBOARD_DEVICE) + printf("B_KEYBOARD_DEVICE\n"); + if (device->Type() == B_UNDEFINED_DEVICE) + printf("B_UNDEFINED_DEVICE\n"); + + + device = find_input_device(device->Name()); + if (device == NULL) { + printf("device %ld with find_input_device is NULL\n", i); + continue; + } + + printf("device %ld with find_input_device %s ", i, device->Name()); + if (device->Type() == B_POINTING_DEVICE) + printf("B_POINTING_DEVICE"); + if (device->Type() == B_KEYBOARD_DEVICE) + printf("B_KEYBOARD_DEVICE"); + if (device->Type() == B_UNDEFINED_DEVICE) + printf("B_UNDEFINED_DEVICE"); + + printf("\n"); + printf(" %s", device->IsRunning() ? "true" : "false"); + device->Stop(); + printf(" %s", device->IsRunning() ? "true" : "false"); + device->Start(); + printf(" %s", device->IsRunning() ? "true" : "false"); + device->Stop(); + printf(" %s", device->IsRunning() ? "true" : "false"); + device->Start(); + printf(" %s", device->IsRunning() ? "true" : "false"); + + printf("\n"); + + } + + if (find_input_device("blahha") != NULL ) + printf("find_input_device(\"blahha\") not returned NULL\n"); + else + printf("find_input_device(\"blahha\") returned NULL\n"); + + printf("\n"); + BInputDevice::Start(B_POINTING_DEVICE); + for (uint32 i=0; iIsRunning() ? "true" : "false"); + } + BInputDevice::Stop(B_POINTING_DEVICE); + for (uint32 i=0; iIsRunning() ? "true" : "false"); + } + BInputDevice::Start(B_POINTING_DEVICE); + for (uint32 i=0; iIsRunning() ? "true" : "false"); + } + BInputDevice::Stop(B_POINTING_DEVICE); + for (uint32 i=0; iIsRunning() ? "true" : "false"); + } + BInputDevice::Start(B_POINTING_DEVICE); + for (uint32 i=0; iIsRunning() ? "true" : "false"); + } + printf("\n"); + return 0; +err: + + return 0; +} +