-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RUM-7484 Add placeholder for unknown SwiftUI content
- Loading branch information
Showing
4 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...apshotProducer/ViewTreeSnapshot/NodeRecorders/SwiftUI/SwiftUIWireframesBuilderTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2019-Present Datadog, Inc. | ||
*/ | ||
|
||
import XCTest | ||
|
||
#if os(iOS) | ||
import XCTest | ||
import SwiftUI | ||
import DatadogInternal | ||
import TestUtilities | ||
|
||
@_spi(Internal) | ||
@testable import DatadogSessionReplay | ||
|
||
@available(iOS 13.0, tvOS 13.0, *) | ||
class SwiftUIWireframesBuilderTests: XCTestCase { | ||
func testDisplayListWithUnknownContent_itReturnsAPlaceholder() throws { | ||
// Given | ||
// - DisplayList with unknown content | ||
let renderer = DisplayList.ViewUpdater( | ||
viewCache: DisplayList.ViewUpdater.ViewCache(map: [:]), | ||
lastList: DisplayList.Lazy( | ||
DisplayList(items: [ | ||
DisplayList.Item( | ||
identity: DisplayList.Identity(value: .mockRandom()), | ||
frame: .mockAny(), | ||
value: .content(DisplayList.Content( | ||
seed: DisplayList.Seed(value: .mockRandom()), | ||
value: .unknown | ||
)) | ||
) | ||
]) | ||
) | ||
) | ||
|
||
let builder = SwiftUIWireframesBuilder( | ||
wireframeID: .mockRandom(), | ||
renderer: renderer, | ||
textObfuscator: TextObfuscatorMock(), | ||
fontScalingEnabled: true, | ||
imagePrivacyLevel: .maskNone, | ||
attributes: .mockRandom() | ||
) | ||
|
||
// When | ||
let wireframes = builder.buildWireframes(with: WireframesBuilder()) | ||
|
||
// Then | ||
let wireframe = try XCTUnwrap(wireframes.last?.placeholderWireframe) | ||
XCTAssertEqual(wireframe.label, "Unsupported SwiftUI component") | ||
} | ||
} | ||
|
||
#endif |