~ubuntu-branches/ubuntu/vivid/mir/vivid

« back to all changes in this revision

Viewing changes to tests/unit-tests/android_input/input_reader.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-02-04 14:49:07 UTC
  • mto: This revision was merged to the branch mainline in revision 61.
  • Revision ID: package-import@ubuntu.com-20140204144907-o3ruhix0ey26lchl
Tags: upstream-0.1.4+14.04.20140204
ImportĀ upstreamĀ versionĀ 0.1.4+14.04.20140204

Show diffs side-by-side

added added

removed removed

Lines of Context:
4785
4785
    process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0x00000000);
4786
4786
}
4787
4787
 
 
4788
// Regression test for LP#1238417:
 
4789
// https://bugs.launchpad.net/mir/+bug/1238417
 
4790
//
 
4791
// Don't assume that ABS_MT_PRESSURE is 0 if you haven't heard from it yet. Instead,
 
4792
// the pressure axis should be considered as absent.
 
4793
// If a touch point has always the same positive, non-zero, pressure, that value
 
4794
// will be informed only once, on its first event. But if mir wasn't running at
 
4795
// that time, it would consider the pressure to be zero and therefore the point to be
 
4796
// hovering, which is wrong.
 
4797
TEST_F(MultiTouchInputMapperTest, Process_IgnorePressureAxisIfValueUnknown) {
 
4798
    MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice);
 
4799
    addConfigurationProperty("touch.deviceType", "touchScreen");
 
4800
    addConfigurationProperty("device.internal", "1");
 
4801
    setDisplayInfoAndReconfigure(DISPLAY_ID, 1024, 768, DISPLAY_ORIENTATION_0);
 
4802
    prepareAxes(POSITION | PRESSURE | ID);
 
4803
    addMapperAndConfigure(mapper);
 
4804
 
 
4805
    // Note that there's no ABS_MT_PRESSURE
 
4806
    process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_TRACKING_ID, 0x00000018);
 
4807
    process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_POSITION_X, 500);
 
4808
    process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_POSITION_Y, 300);
 
4809
    process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0x00000000);
 
4810
 
 
4811
    NotifyMotionArgs args;
 
4812
    ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args));
 
4813
 
 
4814
    // Would be AMOTION_EVENT_ACTION_HOVER_ENTER if pressure value was assumed to be 0 (zero),
 
4815
    // which is de default value when the accumulator is cleared.
 
4816
    ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, args.action);
 
4817
}
 
4818
 
4788
4819
} // namespace android