1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "ui/events/ozone/evdev/touch_filter/open_palm_detection_filter.h" 6 7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "ui/events/ozone/evdev/touch_filter/palm_detection_filter.h" 9 #include "ui/events/ozone/evdev/touch_filter/shared_palm_detection_filter_state.h" 10 11 namespace ui { 12 13 class OpenPalmDetectionFilterTest : public testing::Test { 14 public: 15 OpenPalmDetectionFilterTest() = default; 16 SetUp()17 void SetUp() override { 18 shared_palm_state = std::make_unique<SharedPalmDetectionFilterState>(); 19 palm_detection_filter_.reset( 20 new OpenPalmDetectionFilter(shared_palm_state.get())); 21 } 22 23 protected: 24 std::unique_ptr<SharedPalmDetectionFilterState> shared_palm_state; 25 std::unique_ptr<PalmDetectionFilter> palm_detection_filter_; 26 27 DISALLOW_COPY_AND_ASSIGN(OpenPalmDetectionFilterTest); 28 }; 29 TEST_F(OpenPalmDetectionFilterTest,TestSetsToZero)30TEST_F(OpenPalmDetectionFilterTest, TestSetsToZero) { 31 std::bitset<kNumTouchEvdevSlots> suppress, hold; 32 suppress.set(kNumTouchEvdevSlots - 1, 1); 33 hold.set(0, 1); 34 std::vector<InProgressTouchEvdev> inputs; 35 inputs.resize(kNumTouchEvdevSlots); 36 palm_detection_filter_->Filter(inputs, base::TimeTicks::Now(), &hold, 37 &suppress); 38 EXPECT_TRUE(hold.none()); 39 EXPECT_TRUE(suppress.none()); 40 } 41 42 } // namespace ui 43