Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
42eb9032
Unverified
Commit
42eb9032
authored
Oct 20, 2021
by
Chris Yang
Committed by
GitHub
Oct 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] iOS: display name defaults to the Title Case of flutter project name. (#91529)
parent
a6e91c36
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
182 additions
and
18 deletions
+182
-18
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+2
-2
utils.dart
packages/flutter_tools/lib/src/base/utils.dart
+11
-2
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+1
-1
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+2
-2
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+5
-0
create_base.dart
packages/flutter_tools/lib/src/commands/create_base.dart
+3
-0
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+1
-1
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+1
-1
xcodeproj.dart
packages/flutter_tools/lib/src/ios/xcodeproj.dart
+1
-1
build_linux.dart
packages/flutter_tools/lib/src/linux/build_linux.dart
+1
-1
application_package.dart
...ages/flutter_tools/lib/src/macos/application_package.dart
+1
-1
application_package.dart
...es/flutter_tools/lib/src/windows/application_package.dart
+1
-1
build_windows.dart
packages/flutter_tools/lib/src/windows/build_windows.dart
+1
-1
windows_device.dart
packages/flutter_tools/lib/src/windows/windows_device.dart
+1
-1
xcode_project.dart
packages/flutter_tools/lib/src/xcode_project.dart
+7
-1
Info.plist.tmpl
...ools/templates/app_shared/ios.tmpl/Runner/Info.plist.tmpl
+2
-0
Info.plist.tmpl
...module/ios/host_app_ephemeral/Runner.tmpl/Info.plist.tmpl
+2
-0
build_linux_test.dart
..._tools/test/commands.shard/hermetic/build_linux_test.dart
+1
-1
create_test.dart
...tter_tools/test/commands.shard/permeable/create_test.dart
+115
-0
plugins_test.dart
packages/flutter_tools/test/general.shard/plugins_test.dart
+1
-1
utils_test.dart
packages/flutter_tools/test/general.shard/utils_test.dart
+22
-0
No files found.
packages/flutter_tools/lib/src/android/gradle.dart
View file @
42eb9032
...
...
@@ -69,7 +69,7 @@ Directory getRepoDirectory(Directory buildDirectory) {
String
_taskFor
(
String
prefix
,
BuildInfo
buildInfo
)
{
final
String
buildType
=
camelCase
(
buildInfo
.
modeName
);
final
String
productFlavor
=
buildInfo
.
flavor
??
''
;
return
'
$prefix${
toTitleCase(productFlavor)}${toTitl
eCase(buildType)}
'
;
return
'
$prefix${
sentenceCase(productFlavor)}${sentenc
eCase(buildType)}
'
;
}
/// Returns the task to build an APK.
...
...
@@ -592,7 +592,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
command
.
addAll
(
androidBuildInfo
.
buildInfo
.
toGradleConfig
());
if
(
buildInfo
.
dartObfuscation
&&
buildInfo
.
mode
!=
BuildMode
.
release
)
{
_logger
.
printStatus
(
'Dart obfuscation is not supported in
${
toTitl
eCase(buildInfo.friendlyModeName)}
'
'Dart obfuscation is not supported in
${
sentenc
eCase(buildInfo.friendlyModeName)}
'
' mode, building as un-obfuscated.'
,
);
}
...
...
packages/flutter_tools/lib/src/base/utils.dart
View file @
42eb9032
...
...
@@ -34,11 +34,20 @@ String snakeCase(String str, [ String sep = '_' ]) {
(
Match
m
)
=>
'
${m.start == 0 ? '' : sep}${m[0]!.toLowerCase()}
'
);
}
String
toTitleCase
(
String
str
)
{
/// Converts `fooBar` to `FooBar`.
///
/// This uses [toBeginningOfSentenceCase](https://pub.dev/documentation/intl/latest/intl/toBeginningOfSentenceCase.html),
/// with the input and return value of non-nullable.
String
sentenceCase
(
String
str
,
[
String
?
locale
])
{
if
(
str
.
isEmpty
)
{
return
str
;
}
return
str
.
substring
(
0
,
1
).
toUpperCase
()
+
str
.
substring
(
1
);
return
toBeginningOfSentenceCase
(
str
,
locale
)!;
}
/// Converts `foo_bar` to `Foo Bar`.
String
snakeCaseToTitleCase
(
String
snakeCaseString
)
{
return
snakeCaseString
.
split
(
'_'
).
map
(
camelCase
).
map
(
sentenceCase
).
join
(
' '
);
}
/// Return the plural of the given word (`cat(s)`).
...
...
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
42eb9032
...
...
@@ -236,7 +236,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
throwToolExit
(
'Building for iOS is only supported on macOS.'
);
}
if
(
environmentType
==
EnvironmentType
.
simulator
&&
!
buildInfo
.
supportsSimulator
)
{
throwToolExit
(
'
${
toTitl
eCase(buildInfo.friendlyModeName)}
mode is not supported for simulators.'
);
throwToolExit
(
'
${
sentenc
eCase(buildInfo.friendlyModeName)}
mode is not supported for simulators.'
);
}
if
(
configOnly
&&
buildInfo
.
codeSizeDirectory
!=
null
)
{
throwToolExit
(
'Cannot analyze code size without performing a full build.'
);
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
42eb9032
...
...
@@ -179,7 +179,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
for
(
final
BuildInfo
buildInfo
in
buildInfos
)
{
final
String
productBundleIdentifier
=
await
_project
.
ios
.
productBundleIdentifier
(
buildInfo
);
globals
.
printStatus
(
'Building frameworks for
$productBundleIdentifier
in
${getNameForBuildMode(buildInfo.mode)}
mode...'
);
final
String
xcodeBuildConfiguration
=
toTitl
eCase
(
getNameForBuildMode
(
buildInfo
.
mode
));
final
String
xcodeBuildConfiguration
=
sentenc
eCase
(
getNameForBuildMode
(
buildInfo
.
mode
));
final
Directory
modeDirectory
=
outputDirectory
.
childDirectory
(
xcodeBuildConfiguration
);
if
(
modeDirectory
.
existsSync
())
{
...
...
@@ -446,7 +446,7 @@ end
}
// Always build debug for simulator.
final String simulatorConfiguration =
toTitl
eCase(getNameForBuildMode(BuildMode.debug));
final String simulatorConfiguration =
sentenc
eCase(getNameForBuildMode(BuildMode.debug));
pluginsBuildCommand = <String>[
...globals.xcode.xcrunCommand(),
'
xcodebuild
',
...
...
packages/flutter_tools/lib/src/commands/create.dart
View file @
42eb9032
...
...
@@ -10,6 +10,7 @@ import '../base/context.dart';
import
'../base/file_system.dart'
;
import
'../base/net.dart'
;
import
'../base/terminal.dart'
;
import
'../base/utils.dart'
;
import
'../convert.dart'
;
import
'../dart/pub.dart'
;
import
'../features.dart'
;
...
...
@@ -247,9 +248,13 @@ class CreateCommand extends CreateBase {
);
}
// The dart project_name is in snake_case, this variable is the Title Case of the Project Name.
final
String
titleCaseProjectName
=
snakeCaseToTitleCase
(
projectName
);
final
Map
<
String
,
Object
>
templateContext
=
createTemplateContext
(
organization:
organization
,
projectName:
projectName
,
titleCaseProjectName:
titleCaseProjectName
,
projectDescription:
stringArg
(
'description'
),
flutterRoot:
flutterRoot
,
withPluginHook:
generatePlugin
,
...
...
packages/flutter_tools/lib/src/commands/create_base.dart
View file @
42eb9032
...
...
@@ -317,6 +317,7 @@ abstract class CreateBase extends FlutterCommand {
throwToolExit
(
error
);
}
}
assert
(
projectName
!=
null
);
return
projectName
;
}
...
...
@@ -325,6 +326,7 @@ abstract class CreateBase extends FlutterCommand {
Map
<
String
,
Object
>
createTemplateContext
({
String
organization
,
String
projectName
,
String
titleCaseProjectName
,
String
projectDescription
,
String
androidLanguage
,
String
iosDevelopmentTeam
,
...
...
@@ -361,6 +363,7 @@ abstract class CreateBase extends FlutterCommand {
return
<
String
,
Object
>{
'organization'
:
organization
,
'projectName'
:
projectName
,
'titleCaseProjectName'
:
titleCaseProjectName
,
'androidIdentifier'
:
androidIdentifier
,
'iosIdentifier'
:
appleIdentifier
,
'macosIdentifier'
:
appleIdentifier
,
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
42eb9032
...
...
@@ -462,7 +462,7 @@ class AppDomain extends Domain {
})
async
{
if
(!
await
device
.
supportsRuntimeMode
(
options
.
buildInfo
.
mode
))
{
throw
Exception
(
'
${
toTitl
eCase(options.buildInfo.friendlyModeName)}
'
'
${
sentenc
eCase(options.buildInfo.friendlyModeName)}
'
'mode is not supported for
${device.name}
.'
,
);
}
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
42eb9032
...
...
@@ -587,7 +587,7 @@ class RunCommand extends RunCommandBase {
for
(
final
Device
device
in
devices
)
{
if
(!
await
device
.
supportsRuntimeMode
(
buildMode
))
{
throwToolExit
(
'
${
toTitl
eCase(getFriendlyModeName(buildMode))}
'
'
${
sentenc
eCase(getFriendlyModeName(buildMode))}
'
'mode is not supported by
${device.name}
.'
,
);
}
...
...
packages/flutter_tools/lib/src/ios/xcodeproj.dart
View file @
42eb9032
...
...
@@ -435,7 +435,7 @@ class XcodeProjectInfo {
/// The expected scheme for [buildInfo].
@visibleForTesting
static
String
expectedSchemeFor
(
BuildInfo
?
buildInfo
)
{
return
toTitl
eCase
(
buildInfo
?.
flavor
??
'runner'
);
return
sentenc
eCase
(
buildInfo
?.
flavor
??
'runner'
);
}
/// The expected build configuration for [buildInfo] and [scheme].
...
...
packages/flutter_tools/lib/src/linux/build_linux.dart
View file @
42eb9032
...
...
@@ -119,7 +119,7 @@ Future<void> _runCmake(String buildModeName, Directory sourceDir, Directory buil
await
buildDir
.
create
(
recursive:
true
);
final
String
buildFlag
=
toTitl
eCase
(
buildModeName
);
final
String
buildFlag
=
sentenc
eCase
(
buildModeName
);
final
bool
needCrossBuildOptionsForArm64
=
needCrossBuild
&&
targetPlatform
==
TargetPlatform
.
linux_arm64
;
int
result
;
...
...
packages/flutter_tools/lib/src/macos/application_package.dart
View file @
42eb9032
...
...
@@ -154,7 +154,7 @@ class BuildableMacOSApp extends MacOSApp {
getMacOSBuildDirectory
(),
'Build'
,
'Products'
,
toTitl
eCase
(
getNameForBuildMode
(
buildMode
)),
sentenc
eCase
(
getNameForBuildMode
(
buildMode
)),
appBundleNameFile
.
readAsStringSync
().
trim
());
}
...
...
packages/flutter_tools/lib/src/windows/application_package.dart
View file @
42eb9032
...
...
@@ -63,7 +63,7 @@ class BuildableWindowsApp extends WindowsApp {
return
globals
.
fs
.
path
.
join
(
getWindowsBuildDirectory
(),
'runner'
,
toTitl
eCase
(
getNameForBuildMode
(
buildMode
)),
sentenc
eCase
(
getNameForBuildMode
(
buildMode
)),
'
$binaryName
.exe'
,
);
}
...
...
packages/flutter_tools/lib/src/windows/build_windows.dart
View file @
42eb9032
...
...
@@ -279,7 +279,7 @@ Future<void> _runBuild(
'--build'
,
buildDir
.
path
,
'--config'
,
toTitl
eCase
(
buildModeName
),
sentenc
eCase
(
buildModeName
),
if
(
install
)
...<
String
>[
'--target'
,
'INSTALL'
],
if
(
globals
.
logger
.
isVerbose
)
...
...
packages/flutter_tools/lib/src/windows/windows_device.dart
View file @
42eb9032
...
...
@@ -194,7 +194,7 @@ class WindowsUWPDevice extends Device {
}
final
String
binaryDir
=
_fileSystem
.
path
.
absolute
(
_fileSystem
.
path
.
join
(
'build'
,
'winuwp'
,
'runner_uwp'
,
'AppPackages'
,
binaryName
));
final
String
config
=
toTitl
eCase
(
getNameForBuildMode
(
_buildMode
??
BuildMode
.
debug
));
final
String
config
=
sentenc
eCase
(
getNameForBuildMode
(
_buildMode
??
BuildMode
.
debug
));
// If a multi-architecture package exists, install that; otherwise install
// the single-architecture package.
...
...
packages/flutter_tools/lib/src/xcode_project.dart
View file @
42eb9032
...
...
@@ -485,11 +485,17 @@ class IosProject extends XcodeBasedProject {
terminal:
globals
.
terminal
,
);
final
String
projectName
=
parent
.
manifest
.
appName
;
// The dart project_name is in snake_case, this variable is the Title Case of the Project Name.
final
String
titleCaseProjectName
=
snakeCaseToTitleCase
(
projectName
);
template
.
render
(
target
,
<
String
,
Object
>{
'ios'
:
true
,
'projectName'
:
parent
.
manifest
.
appName
,
'projectName'
:
projectName
,
'titleCaseProjectName'
:
titleCaseProjectName
,
'iosIdentifier'
:
iosBundleIdentifier
,
'hasIosDevelopmentTeam'
:
iosDevelopmentTeam
!=
null
&&
iosDevelopmentTeam
.
isNotEmpty
,
'iosDevelopmentTeam'
:
iosDevelopmentTeam
??
''
,
...
...
packages/flutter_tools/templates/app_shared/ios.tmpl/Runner/Info.plist.tmpl
View file @
42eb9032
...
...
@@ -4,6 +4,8 @@
<dict>
<key>
CFBundleDevelopmentRegion
</key>
<string>
$(DEVELOPMENT_LANGUAGE)
</string>
<key>
CFBundleDisplayName
</key>
<string>
{{titleCaseProjectName}}
</string>
<key>
CFBundleExecutable
</key>
<string>
$(EXECUTABLE_NAME)
</string>
<key>
CFBundleIdentifier
</key>
...
...
packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Info.plist.tmpl
View file @
42eb9032
...
...
@@ -12,6 +12,8 @@
<string>
6.0
</string>
<key>
CFBundleName
</key>
<string>
{{projectName}}
</string>
<key>
CFBundleDisplayName
</key>
<string>
{{titleCaseProjectName}}
</string>
<key>
CFBundlePackageType
</key>
<string>
APPL
</string>
<key>
CFBundleShortVersionString
</key>
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart
View file @
42eb9032
...
...
@@ -78,7 +78,7 @@ void main() {
'cmake'
,
'-G'
,
'Ninja'
,
'-DCMAKE_BUILD_TYPE=
${
toTitl
eCase(buildMode)}
'
,
'-DCMAKE_BUILD_TYPE=
${
sentenc
eCase(buildMode)}
'
,
'-DFLUTTER_TARGET_PLATFORM=linux-
$target
'
,
'/linux'
,
],
...
...
packages/flutter_tools/test/commands.shard/permeable/create_test.dart
View file @
42eb9032
...
...
@@ -1363,6 +1363,114 @@ void main() {
ProcessManager:
()
=>
fakeProcessManager
,
});
testUsingContext
(
'display name is Title Case for objc iOS project.'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=app'
,
'--no-pub'
,
'--org'
,
'com.foo.bar'
,
'--ios-language=objc'
,
'--project-name=my_project'
,
projectDir
.
path
]);
final
String
plistPath
=
globals
.
fs
.
path
.
join
(
'ios'
,
'Runner'
,
'Info.plist'
);
final
File
plistFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
projectDir
.
path
,
plistPath
));
expect
(
plistFile
,
exists
);
final
String
displayName
=
_getStringValueFromPlist
(
plistFile:
plistFile
,
key:
'CFBundleDisplayName'
);
expect
(
displayName
,
'My Project'
);
});
testUsingContext
(
'display name is Title Case for swift iOS project.'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=app'
,
'--no-pub'
,
'--org'
,
'com.foo.bar'
,
'--ios-language=swift'
,
'--project-name=my_project'
,
projectDir
.
path
]);
final
String
plistPath
=
globals
.
fs
.
path
.
join
(
'ios'
,
'Runner'
,
'Info.plist'
);
final
File
plistFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
projectDir
.
path
,
plistPath
));
expect
(
plistFile
,
exists
);
final
String
displayName
=
_getStringValueFromPlist
(
plistFile:
plistFile
,
key:
'CFBundleDisplayName'
);
expect
(
displayName
,
'My Project'
);
});
testUsingContext
(
'display name is Title Case for objc iOS module.'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=module'
,
'--offline'
,
'--org'
,
'com.foo.bar'
,
'--ios-language=objc'
,
'--project-name=my_project'
,
projectDir
.
path
]);
final
String
plistPath
=
globals
.
fs
.
path
.
join
(
'.ios'
,
'Runner'
,
'Info.plist'
);
final
File
plistFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
projectDir
.
path
,
plistPath
));
expect
(
plistFile
,
exists
);
final
String
displayName
=
_getStringValueFromPlist
(
plistFile:
plistFile
,
key:
'CFBundleDisplayName'
);
expect
(
displayName
,
'My Project'
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'display name is Title Case for swift iOS module.'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=module'
,
'--offline'
,
'--org'
,
'com.foo.bar'
,
'--ios-language=swift'
,
'--project-name=my_project'
,
projectDir
.
path
]);
final
String
plistPath
=
globals
.
fs
.
path
.
join
(
'.ios'
,
'Runner'
,
'Info.plist'
);
final
File
plistFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
projectDir
.
path
,
plistPath
));
expect
(
plistFile
,
exists
);
final
String
displayName
=
_getStringValueFromPlist
(
plistFile:
plistFile
,
key:
'CFBundleDisplayName'
);
expect
(
displayName
,
'My Project'
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
),
});
testUsingContext
(
'display name is Title Case for swift iOS plugin.'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=plugin'
,
'--no-pub'
,
'--org'
,
'com.foo.bar'
,
'--platforms=ios'
,
'--ios-language=swift'
,
'--project-name=my_project'
,
projectDir
.
path
]);
final
String
plistPath
=
globals
.
fs
.
path
.
join
(
'example'
,
'ios'
,
'Runner'
,
'Info.plist'
);
final
File
plistFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
projectDir
.
path
,
plistPath
));
expect
(
plistFile
,
exists
);
final
String
displayName
=
_getStringValueFromPlist
(
plistFile:
plistFile
,
key:
'CFBundleDisplayName'
);
expect
(
displayName
,
'My Project'
);
});
testUsingContext
(
'display name is Title Case for objc iOS plugin.'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=plugin'
,
'--no-pub'
,
'--org'
,
'com.foo.bar'
,
'--platforms=ios'
,
'--ios-language=objc'
,
'--project-name=my_project'
,
projectDir
.
path
]);
final
String
plistPath
=
globals
.
fs
.
path
.
join
(
'example'
,
'ios'
,
'Runner'
,
'Info.plist'
);
final
File
plistFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
projectDir
.
path
,
plistPath
));
expect
(
plistFile
,
exists
);
final
String
displayName
=
_getStringValueFromPlist
(
plistFile:
plistFile
,
key:
'CFBundleDisplayName'
);
expect
(
displayName
,
'My Project'
);
});
testUsingContext
(
'has correct content and formatting with macOS app template'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
...
...
@@ -2858,3 +2966,10 @@ class LoggingProcessManager extends LocalProcessManager {
commands
.
clear
();
}
}
String
_getStringValueFromPlist
(
{
File
plistFile
,
String
key
})
{
final
List
<
String
>
plist
=
plistFile
.
readAsLinesSync
().
map
((
String
line
)
=>
line
.
trim
()).
toList
();
final
int
keyIndex
=
plist
.
indexOf
(
'<key>
$key
</key>'
);
assert
(
keyIndex
>
0
);
return
plist
[
keyIndex
+
1
].
replaceAll
(
'<string>'
,
''
).
replaceAll
(
'</string>'
,
''
);
}
packages/flutter_tools/test/general.shard/plugins_test.dart
View file @
42eb9032
...
...
@@ -170,7 +170,7 @@ void main() {
mode:
FileMode
.
writeOnlyAppend
);
pluginDirectory
.
childFile
(
'pubspec.yaml'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
pluginYamlTemplate
.
replaceAll
(
'PLUGIN_CLASS'
,
toTitl
eCase
(
camelCase
(
name
))));
..
writeAsStringSync
(
pluginYamlTemplate
.
replaceAll
(
'PLUGIN_CLASS'
,
sentenc
eCase
(
camelCase
(
name
))));
directories
.
add
(
pluginDirectory
);
}
return
directories
;
...
...
packages/flutter_tools/test/general.shard/utils_test.dart
View file @
42eb9032
...
...
@@ -69,6 +69,28 @@ baz=qux
expect
(
snakeCase
(
'ABc'
),
equals
(
'a_bc'
));
expect
(
snakeCase
(
'ABC'
),
equals
(
'a_b_c'
));
});
testWithoutContext
(
'sentenceCase'
,
()
async
{
expect
(
sentenceCase
(
'abc'
),
equals
(
'Abc'
));
expect
(
sentenceCase
(
'ab_c'
),
equals
(
'Ab_c'
));
expect
(
sentenceCase
(
'a b c'
),
equals
(
'A b c'
));
expect
(
sentenceCase
(
'a B c'
),
equals
(
'A B c'
));
expect
(
sentenceCase
(
'Abc'
),
equals
(
'Abc'
));
expect
(
sentenceCase
(
'ab_c'
),
equals
(
'Ab_c'
));
expect
(
sentenceCase
(
'a_bc'
),
equals
(
'A_bc'
));
expect
(
sentenceCase
(
'a_b_c'
),
equals
(
'A_b_c'
));
});
testWithoutContext
(
'snakeCaseToTitleCase'
,
()
async
{
expect
(
snakeCaseToTitleCase
(
'abc'
),
equals
(
'Abc'
));
expect
(
snakeCaseToTitleCase
(
'ab_c'
),
equals
(
'Ab C'
));
expect
(
snakeCaseToTitleCase
(
'a_b_c'
),
equals
(
'A B C'
));
expect
(
snakeCaseToTitleCase
(
'a_B_c'
),
equals
(
'A B C'
));
expect
(
snakeCaseToTitleCase
(
'Abc'
),
equals
(
'Abc'
));
expect
(
snakeCaseToTitleCase
(
'ab_c'
),
equals
(
'Ab C'
));
expect
(
snakeCaseToTitleCase
(
'a_bc'
),
equals
(
'A Bc'
));
expect
(
snakeCaseToTitleCase
(
'a_b_c'
),
equals
(
'A B C'
));
});
});
group
(
'text wrapping'
,
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment