Changeset 46817 in vbox
- Timestamp:
- Jun 26, 2013 9:19:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/testcase/tstUsbMouse.cpp
r46799 r46817 72 72 NOREF(iLun); 73 73 NOREF(pszDesc); 74 pUsbIns->IBase = *pBaseInterface; 74 s_drvTstMouse.pDrvBase = pBaseInterface; 75 s_drvTstMouse.pDrv = PDMIBASE_QUERY_INTERFACE(pBaseInterface, 76 PDMIMOUSEPORT); 75 77 *ppBaseInterface = &s_drvTstMouse.IBase; 76 78 return VINF_SUCCESS; … … 121 123 if (RT_SUCCESS(rc)) 122 124 { 125 s_drvTstMouse.pDrv = NULL; 126 s_drvTstMouse.pDrvBase = NULL; 123 127 pThis->iInstance = iInstance; 124 128 pThis->pHlpR3 = &s_tstUsbHlp; 125 129 rc = g_UsbHidMou.pfnConstruct(pThis, iInstance, pCfg, NULL); 126 *ppThis = pThis;127 130 if (RT_SUCCESS(rc)) 131 { 132 *ppThis = pThis; 128 133 return rc; 134 } 129 135 } 130 136 /* Failure */ … … 142 148 RTTestSub(hTest, "simple construction and destruction"); 143 149 int rc = tstMouseConstruct(0, false, 1, &pThis); 144 if (RT_SUCCESS(rc)) 150 RTTEST_CHECK_RC_OK(hTest, rc); 151 if (pThis) 145 152 g_UsbHidMou.pfnDestruct(pThis); 153 } 154 155 156 static void testSendPosition(RTTEST hTest) 157 { 158 PPDMUSBINS pThis = NULL; 159 VUSBURB Urb = { 0 }; 160 RTTestSub(hTest, "sending a position event"); 161 int rc = tstMouseConstruct(0, true, 1, &pThis); 162 if (RT_SUCCESS(rc)) 163 { 164 rc = g_UsbHidMou.pfnUsbReset(pThis, false); 165 } 166 if (RT_SUCCESS(rc)) 167 { 168 if (s_drvTstMouse.pDrv) 169 s_drvTstMouse.pDrv->pfnPutEventAbs(s_drvTstMouse.pDrv, 300, 200, 1, 170 0, 3); 171 else 172 rc = VERR_PDM_MISSING_INTERFACE; 173 } 174 if (RT_SUCCESS(rc)) 175 { 176 Urb.EndPt = 0x01; 177 rc = g_UsbHidMou.pfnUrbQueue(pThis, &Urb); 178 } 179 if (RT_SUCCESS(rc)) 180 { 181 PVUSBURB pUrb = g_UsbHidMou.pfnUrbReap(pThis, 0); 182 if (pUrb) 183 { 184 if (pUrb == &Urb) 185 { 186 if ( Urb.abData[0] != 1 /* Report ID */ 187 || Urb.abData[1] != 3 /* Buttons */ 188 || (int8_t)Urb.abData[2] != -1 /* Wheel, inverted */ 189 || *(uint16_t *)&Urb.abData[4] != 150 /* x >> 1 */ 190 || *(uint16_t *)&Urb.abData[6] != 100 /* y >> 1 */) 191 rc = VERR_GENERAL_FAILURE; 192 } 193 else 194 rc = VERR_GENERAL_FAILURE; 195 } 196 else 197 rc = VERR_GENERAL_FAILURE; 198 } 146 199 RTTEST_CHECK_RC_OK(hTest, rc); 200 if (pThis) 201 g_UsbHidMou.pfnDestruct(pThis); 147 202 } 148 203 … … 170 225 */ 171 226 testConstructAndDestruct(hTest); 227 testSendPosition(hTest); 172 228 return RTTestSummaryAndDestroy(hTest); 173 229 }
Note:
See TracChangeset
for help on using the changeset viewer.