MDDK JOYTST Test Case Descriptions
==================================

The following document lists each of the Test Cases in the JoyTst.exe
Joystick Driver Test Application.

Each Test Case will be identified by Test Case Number, a one-line
description (which appears in the Test Shell's list box in the
Select Tests Dialog), and a short outline of the code executed in the
test case.  Tests with (I) after the number require operator interaction.

In the event that the code outline does not supply enough
information, the test case can be executed with the logging level set
to VERBOSE, which will show all parameters to Multimedia API calls.


Case 1: joyGetNumDevs; get number of devices
        Call joyGetNumDevs and
	    PASS if return value >= 0 and < 3

Case 2: joyGetDevCaps; get all device capabilities
        If joyGetNumDevs reported no valid devices, call joyGetDevCaps and
            PASS if there is a non-zero error code
        Else for each valid device, call joyGetDevCaps and
            PASS if return code == MMSYSERR_NOERROR

Case 3: joyGetDevCaps; bad dev id: expect driver-specific error
        Call joyGetDevCaps for joystick 3 and
            PASS if there is a non-zero error code

Case 4: joyGetDevCaps; dev id = 2: expect error only for single joystick driver modes
        If joyGetNumDevs returns value > 1, return
            OTHER for test case result
        Call joyGetDevCaps for joystick 2 and
            PASS if there is a non-zero error code

Case 5: joyGetDevCaps; zero structure size parameter
        Initialize the first 4 bytes of a JOYCAPS structure
        Call joyGetDevCaps with 0 for the size parameter and
            PASS if the JOYCAPS structure has not changed

Case 6: joyGetDevCaps; structure size < JOYCAPS size
        Initialize the last 4 bytes of a JOYCAPS structure
            (the wPeriodMin and wPeriodMax fields)
        Call joyGetDevCaps with sizeof(JOYCAPS)-4 for the size parameter and
            PASS if the return code is 0 AND
                 if the wPeriod fields have not changed

Case 7: joyGetDevCaps; structure size > JOYCAPS size
        call joyGetDevCaps with sizeof(JOYCAPS)+4 for the size parameter and
            PASS if the return code is 0

Case 8: joyGetThreshold; valid call to API
        If joystick 1 is not attached, return
            OTHER for test case result
        Call joyGetThreshold for device 0 and
            PASS if return code is 0

Case 9: joyGetThreshold; bad dev id: expect driver-specific error
        Call joyGetThreshold for device 3 and
            PASS if there is a non-zero error code

Case 10: joyGetThreshold; while captured
        If joystick 1 is not attached, return
            OTHER for test case result
        Call joySetCapture, ignoring return
        Call joyGetThreshold for JOYSTICKID1 and
            FAIL if there is a non-zero error code returned
        Call joyReleaseCapture

Case 11: joyGetThreshold; dev id = 2: expect error only for single joystick driver modes
        If joyGetNumDevs returns value > 1, return
            OTHER for test case result
        Call joyGetThreshold for joystick 2 and
            PASS if there is a non-zero error code

Case 12: joySetThreshold; valid call to API, with verify
        If joystick 1 is not attached, return
            OTHER for test case result
        Call joySetThreshold for device 0 and
            PASS if return code is 0

Case 13: joySetThreshold; bad dev id: expect driver-specific error
        Call joySetThreshold for device 3 and
            PASS if there is a non-zero error code

Case 14: joySetThreshold; dev id = 2: expect error only for single joystick driver modes
        If joyGetNumDevs returns value > 1, return
            OTHER for test case result
        Call joySetThreshold for joystick 2 and
            PASS if there is a non-zero error code

Case 15: joySetThreshold; highest threshold, with verify
        Call joySetThreshold with wThreshold = 65535
        Call joyGetThreshold and
            PASS if Threshold returned is 65535

Case 16: joySetThreshold; lowest threshold, with verify
        Call joySetThreshold with wThreshold = 0
        Call joyGetThreshold and
            PASS if Threshold returned is 0

Case 17: joySetThreshold; while captured, with verify
        If joystick 1 is not attached, return
            OTHER for test case result
        Call joySetCapture, ignoring return
        Call joySetThreshold for JOYSTICKID1 and
            FAIL if there is a non-zero error code returned
        Call joyGetThreshold and
            PASS if Threshold returned is correct
        Call joyReleaseCapture

Case 18(I): joySetCapture; joystick 1, window 1
        If joystick 1 is not supported (i.e. no driver), return
            OTHER for test case result
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        If joystick is plugged in
            Send a popup to the user instructing them to move
            the joystick and then press button 1
        Call joySetThreshold with Threshold = 250
        Call joySetCapture with Change = TRUE, iRate = 100 and
            FAIL if the return code doesn't match wExpect
        if UNPLUGGED, end the test and return
            PASS
        Loop while processing child window messages until
            the correct button is pressed to end the test case
        Call joyReleaseCapture

Case 19(I): joySetCapture; joystick 1, window 2
        If joystick 1 is not supported (i.e. no driver), return
            OTHER for test case result
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        If joystick is plugged in
            Send a popup to the user instructing them to move
            the joystick and then press button 2
        Call joySetThreshold with Threshold = 250
        Call joySetCapture with Change = FALSE, iRate = 250 and
            FAIL if the return code doesn't match wExpect
        if UNPLUGGED, end the test and return
            PASS
        Loop while processing child window messages until
            the correct button is pressed to end the test case
        Call joyReleaseCapture

Case 20(I): joySetCapture; joystick 2, window 1
        If joystick 2 is not supported (i.e. 3-D driver mode), return
            OTHER for test case result
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        If joystick is plugged in
            Send a popup to the user instructing them to move
            the joystick and then press button 1
        Call joySetThreshold with Threshold = 250
        Call joySetCapture with Change = FALSE, iRate = 250 and
            FAIL if the return code doesn't match wExpect
        if UNPLUGGED, end the test and return
            PASS
        Loop while processing child window messages until
            the correct button is pressed to end the test case
        Call joyReleaseCapture

Case 21(I): joySetCapture; joystick 2, window 2
        If joystick 2 is not supported (i.e. 3-D driver mode), return
            OTHER for test case result
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        If joystick is plugged in
            Send a popup to the user instructing them to move
            the joystick and then press button 2
        Call joySetThreshold with Threshold = 250
        Call joySetCapture with Change = TRUE, iRate = 250 and
            FAIL if the return code doesn't match wExpect
        if UNPLUGGED, end the test and return
            PASS
        Loop while processing child window messages until
            the correct button is pressed to end the test case
        Call joyReleaseCapture

Case 22: joySetCapture; NULL handle
        Set wExpect to JOYERR_PARMS or JOYERR_UNPLUGGED as appropriate
        Call joySetCapture with a NULL window handle and
            PASS if the error code matches wExpect
        Call joyReleaseCapture if there was no error from
            joySetCapture(NULL, ...)

Case 23(I): joySetCapture; twice to same window
        If joystick 1 is not attached, return
            OTHER for test case result
        Send a popup to the user instructing them to move
            the joystick and then press button 1
        Call joySetThreshold(0, 2000)
        Call joySetCapture with Change = TRUE
        Call joySetCapture with Change = TRUE
        Loop while processing child window messages until
            the correct button is pressed to end the test case
        If the second Capture failed, then call joyReleaseCapture
        Call joyReleaseCapture

Case 24(I): joySetCapture; 2 joysticks, same window
        If joystick 1 is not attached, return
            OTHER for test case result
        If joystick 2 is not attached, return
            OTHER for test case result
        Send a popup to the user instructing them to move
            both joysticks and then press button 1
        Call joySetThreshold(0, 2000)
        Call joySetCapture for joystick 1
        Call joySetCapture for joystick 2
        Loop while processing child window messages until
            the correct button is pressed to end the test case
        If Capture joystick 1 didn't fail, then call joyReleaseCapture(0)
        If Capture joystick 2 didn't fail, then call joyReleaseCapture(1)

Case 25: joySetCapture; bad dev id: expect driver-specific error
        Call joySetCapture for device 3 and
            PASS if there is a non-zero error code
        Call joyReleaseCapture if there was no error from
            joySetCapture(x, 3, ...)

Case 26: joySetCapture; dev id = 2: expect error only for single joystick driver modes
        If joyGetNumDevs returns value > 1, return
            OTHER for test case result
        Call joySetCapture for joystick 2 and
            PASS if there is a non-zero error code
        Call joyReleaseCapture if there was no error from
            joySetCapture(x, JOYSTICKID2, ...)

Case 27: joySetCapture; period too high
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        Call joySetCapture with a period of wPeriodMax + 1
            FAIL if the error code returned does not match wExpect
        Call joyReleaseCapture if there was no error from
            joySetCapture(x, JOYSTICKID1, wPeriod, ...)

Case 28: joySetCapture; period too low
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        Call joySetCapture with a period of wPeriodMin - 1
            FAIL if the error code returned does not match wExpect
        Call joyReleaseCapture if there was no error from
            joySetCapture(x, JOYSTICKID1, wPeriod, ...)

Case 29(I): joySetCapture; negative period
        If joystick 1 is not supported (i.e. no driver), return
            OTHER for test case result
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        If joystick is plugged in
            Send a popup to the user instructing them to move
            the joystick and then press button 1
        Call joySetThreshold with Threshold = 250
        Call joySetCapture with Change = TRUE, iRate = 33000 and
            FAIL if the return code doesn't match wExpect
        if UNPLUGGED, end the test and return
            PASS
        Loop while processing child window messages until
            the correct button is pressed to end the test case
        Call joyReleaseCapture

Case 30(I): joySetCapture; period too high, with tracking
        If joystick 1 is not supported (i.e. no driver), return
            OTHER for test case result
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        If joystick is plugged in
            Send a popup to the user instructing them to move
            the joystick and then press button 1
        Call joySetThreshold with Threshold = 250
        Call joySetCapture with Change = TRUE, iRate = wPeriodMax + 1 and
            FAIL if the return code doesn't match wExpect
        if UNPLUGGED, end the test and return
            PASS
        Loop while processing child window messages until
            the correct button is pressed to end the test case
        Call joyReleaseCapture

Case 31(I): joySetCapture; period too low, with tracking
        If joystick 1 is not supported (i.e. no driver), return
            OTHER for test case result
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        If joystick is plugged in
            Send a popup to the user instructing them to move
            the joystick and then press button 1
        Call joySetThreshold with Threshold = 250
        Call joySetCapture with Change = TRUE, iRate = wPeriodMin - 1 and
            FAIL if the return code doesn't match wExpect
        if UNPLUGGED, end the test and return
            PASS
        Loop while processing child window messages until
            the correct button is pressed to end the test case
        Call joyReleaseCapture

Case 32: joyReleaseCapture; valid call to API
        If joystick 1 is not attached, return
            OTHER for test case result
        Call joySetCapture, ignoring return
        Call joyReleaseCapture
            FAIL if there is a non-zero error code returned

Case 33: joyReleaseCapture; bad dev id: expect driver-specific error
        Call joyReleaseCapture for device 3 and
            PASS if there is a non-zero error code

Case 34: joyReleaseCapture; dev id = 2: expect error only for single joystick driver modes
        If joyGetNumDevs returns value > 1, return
            OTHER for test case result
        Call joyReleaseCapture for joystick 2 and
            PASS if there is a non-zero error code

Case 35: joyReleaseCapture; twice
        If joystick 1 is not attached, return
            OTHER for test case result
        Call joySetCapture, ignoring return
        Call joyReleaseCapture, ignoring return
        Call joyReleaseCapture and
            PASS if there is a non-zero error code

Case 36: joyGetPos; while captured
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        Call joySetCapture and
            FAIL if return code does not match wExpect
        Call joyGetPos for device 0 and
            FAIL if return code does not match wExpect
        Call joyReleaseCapture

Case 37: joyGetPos; valid call to API
        Set wExpect to MMSYSERR_NOERROR or JOYERR_UNPLUGGED as appropriate
        Call joyGetPos for device 0 and
            FAIL if return code does not match wExpect

Case 38: joyGetPos; bad dev id: expect driver-specific error
        Call joyGetPos for joystick 3 and
            PASS if there is a non-zero error code returned

Case 39: joyGetPos; dev id = 2: expect error only for single joystick driver modes
        If joyGetNumDevs returns value > 1, return
            OTHER for test case result
        Call joyGetPos for joystick 2 and
            PASS if there is a non-zero error code
