-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFakeNodeBuilder.kt
More file actions
37 lines (34 loc) · 1.18 KB
/
Copy pathFakeNodeBuilder.kt
File metadata and controls
37 lines (34 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.composea11yscanner.rules
import com.composea11yscanner.core.model.A11yNode
import com.composea11yscanner.core.model.A11yRole
import com.composea11yscanner.core.model.Color
import com.composea11yscanner.core.model.Rect
import java.util.concurrent.atomic.AtomicInteger
private val nodeIdSeq = AtomicInteger(0)
fun createNode(
composableName: String = "Box",
bounds: Rect = Rect(0, 0, 100, 100),
contentDescription: String? = null,
isTouchTarget: Boolean = false,
effectiveTouchBounds: Rect? = null,
textColor: Color? = null,
backgroundColors: List<Color> = emptyList(),
isFocusable: Boolean = false,
isMergedDescendant: Boolean = false,
depth: Int = 0,
role: A11yRole? = null,
nodeId: String = "node-${nodeIdSeq.incrementAndGet()}",
): A11yNode = A11yNode(
nodeId = nodeId,
composableName = composableName,
bounds = bounds,
contentDescription = contentDescription,
isTouchTarget = isTouchTarget,
textColor = textColor,
backgroundColors = backgroundColors,
isFocusable = isFocusable,
isMergedDescendant = isMergedDescendant,
depth = depth,
role = role,
effectiveTouchBounds = effectiveTouchBounds,
)