本文整理汇总了C++中FlagStatus::set方法的典型用法代码示例。如果您正苦于以下问题:C++ FlagStatus::set方法的具体用法?C++ FlagStatus::set怎么用?C++ FlagStatus::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlagStatus
的用法示例。
在下文中一共展示了FlagStatus::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Flags
TEST(FlagStatus, negative_lock_increase) {
FlagStatus flagStatus;
// ----------------------------------------
flagStatus.negative_lock_increase(ModifierFlag::COMMAND_L);
EXPECT_EQ(Flags(0), flagStatus.makeFlags());
flagStatus.increase(ModifierFlag::COMMAND_L);
EXPECT_EQ(Flags(0), flagStatus.makeFlags());
flagStatus.increase(ModifierFlag::COMMAND_L);
EXPECT_EQ(Flags(ModifierFlag::COMMAND_L), flagStatus.makeFlags());
// ----------------------------------------
// lock don't cancel by reset & set.
flagStatus.reset();
flagStatus.set(KeyCode::A, Flags(0));
EXPECT_EQ(Flags(0), flagStatus.makeFlags());
flagStatus.increase(ModifierFlag::COMMAND_L);
EXPECT_EQ(Flags(0), flagStatus.makeFlags());
flagStatus.increase(ModifierFlag::COMMAND_L);
EXPECT_EQ(Flags(ModifierFlag::COMMAND_L), flagStatus.makeFlags());
// ----------------------------------------
flagStatus.reset();
flagStatus.negative_lock_decrease(ModifierFlag::COMMAND_L);
EXPECT_EQ(Flags(0), flagStatus.makeFlags());
flagStatus.increase(ModifierFlag::COMMAND_L);
EXPECT_EQ(Flags(ModifierFlag::COMMAND_L), flagStatus.makeFlags());
}
示例2: Flags
TEST(FlagStatus, CapsLock) {
FlagStatus flagStatus;
flagStatus.set(KeyCode::CAPSLOCK, Flags(ModifierFlag::CAPSLOCK));
EXPECT_EQ(Flags(ModifierFlag::CAPSLOCK), flagStatus.makeFlags());
flagStatus.reset();
flagStatus.set(KeyCode::A, Flags(ModifierFlag::CAPSLOCK));
EXPECT_EQ(Flags(ModifierFlag::CAPSLOCK), flagStatus.makeFlags());
// from other keyboard
flagStatus.set(KeyCode::A, Flags(0));
EXPECT_EQ(Flags(ModifierFlag::CAPSLOCK), flagStatus.makeFlags());
flagStatus.set(KeyCode::A, Flags(ModifierFlag::CAPSLOCK));
EXPECT_EQ(Flags(ModifierFlag::CAPSLOCK), flagStatus.makeFlags());
// reset
flagStatus.set(KeyCode::CAPSLOCK, Flags(0));
EXPECT_EQ(Flags(), flagStatus.makeFlags());
// soft caps
flagStatus.lock_increase(ModifierFlag::CAPSLOCK);
flagStatus.set(KeyCode::A, Flags(0));
EXPECT_EQ(Flags(ModifierFlag::CAPSLOCK), flagStatus.makeFlags());
// soft caps will be canceled by hardware caps
flagStatus.set(KeyCode::CAPSLOCK, Flags(0));
EXPECT_EQ(Flags(0), flagStatus.makeFlags());
}