forked from flutter/packages
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wide gamut and platform view integration test. (#138837)
In flutter/engine#48190 I discovered that overlay surfaces were not constructed with wide gamut settings. This adds a test that will fail until this is fixed.
- Loading branch information
1 parent
397fd25
commit 389ebd4
Showing
4 changed files
with
123 additions
and
0 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
24 changes: 24 additions & 0 deletions
24
dev/integration_tests/wide_gamut_test/ios/Runner/AppDelegate.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,24 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import UIKit | ||
import Flutter | ||
|
||
@UIApplicationMain | ||
@objc class AppDelegate: FlutterAppDelegate { | ||
override func application( | ||
_ application: UIApplication, | ||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | ||
) -> Bool { | ||
GeneratedPluginRegistrant.register(with: self) | ||
|
||
var registrar = self.registrar(forPlugin: "plugin-name") | ||
let factory = FLNativeViewFactory(messenger: registrar!.messenger()) | ||
self.registrar(forPlugin: "<plugin-name>")!.register( | ||
factory, | ||
withId: "<dummy-view>") | ||
|
||
return super.application(application, didFinishLaunchingWithOptions: launchOptions) | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
dev/integration_tests/wide_gamut_test/ios/Runner/DummyPlatformView.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,68 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import Foundation | ||
|
||
import Flutter | ||
import UIKit | ||
|
||
class FLNativeViewFactory: NSObject, FlutterPlatformViewFactory { | ||
private var messenger: FlutterBinaryMessenger | ||
|
||
init(messenger: FlutterBinaryMessenger) { | ||
self.messenger = messenger | ||
super.init() | ||
} | ||
|
||
func create( | ||
withFrame frame: CGRect, | ||
viewIdentifier viewId: Int64, | ||
arguments args: Any? | ||
) -> FlutterPlatformView { | ||
return FLNativeView( | ||
frame: frame, | ||
viewIdentifier: viewId, | ||
arguments: args, | ||
binaryMessenger: messenger) | ||
} | ||
|
||
public func createArgsCodec() -> FlutterMessageCodec & NSObjectProtocol { | ||
return FlutterStandardMessageCodec.sharedInstance() | ||
} | ||
} | ||
|
||
class SolidColorView: UIView { | ||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
setupView() | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
super.init(coder: aDecoder) | ||
setupView() | ||
} | ||
|
||
private func setupView() { | ||
backgroundColor = .blue | ||
} | ||
} | ||
|
||
|
||
class FLNativeView: NSObject, FlutterPlatformView { | ||
private var view: UIView | ||
|
||
init( | ||
frame: CGRect, | ||
viewIdentifier viewId: Int64, | ||
arguments args: Any?, | ||
binaryMessenger messenger: FlutterBinaryMessenger? | ||
) { | ||
view = SolidColorView() | ||
super.init() | ||
} | ||
|
||
func view() -> UIView { | ||
return view | ||
} | ||
} |
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