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

WIP #2467

Closed
Closed

WIP #2467

Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 9 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ jobs:
- uses: gradle/actions/setup-gradle@v4

- run: ./scripts/enforce_git_lfs.sh
- run: ./gradlew kotlinUpgradeYarnLock build -PredwoodNoApps -x dokkaHtml
# - run: ./gradlew kotlinUpgradeYarnLock build -PredwoodNoApps -x dokkaHtml --continue
- run: ./gradlew :redwood-widget:iosSimulatorArm64Test -PredwoodNoApps -x dokkaHtml --continue

- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-report
path: '**/build/reports/tests/**'
retention-days: 1

emulator-tests:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ import platform.UIKit.UIWindow
import platform.UIKit.additionalSafeAreaInsets

class RedwoodUIViewTest {
@Test
fun widgetsAddChildViews() {
val redwoodUIView = RedwoodUIView()

val label = UILabel()
redwoodUIView.children.insert(0, UIViewWidget(label))

assertThat(redwoodUIView.value.subviews).containsExactly(label)
}

// @Test
// fun widgetsAddChildViews() {
// val redwoodUIView = RedwoodUIView()
//
// val label = UILabel()
// redwoodUIView.children.insert(0, UIViewWidget(label))
//
// assertThat(redwoodUIView.value.subviews).containsExactly(label)
// }
//
/**
* Confirm we accept and propagates insets through [RedwoodUIView.uiConfiguration].
*
Expand All @@ -49,26 +49,29 @@ class RedwoodUIViewTest {
*/
@Test
fun viewInsets() {
val redwoodUIView = RedwoodUIView()
val viewController = object : UIViewController(null, null) {
override fun loadView() {
view = redwoodUIView.value
}
}

// val redwoodUIView = RedwoodUIView()
// val viewController = object : UIViewController(null, null) {
// override fun loadView() {
// view = redwoodUIView.value
// }
// }
//
println("MAKING A WINDOW")
val window = UIWindow(
CGRectMake(0.0, 0.0, 390.0, 844.0), // iPhone 14.
)
window.makeKeyAndVisible()
window.rootViewController = viewController

assertThat(redwoodUIView.uiConfiguration.value.viewInsets)
.isEqualTo(Margin.Zero)

viewController.additionalSafeAreaInsets = UIEdgeInsetsMake(10.0, 20.0, 30.0, 40.0)

assertThat(redwoodUIView.uiConfiguration.value.viewInsets)
.isEqualTo(Margin(top = 10.0.dp, start = 20.0.dp, bottom = 30.0.dp, end = 40.0.dp))
println("setHidden(false)")
window.setHidden(false)
println("SUCCESS")
// window.rootViewController = viewController
//
// assertThat(redwoodUIView.uiConfiguration.value.viewInsets)
// .isEqualTo(Margin.Zero)
//
// viewController.additionalSafeAreaInsets = UIEdgeInsetsMake(10.0, 20.0, 30.0, 40.0)
//
// assertThat(redwoodUIView.uiConfiguration.value.viewInsets)
// .isEqualTo(Margin(top = 10.0.dp, start = 20.0.dp, bottom = 30.0.dp, end = 40.0.dp))
}

class UIViewWidget(
Expand Down