-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support setting the background color for widgets in flex container te…
…sts. (#1730) * Support setting the background color for widgets in flex container tests. * Spotless. * Spotless. * Fix overload ambiguity. * Formatting. * Fix duplicate copyright and UIView tests.
- Loading branch information
1 parent
c71bf7b
commit f275f2a
Showing
18 changed files
with
196 additions
and
84 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
4 changes: 2 additions & 2 deletions
4
...out.composeui_ComposeUiFlexContainerTest_testDynamicContainerSize[LTR]_both.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
...t.composeui_ComposeUiFlexContainerTest_testDynamicContainerSize[LTR]_single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...out.composeui_ComposeUiFlexContainerTest_testDynamicContainerSize[RTL]_both.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...t.composeui_ComposeUiFlexContainerTest_testDynamicContainerSize[RTL]_single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
39 changes: 39 additions & 0 deletions
39
redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/utils.common.kt
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,39 @@ | ||
/* | ||
* Copyright (C) 2023 Square, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
@file:Suppress("ktlint:standard:function-naming", "ktlint:standard:property-naming") | ||
|
||
package app.cash.redwood.layout | ||
|
||
import kotlin.test.assertTrue | ||
|
||
const val Transparent: Int = 0x00000000 | ||
const val Red: Int = 0xffff0000.toInt() | ||
const val Green: Int = 0xff00ff00.toInt() | ||
const val Blue: Int = 0xff0000ff.toInt() | ||
|
||
fun Color( | ||
alpha: Int, | ||
red: Int, | ||
green: Int, | ||
blue: Int, | ||
): Int { | ||
return (alpha shl 24) or (red shl 16) or (green shl 8) or (blue) | ||
} | ||
|
||
/** We don't have assume() on kotlin.test. Tests that fail here should be skipped instead. */ | ||
fun assumeTrue(b: Boolean) { | ||
assertTrue(b) | ||
} |
27 changes: 27 additions & 0 deletions
27
redwood-layout-shared-test/src/iosMain/kotlin/app/cash/redwood/layout/utils.kt
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,27 @@ | ||
/* | ||
* Copyright (C) 2023 Square, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package app.cash.redwood.layout | ||
|
||
import platform.UIKit.UIColor | ||
|
||
fun Int.toUIColor(): UIColor { | ||
return UIColor( | ||
red = ((this shr 16) and 0xff) / 255.0, | ||
green = ((this shr 8) and 0xff) / 255.0, | ||
blue = (this and 0xff) / 255.0, | ||
alpha = ((this shr 24) and 0xff) / 255.0, | ||
) | ||
} |
4 changes: 2 additions & 2 deletions
4
...sts/__Snapshots__/UIViewFlexContainerTestHost/testDynamicContainerSize.both.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
...s/__Snapshots__/UIViewFlexContainerTestHost/testDynamicContainerSize.single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
4 changes: 2 additions & 2 deletions
4
...edwood.layout.view_ViewFlexContainerTest_testDynamicContainerSize[LTR]_both.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...wood.layout.view_ViewFlexContainerTest_testDynamicContainerSize[LTR]_single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.