Skip to content

Commit b40b3af

Browse files
committed
update runnerTests
1 parent c3d09bb commit b40b3af

File tree

5 files changed

+114
-8
lines changed

5 files changed

+114
-8
lines changed

packages/file_selector/file_selector/example/macos/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
platform :osx, '10.14'
1+
platform :osx, '10.15'
22

33
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
44
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

packages/file_selector/file_selector/example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
33CC10EB2044A3C60003C045 /* Resources */,
187187
33CC110E2044A8840003C045 /* Bundle Framework */,
188188
3399D490228B24CF009A79C7 /* ShellScript */,
189+
43898F02A8C2312B24AEE41B /* [CP] Embed Pods Frameworks */,
189190
);
190191
buildRules = (
191192
);
@@ -299,6 +300,23 @@
299300
shellPath = /bin/sh;
300301
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
301302
};
303+
43898F02A8C2312B24AEE41B /* [CP] Embed Pods Frameworks */ = {
304+
isa = PBXShellScriptBuildPhase;
305+
buildActionMask = 2147483647;
306+
files = (
307+
);
308+
inputFileListPaths = (
309+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
310+
);
311+
name = "[CP] Embed Pods Frameworks";
312+
outputFileListPaths = (
313+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
314+
);
315+
runOnlyForDeploymentPostprocessing = 0;
316+
shellPath = /bin/sh;
317+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
318+
showEnvVarsInLog = 0;
319+
};
302320
A778864BDDD7B12C41D66FBB /* [CP] Check Pods Manifest.lock */ = {
303321
isa = PBXShellScriptBuildPhase;
304322
buildActionMask = 2147483647;
@@ -395,7 +413,7 @@
395413
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
396414
GCC_WARN_UNUSED_FUNCTION = YES;
397415
GCC_WARN_UNUSED_VARIABLE = YES;
398-
MACOSX_DEPLOYMENT_TARGET = 10.14;
416+
MACOSX_DEPLOYMENT_TARGET = 10.15;
399417
MTL_ENABLE_DEBUG_INFO = NO;
400418
SDKROOT = macosx;
401419
SWIFT_COMPILATION_MODE = wholemodule;
@@ -474,7 +492,7 @@
474492
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
475493
GCC_WARN_UNUSED_FUNCTION = YES;
476494
GCC_WARN_UNUSED_VARIABLE = YES;
477-
MACOSX_DEPLOYMENT_TARGET = 10.14;
495+
MACOSX_DEPLOYMENT_TARGET = 10.15;
478496
MTL_ENABLE_DEBUG_INFO = YES;
479497
ONLY_ACTIVE_ARCH = YES;
480498
SDKROOT = macosx;
@@ -521,7 +539,7 @@
521539
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
522540
GCC_WARN_UNUSED_FUNCTION = YES;
523541
GCC_WARN_UNUSED_VARIABLE = YES;
524-
MACOSX_DEPLOYMENT_TARGET = 10.14;
542+
MACOSX_DEPLOYMENT_TARGET = 10.15;
525543
MTL_ENABLE_DEBUG_INFO = NO;
526544
SDKROOT = macosx;
527545
SWIFT_COMPILATION_MODE = wholemodule;

packages/file_selector/file_selector_macos/example/macos/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
platform :osx, '10.14'
1+
platform :osx, '10.15'
22

33
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
44
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

packages/file_selector/file_selector_macos/example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
33CC10EB2044A3C60003C045 /* Resources */,
233233
33CC110E2044A8840003C045 /* Bundle Framework */,
234234
3399D490228B24CF009A79C7 /* ShellScript */,
235+
D670A6A16AFB08D3E6D21B41 /* [CP] Embed Pods Frameworks */,
235236
);
236237
buildRules = (
237238
);
@@ -379,6 +380,23 @@
379380
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
380381
showEnvVarsInLog = 0;
381382
};
383+
D670A6A16AFB08D3E6D21B41 /* [CP] Embed Pods Frameworks */ = {
384+
isa = PBXShellScriptBuildPhase;
385+
buildActionMask = 2147483647;
386+
files = (
387+
);
388+
inputFileListPaths = (
389+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
390+
);
391+
name = "[CP] Embed Pods Frameworks";
392+
outputFileListPaths = (
393+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
394+
);
395+
runOnlyForDeploymentPostprocessing = 0;
396+
shellPath = /bin/sh;
397+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
398+
showEnvVarsInLog = 0;
399+
};
382400
/* End PBXShellScriptBuildPhase section */
383401

384402
/* Begin PBXSourcesBuildPhase section */
@@ -466,7 +484,7 @@
466484
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
467485
GCC_WARN_UNUSED_FUNCTION = YES;
468486
GCC_WARN_UNUSED_VARIABLE = YES;
469-
MACOSX_DEPLOYMENT_TARGET = 10.14;
487+
MACOSX_DEPLOYMENT_TARGET = 10.15;
470488
MTL_ENABLE_DEBUG_INFO = NO;
471489
SDKROOT = macosx;
472490
SWIFT_COMPILATION_MODE = wholemodule;
@@ -599,7 +617,7 @@
599617
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
600618
GCC_WARN_UNUSED_FUNCTION = YES;
601619
GCC_WARN_UNUSED_VARIABLE = YES;
602-
MACOSX_DEPLOYMENT_TARGET = 10.14;
620+
MACOSX_DEPLOYMENT_TARGET = 10.15;
603621
MTL_ENABLE_DEBUG_INFO = YES;
604622
ONLY_ACTIVE_ARCH = YES;
605623
SDKROOT = macosx;
@@ -646,7 +664,7 @@
646664
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
647665
GCC_WARN_UNUSED_FUNCTION = YES;
648666
GCC_WARN_UNUSED_VARIABLE = YES;
649-
MACOSX_DEPLOYMENT_TARGET = 10.14;
667+
MACOSX_DEPLOYMENT_TARGET = 10.15;
650668
MTL_ENABLE_DEBUG_INFO = NO;
651669
SDKROOT = macosx;
652670
SWIFT_COMPILATION_MODE = wholemodule;

packages/file_selector/file_selector_macos/example/macos/RunnerTests/RunnerTests.swift

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,10 @@ class ExampleTests: XCTestCase {
330330

331331
wait(for: [called])
332332
XCTAssertNotNil(panelController.savePanel)
333+
if let panel = panelController.savePanel {
334+
// By default, "New Folder" button is visible for Save dialogs
335+
XCTAssertTrue(panel.canCreateDirectories)
336+
}
333337
}
334338

335339
func testSaveWithArguments() throws {
@@ -365,6 +369,35 @@ class ExampleTests: XCTestCase {
365369
}
366370
}
367371

372+
func testSaveNewFolderHidden() throws {
373+
let panelController = TestPanelController()
374+
let plugin = FileSelectorPlugin(
375+
viewProvider: TestViewProvider(),
376+
panelController: panelController)
377+
378+
let returnPath = "/foo/bar"
379+
panelController.saveURL = URL(fileURLWithPath: returnPath)
380+
381+
let called = XCTestExpectation()
382+
let options = SavePanelOptions(canCreateDirectories: false)
383+
384+
plugin.displaySavePanel(options: options) { result in
385+
switch result {
386+
case .success(let path):
387+
XCTAssertEqual(path, returnPath)
388+
case .failure(let error):
389+
XCTFail("\(error)")
390+
}
391+
called.fulfill()
392+
}
393+
394+
wait(for: [called])
395+
XCTAssertNotNil(panelController.savePanel)
396+
if let panel = panelController.savePanel {
397+
XCTAssertFalse(panel.canCreateDirectories)
398+
}
399+
}
400+
368401
func testSaveCancel() throws {
369402
let panelController = TestPanelController()
370403
let plugin = FileSelectorPlugin(
@@ -421,6 +454,8 @@ class ExampleTests: XCTestCase {
421454
// The Dart API only allows a single directory to be returned, so users shouldn't be allowed
422455
// to select multiple.
423456
XCTAssertFalse(panel.allowsMultipleSelection)
457+
// By default, "New Folder" button is hidden for Choose Directory dialogs.
458+
XCTAssertFalse(panel.canCreateDirectories)
424459
}
425460
}
426461

@@ -482,6 +517,8 @@ class ExampleTests: XCTestCase {
482517
// For consistency across platforms, file selection is disabled.
483518
XCTAssertFalse(panel.canChooseFiles)
484519
XCTAssertTrue(panel.allowsMultipleSelection)
520+
// By default, "New Folder" button is hidden for Choose Directory dialogs.
521+
XCTAssertFalse(panel.canCreateDirectories)
485522
}
486523
}
487524

@@ -510,4 +547,37 @@ class ExampleTests: XCTestCase {
510547
wait(for: [called])
511548
XCTAssertNotNil(panelController.openPanel)
512549
}
550+
551+
func testGetDirectoryNewFolderVisible() throws {
552+
let panelController = TestPanelController()
553+
let plugin = FileSelectorPlugin(
554+
viewProvider: TestViewProvider(),
555+
panelController: panelController)
556+
557+
let returnPath = "/foo/bar"
558+
panelController.openURLs = [URL(fileURLWithPath: returnPath)]
559+
560+
let called = XCTestExpectation()
561+
let options = OpenPanelOptions(
562+
allowsMultipleSelection: false,
563+
canChooseDirectories: true,
564+
canChooseFiles: false,
565+
baseOptions: SavePanelOptions(canCreateDirectories: true))
566+
567+
plugin.displayOpenPanel(options: options) { result in
568+
switch result {
569+
case .success(let paths):
570+
XCTAssertEqual(paths[0], returnPath)
571+
case .failure(let error):
572+
XCTFail("\(error)")
573+
}
574+
called.fulfill()
575+
}
576+
577+
wait(for: [called])
578+
XCTAssertNotNil(panelController.openPanel)
579+
if let panel = panelController.openPanel {
580+
XCTAssertTrue(panel.canCreateDirectories)
581+
}
582+
}
513583
}

0 commit comments

Comments
 (0)