8#include <unordered_set>
10#include "gtest/gtest.h"
19TEST(AXNodeDataTest, GetAndSetCheckedState) {
37TEST(AXNodeDataTest, TextAttributes) {
81 EXPECT_EQ(tooltip,
"test tooltip");
89TEST(AXNodeDataTest, IsButtonPressed) {
137 for (
int action_verb_idx =
144 bool is_clickable = data_default_action_verb.
IsClickable();
146 SCOPED_TRACE(testing::Message()
147 <<
"ax::mojom::DefaultActionVerb="
149 <<
", Actual: isClickable=" << is_clickable
150 <<
", Expected: isClickable=" << !is_clickable);
156 EXPECT_FALSE(is_clickable);
162 std::set<ax::mojom::Role> roles_expected_is_clickable = {
200 bool is_clickable =
data.IsClickable();
202 SCOPED_TRACE(testing::Message()
204 <<
", Actual: isClickable=" << is_clickable
205 <<
", Expected: isClickable=" << !is_clickable);
212TEST(AXNodeDataTest, IsInvocable) {
220 bool is_activatable =
data.IsActivatable();
221 const bool supports_expand_collapse =
data.SupportsExpandCollapse();
223 const bool is_clickable =
data.IsClickable();
224 const bool is_invocable =
data.IsInvocable();
226 SCOPED_TRACE(testing::Message()
228 <<
", isClickable=" << is_clickable <<
", isActivatable="
229 << is_activatable <<
", supportsToggle=" << supports_toggle
230 <<
", supportsExpandCollapse=" << supports_expand_collapse
231 <<
", Actual: isInvocable=" << is_invocable
232 <<
", Expected: isInvocable=" << !is_invocable);
234 if (is_clickable && !is_activatable && !supports_toggle &&
235 !supports_expand_collapse)
238 EXPECT_FALSE(is_invocable);
242TEST(AXNodeDataTest, IsMenuButton) {
262 SCOPED_TRACE(testing::Message()
263 <<
"ax::mojom::Role=" <<
ToString(button_with_popup.
role)
265 <<
", Actual: isMenuButton=" << is_menu_button
266 <<
", Expected: isMenuButton=" << !is_menu_button);
272 EXPECT_FALSE(is_menu_button);
287 SCOPED_TRACE(testing::Message() <<
"ax::mojom::HasPopup="
289 <<
", Actual: supportsExpandCollapse="
290 << supports_expand_collapse
291 <<
", Expected: supportsExpandCollapse="
292 << !supports_expand_collapse);
295 EXPECT_FALSE(supports_expand_collapse);
318 SCOPED_TRACE(testing::Message() <<
"ax::mojom::State=" <<
ToString(
state)
319 <<
", Actual: supportsExpandCollapse="
320 << supports_expand_collapse
321 <<
", Expected: supportsExpandCollapse="
322 << !supports_expand_collapse);
328 EXPECT_FALSE(supports_expand_collapse);
337 std::unordered_set<ax::mojom::Role> roles_expected_supports_expand_collapse =
345 bool supports_expand_collapse =
data.SupportsExpandCollapse();
347 SCOPED_TRACE(testing::Message() <<
"ax::mojom::Role=" <<
ToString(
data.role)
348 <<
", Actual: supportsExpandCollapse="
349 << supports_expand_collapse
350 <<
", Expected: supportsExpandCollapse="
351 << !supports_expand_collapse);
353 if (roles_expected_supports_expand_collapse.find(
data.role) !=
354 roles_expected_supports_expand_collapse.end())
357 EXPECT_FALSE(supports_expand_collapse);
361TEST(AXNodeDataTest, BitFieldsSanityCheck) {
@ kPdfActionableHighlight
bool Contains(const Container &container, const Value &value)
TEST(AXEnumUtilTest, Event)
const char * ToString(ax::mojom::Event event)
bool SupportsExpandCollapse(const ax::mojom::Role role)
bool SupportsToggle(const ax::mojom::Role role)
bool IsClickable(const ax::mojom::Role role)
bool IsButton(const ax::mojom::Role role)
void AddFloatAttribute(ax::mojom::FloatAttribute attribute, float value)
bool HasState(ax::mojom::State state) const
ax::mojom::HasPopup GetHasPopup() const
void AddState(ax::mojom::State state)
void SetDefaultActionVerb(ax::mojom::DefaultActionVerb default_action_verb)
void RemoveIntAttribute(ax::mojom::IntAttribute attribute)
void AddIntAttribute(ax::mojom::IntAttribute attribute, int32_t value)
void SetHasPopup(ax::mojom::HasPopup has_popup)
ax::mojom::DefaultActionVerb GetDefaultActionVerb() const
AXNodeTextStyles GetTextStyles() const
bool IsButtonPressed() const
void RemoveState(ax::mojom::State state)
void AddStringAttribute(ax::mojom::StringAttribute attribute, const std::string &value)
const std::string & GetStringAttribute(ax::mojom::StringAttribute attribute) const
void RemoveStringAttribute(ax::mojom::StringAttribute attribute)
bool SupportsExpandCollapse() const
void SetCheckedState(ax::mojom::CheckedState checked_state)
bool IsMenuButton() const
std::shared_ptr< const fml::Mapping > data
#define EXPECT_TRUE(handle)