Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a snapshot test for Path SVG layout #412

Merged
merged 31 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f14f149
Attempt `padding` modifier fusion
MaxDesiatov Aug 5, 2020
0394e53
Fix linter warning
MaxDesiatov Nov 7, 2020
c046152
Add basic support for control snapshot tests
MaxDesiatov Jun 16, 2021
39035cf
Use `CGFloat`, `CGPoint`, `CGRect` from Foundation
MaxDesiatov Jun 16, 2021
0163117
Fix GTK build
MaxDesiatov Jun 17, 2021
6ad4edc
Fix macOS build
MaxDesiatov Jun 17, 2021
800e81a
Merge branch 'foundation-types' of github.com:TokamakUI/Tokamak into …
MaxDesiatov Jun 17, 2021
e7d7651
Implement snapshot tests with headless MS Edge
MaxDesiatov Jun 19, 2021
aae1bb1
Increase snapshot tests timeout
MaxDesiatov Jun 19, 2021
c889192
Force 1.0 resolution scale for headless Edge
MaxDesiatov Jun 19, 2021
8c6292f
Avoid complex layouts in the snapshot test
MaxDesiatov Jun 19, 2021
8ea1695
Exclude dir from target sources, upload failures
MaxDesiatov Jun 20, 2021
c05d14f
Merge branch 'main' of github.com:TokamakUI/Tokamak into padding-fusion
MaxDesiatov Jun 20, 2021
68d0aa5
Add a test to verify that fusion works
MaxDesiatov Jun 20, 2021
216449e
Enable fusion of modifiers nested three times
MaxDesiatov Jun 20, 2021
6ef292d
Filter out empty attributes
MaxDesiatov Jun 20, 2021
ec41560
Run snapshot tests only on macOS for now
MaxDesiatov Jun 20, 2021
24c131c
Fully exclude snapshot testing on WASI
MaxDesiatov Jun 20, 2021
f8c6c59
Fix `testOptional` snapshot
MaxDesiatov Jun 20, 2021
fd52a05
Clean up code formatting
MaxDesiatov Jun 20, 2021
5aae6ae
Merge branch 'padding-fusion' of github.com:TokamakUI/Tokamak into sn…
MaxDesiatov Jun 20, 2021
d0f64af
Copy failed snapshots to a readable directory
MaxDesiatov Jun 20, 2021
9a25721
Make the copy script more resilient
MaxDesiatov Jun 20, 2021
e6c082c
Use `--force-color-profile=srgb` Chromium flag
MaxDesiatov Jun 20, 2021
b688286
Re-enable spooky hanger test
MaxDesiatov Jun 20, 2021
57d24f9
Clean up testSpookyHanger
MaxDesiatov Jun 20, 2021
57cbc55
Fix linter warnings
MaxDesiatov Jun 20, 2021
7aa3556
Fix file_length linter warning
MaxDesiatov Jun 20, 2021
7d9d2bd
Silence linter warning for `Text.attributes` func
MaxDesiatov Jun 20, 2021
9279485
Split `PathLayout.swift` to appease the linter
MaxDesiatov Jun 20, 2021
6724081
Merge branch 'main' into snapshot-tests
MaxDesiatov Jun 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ jobs:
shell: bash
run: |
set -ex
sudo xcode-select --switch /Applications/Xcode_12.3.app/Contents/Developer/
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer/
# avoid building unrelated products for testing by specifying the test product explicitly
swift build --product TokamakPackageTests
`xcrun --find xctest` .build/debug/TokamakPackageTests.xctest
`xcrun --find xctest` .build/debug/TokamakPackageTests.xctest ||
find /var/folders -iname SnapshotTests -exec cp -r {} . \;

rm -rf Sources/TokamakGTKCHelpers/*.c

Expand All @@ -55,6 +56,13 @@ jobs:

./benchmark.sh

- name: Upload failed snapshots
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: Failed snapshots
path: SnapshotTests

gtk_macos_build:
runs-on: macos-latest

Expand All @@ -64,7 +72,7 @@ jobs:
shell: bash
run: |
set -ex
sudo xcode-select --switch /Applications/Xcode_12.3.app/Contents/Developer/
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer/

brew install gtk+3

Expand Down
18 changes: 14 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,19 @@ let package = Package(
url: "https://github.com/swiftwasm/JavaScriptKit.git",
.upToNextMinor(from: "0.10.0")
),
.package(url: "https://github.com/OpenCombine/OpenCombine.git", from: "0.12.0"),
.package(url: "https://github.com/swiftwasm/OpenCombineJS.git", .upToNextMinor(from: "0.1.1")),
.package(name: "Benchmark", url: "https://github.com/google/swift-benchmark", from: "0.1.0"),
.package(
url: "https://github.com/OpenCombine/OpenCombine.git",
from: "0.12.0"
),
.package(
url: "https://github.com/swiftwasm/OpenCombineJS.git",
.upToNextMinor(from: "0.1.1")
),
.package(
name: "Benchmark",
url: "https://github.com/google/swift-benchmark",
from: "0.1.0"
),
.package(
name: "SnapshotTesting",
url: "https://github.com/pointfreeco/swift-snapshot-testing.git",
Expand Down Expand Up @@ -190,7 +200,7 @@ let package = Package(
.product(
name: "SnapshotTesting",
package: "SnapshotTesting",
condition: .when(platforms: [.macOS, .linux])
condition: .when(platforms: [.macOS])
),
],
exclude: ["__Snapshots__"]
Expand Down
3 changes: 2 additions & 1 deletion Sources/TokamakCore/MountedViews/MountedApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ final class MountedApp<R: Renderer>: MountedCompositeElement<R> {

/// Mounts a child scene within the app.
/// - Parameters:
/// - renderer: A instance conforming to the `Renderer` protocol to render the mounted scene with.
/// - renderer: An instance conforming to the `Renderer` protocol to render the mounted
/// scene with.
/// - childBody: The body of the child scene to mount for this app.
/// - Returns: Returns an instance of the `MountedScene` class that's already mounted in this app.
private func mountChild(_ renderer: R, _ childBody: _AnyScene) -> MountedScene<R> {
Expand Down
4 changes: 2 additions & 2 deletions Sources/TokamakCore/MountedViews/MountedCompositeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ final class MountedCompositeView<R: Renderer>: MountedCompositeElement<R> {
mountedChildren = [child]
child.mount(before: sibling, on: self, with: reconciler)

// `_TargetRef` (and `TargetRefType` generic eraser protocol it conforms to) is a composite view, so it's enough
// to check for it only here.
// `_TargetRef` (and `TargetRefType` generic eraser protocol it conforms to) is a composite
// view, so it's enough check for it only here.
if var targetRef = view.view as? TargetRefType {
// `_TargetRef` body is not always a host view that has a target, need to traverse
// all descendants to find a `MountedHostView<R>` instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func _getTypeByMangledNameInContext(
_ genericArguments: UnsafeRawPointer?
) -> Any.Type?

// swiftlint:disable:next line_length
/// https://github.com/apple/swift/blob/f2c42509628bed66bf5b8ee02fae778a2ba747a1/include/swift/Reflection/Records.h#L160
struct FieldDescriptor {
let mangledTypeNameOffset: Int32
Expand Down
Loading