[K/N][Tests] Migrate test kt40426
^KT-61259
This commit is contained in:
committed by
Space Team
parent
072d191306
commit
3d70be0c5f
@@ -1112,13 +1112,6 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
UtilsKt.dependsOnPlatformLibs(it)
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("interop_kt40426") {
|
|
||||||
// Test depends on iOS-specific UIKit
|
|
||||||
enabled = (project.testTarget == 'ios_x64' || project.testTarget == 'ios_simulator_arm64' || project.testTarget == 'ios_arm64')
|
|
||||||
source = "interop/objc/kt40426/main.kt"
|
|
||||||
useGoldenData = true
|
|
||||||
UtilsKt.dependsOnPlatformLibs(it)
|
|
||||||
}
|
|
||||||
|
|
||||||
interopTest("interop_objc_kt63423_dispose_on_main_stress") {
|
interopTest("interop_objc_kt63423_dispose_on_main_stress") {
|
||||||
// Test depends on macOS-specific AppKit
|
// Test depends on macOS-specific AppKit
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
SmileView::drawRect
|
|
||||||
SmileView::layoutSubviews
|
|
||||||
+15
-5
@@ -2,32 +2,42 @@
|
|||||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
|
||||||
|
// UIView is available on iOS & tvOS: https://developer.apple.com/documentation/uikit/uiview?language=objc
|
||||||
|
// DISABLE_NATIVE: isAppleTarget=false
|
||||||
|
// DISABLE_NATIVE: targetFamily=OSX
|
||||||
|
// DISABLE_NATIVE: targetFamily=WATCHOS
|
||||||
import kotlinx.cinterop.*
|
import kotlinx.cinterop.*
|
||||||
import platform.UIKit.*
|
import platform.UIKit.*
|
||||||
import platform.CoreGraphics.*
|
import platform.CoreGraphics.*
|
||||||
import platform.Foundation.NSString
|
import platform.Foundation.NSString
|
||||||
|
|
||||||
|
var drawRectInvoked = false
|
||||||
|
var layoutSubviewsInvoked = false
|
||||||
|
|
||||||
class SmileView(frame: CValue<CGRect>): UIView(frame = frame) {
|
class SmileView(frame: CValue<CGRect>): UIView(frame = frame) {
|
||||||
override fun drawRect(rect: CValue<CGRect>) {
|
override fun drawRect(rect: CValue<CGRect>) {
|
||||||
super.drawRect(rect)
|
super.drawRect(rect)
|
||||||
|
|
||||||
val smile = ":)" as NSString
|
val smile = ":)" as NSString
|
||||||
smile.drawInRect(rect, withAttributes = null)
|
smile.drawInRect(rect, withAttributes = null)
|
||||||
println("SmileView::drawRect")
|
drawRectInvoked = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun layoutSubviews() {
|
override fun layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
println("SmileView::layoutSubviews")
|
layoutSubviewsInvoked = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
fun box(): String {
|
||||||
memScoped {
|
return memScoped {
|
||||||
val frame = alloc<CGRect>()
|
val frame = alloc<CGRect>()
|
||||||
val x = SmileView(frame.readValue())
|
val x = SmileView(frame.readValue())
|
||||||
x.drawRect(frame.readValue())
|
x.drawRect(frame.readValue())
|
||||||
|
if (!drawRectInvoked) return@memScoped "FAIL: SmileView::drawRect() was not invoked"
|
||||||
x.layoutSubviews()
|
x.layoutSubviews()
|
||||||
|
if (!layoutSubviewsInvoked) return@memScoped "FAIL: SmileView::layoutSubviews() was not invoked"
|
||||||
|
"OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
@@ -897,6 +897,12 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox
|
|||||||
runTest("native/native.tests/testData/codegen/cinterop/incompleteTypes.kt");
|
runTest("native/native.tests/testData/codegen/cinterop/incompleteTypes.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt40426.kt")
|
||||||
|
public void testKt40426() {
|
||||||
|
runTest("native/native.tests/testData/codegen/cinterop/kt40426.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt43265.kt")
|
@TestMetadata("kt43265.kt")
|
||||||
public void testKt43265() {
|
public void testKt43265() {
|
||||||
|
|||||||
+6
@@ -875,6 +875,12 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes
|
|||||||
runTest("native/native.tests/testData/codegen/cinterop/incompleteTypes.kt");
|
runTest("native/native.tests/testData/codegen/cinterop/incompleteTypes.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt40426.kt")
|
||||||
|
public void testKt40426() {
|
||||||
|
runTest("native/native.tests/testData/codegen/cinterop/kt40426.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt43265.kt")
|
@TestMetadata("kt43265.kt")
|
||||||
public void testKt43265() {
|
public void testKt43265() {
|
||||||
|
|||||||
Reference in New Issue
Block a user