Example #1
0
TEST(FlagStatus, temporary_decrease) {
  FlagStatus flagStatus;

  flagStatus.increase(ModifierFlag::COMMAND_L | ModifierFlag::CONTROL_L);
  EXPECT_EQ(Flags(ModifierFlag::COMMAND_L | ModifierFlag::CONTROL_L), flagStatus.makeFlags());

  flagStatus.temporary_decrease(ModifierFlag::CONTROL_L);
  EXPECT_EQ(Flags(ModifierFlag::COMMAND_L), flagStatus.makeFlags());

  // temporary_increase will reset by flagStatus.set
  flagStatus.set(KeyCode::COMMAND_L, Flags(ModifierFlag::COMMAND_L));
  EXPECT_EQ(Flags(ModifierFlag::COMMAND_L | ModifierFlag::CONTROL_L), flagStatus.makeFlags());
}