test: fix two more failing FP3232 tests
And put a comment in to explain why we're testing for a frac between .3 and .6. We can't directly compare the frac since the floating/fixed point conversion loses precision. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
5701ab4a44
commit
005ab41986
|
@ -108,6 +108,7 @@ TestPointerProc(DeviceIntPtr pDev, int what)
|
||||||
pDev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
|
pDev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
|
||||||
pDev->last.valuators[1] = pDev->valuator->axisVal[1];
|
pDev->last.valuators[1] = pDev->valuator->axisVal[1];
|
||||||
|
|
||||||
|
/* protocol-xiquerydevice.c relies on these increment */
|
||||||
SetScrollValuator(pDev, 2, SCROLL_TYPE_VERTICAL, 2.4, SCROLL_FLAG_NONE);
|
SetScrollValuator(pDev, 2, SCROLL_TYPE_VERTICAL, 2.4, SCROLL_FLAG_NONE);
|
||||||
SetScrollValuator(pDev, 3, SCROLL_TYPE_HORIZONTAL, 3.5, SCROLL_FLAG_PREFERRED);
|
SetScrollValuator(pDev, 3, SCROLL_TYPE_HORIZONTAL, 3.5, SCROLL_FLAG_PREFERRED);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -389,9 +389,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
|
||||||
{
|
{
|
||||||
FP3232 vi, vo;
|
FP3232 vi, vo;
|
||||||
|
|
||||||
vi.integral = trunc(in->valuators.data[i]);
|
vi = double_to_fp3232(in->valuators.data[i]);
|
||||||
vi.frac = (in->valuators.data[i] - vi.integral) * (1UL << 32);
|
|
||||||
|
|
||||||
vo = *values;
|
vo = *values;
|
||||||
|
|
||||||
if (swap)
|
if (swap)
|
||||||
|
|
|
@ -213,9 +213,9 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(si->increment.integral == si->number);
|
assert(si->increment.integral == si->number);
|
||||||
/* FIXME: frac testing with float/FP issues? */
|
/* protocol-common.c sets up increments of 2.4 and 3.5 */
|
||||||
assert(si->increment.frac > 0.3 * (1UL << 32));
|
assert(si->increment.frac > 0.3 * (1ULL << 32));
|
||||||
assert(si->increment.frac < 0.6 * (1UL << 32));
|
assert(si->increment.frac < 0.6 * (1ULL << 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue