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
8dbfc82b
Unverified
Commit
8dbfc82b
authored
Jun 24, 2019
by
Danny Tuppeny
Committed by
GitHub
Jun 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak the display name of emulators (#34785)
parent
39597ce7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
23 deletions
+33
-23
android_emulator.dart
packages/flutter_tools/lib/src/android/android_emulator.dart
+3
-4
emulator.dart
packages/flutter_tools/lib/src/emulator.dart
+1
-2
ios_emulators.dart
packages/flutter_tools/lib/src/ios/ios_emulators.dart
+0
-3
android_emulator_test.dart
...ges/flutter_tools/test/android/android_emulator_test.dart
+25
-7
emulator_test.dart
packages/flutter_tools/test/emulator_test.dart
+4
-7
No files found.
packages/flutter_tools/lib/src/android/android_emulator.dart
View file @
8dbfc82b
...
...
@@ -32,15 +32,14 @@ class AndroidEmulator extends Emulator {
Map
<
String
,
String
>
_properties
;
// Android Studio uses the ID with underscores replaced with spaces
// for the name if displayname is not set so we do the same.
@override
String
get
name
=>
_prop
(
'
hw.device.name'
);
String
get
name
=>
_prop
(
'
avd.ini.displayname'
)
??
id
.
replaceAll
(
'_'
,
' '
).
trim
(
);
@override
String
get
manufacturer
=>
_prop
(
'hw.device.manufacturer'
);
@override
String
get
label
=>
_prop
(
'avd.ini.displayname'
);
@override
Category
get
category
=>
Category
.
mobile
;
...
...
packages/flutter_tools/lib/src/emulator.dart
View file @
8dbfc82b
...
...
@@ -218,7 +218,6 @@ abstract class Emulator {
final
bool
hasConfig
;
String
get
name
;
String
get
manufacturer
;
String
get
label
;
Category
get
category
;
PlatformType
get
platformType
;
...
...
@@ -250,7 +249,7 @@ abstract class Emulator {
emulator
.
id
??
''
,
emulator
.
name
??
''
,
emulator
.
manufacturer
??
''
,
emulator
.
label
??
''
,
emulator
.
platformType
?.
toString
()
??
''
,
]);
}
...
...
packages/flutter_tools/lib/src/ios/ios_emulators.dart
View file @
8dbfc82b
...
...
@@ -32,9 +32,6 @@ class IOSEmulator extends Emulator {
@override
String
get
manufacturer
=>
'Apple'
;
@override
String
get
label
=>
null
;
@override
Category
get
category
=>
Category
.
mobile
;
...
...
packages/flutter_tools/test/android/android_emulator_test.dart
View file @
8dbfc82b
...
...
@@ -23,25 +23,43 @@ void main() {
expect
(
emulator
.
id
,
emulatorID
);
expect
(
emulator
.
hasConfig
,
true
);
});
testUsingContext
(
'
store
s expected metadata'
,
()
{
testUsingContext
(
'
read
s expected metadata'
,
()
{
const
String
emulatorID
=
'1234'
;
const
String
name
=
'My Test Name'
;
const
String
manufacturer
=
'Me'
;
const
String
label
=
'The best one'
;
const
String
displayName
=
'The best one'
;
final
Map
<
String
,
String
>
properties
=
<
String
,
String
>{
'hw.device.name'
:
name
,
'hw.device.manufacturer'
:
manufacturer
,
'avd.ini.displayname'
:
label
,
'avd.ini.displayname'
:
displayName
,
};
final
AndroidEmulator
emulator
=
AndroidEmulator
(
emulatorID
,
properties
);
expect
(
emulator
.
id
,
emulatorID
);
expect
(
emulator
.
name
,
n
ame
);
expect
(
emulator
.
name
,
displayN
ame
);
expect
(
emulator
.
manufacturer
,
manufacturer
);
expect
(
emulator
.
label
,
label
);
expect
(
emulator
.
category
,
Category
.
mobile
);
expect
(
emulator
.
platformType
,
PlatformType
.
android
);
});
testUsingContext
(
'prefers displayname for name'
,
()
{
const
String
emulatorID
=
'1234'
;
const
String
displayName
=
'The best one'
;
final
Map
<
String
,
String
>
properties
=
<
String
,
String
>{
'avd.ini.displayname'
:
displayName
,
};
final
AndroidEmulator
emulator
=
AndroidEmulator
(
emulatorID
,
properties
);
expect
(
emulator
.
name
,
displayName
);
});
testUsingContext
(
'uses cleaned up ID if no displayname is set'
,
()
{
// Android Studio uses the ID with underscores replaced with spaces
// for the name if displayname is not set so we do the same.
const
String
emulatorID
=
'This_is_my_ID'
;
final
Map
<
String
,
String
>
properties
=
<
String
,
String
>{
'avd.ini.notadisplayname'
:
'this is not a display name'
,
};
final
AndroidEmulator
emulator
=
AndroidEmulator
(
emulatorID
,
properties
);
expect
(
emulator
.
name
,
'This is my ID'
);
});
testUsingContext
(
'parses ini files'
,
()
{
const
String
iniFile
=
'''
hw.device.name=My Test Name
...
...
packages/flutter_tools/test/emulator_test.dart
View file @
8dbfc82b
...
...
@@ -46,11 +46,11 @@ void main() {
testUsingContext
(
'getEmulatorsById'
,
()
async
{
final
_MockEmulator
emulator1
=
_MockEmulator
(
'Nexus_5'
,
'Nexus 5'
,
'Google'
,
''
);
_MockEmulator
(
'Nexus_5'
,
'Nexus 5'
,
'Google'
);
final
_MockEmulator
emulator2
=
_MockEmulator
(
'Nexus_5X_API_27_x86'
,
'Nexus 5X'
,
'Google'
,
''
);
_MockEmulator
(
'Nexus_5X_API_27_x86'
,
'Nexus 5X'
,
'Google'
);
final
_MockEmulator
emulator3
=
_MockEmulator
(
'iOS Simulator'
,
'iOS Simulator'
,
'Apple'
,
''
);
_MockEmulator
(
'iOS Simulator'
,
'iOS Simulator'
,
'Apple'
);
final
List
<
Emulator
>
emulators
=
<
Emulator
>[
emulator1
,
emulator2
,
...
...
@@ -160,7 +160,7 @@ class TestEmulatorManager extends EmulatorManager {
}
class
_MockEmulator
extends
Emulator
{
_MockEmulator
(
String
id
,
this
.
name
,
this
.
manufacturer
,
this
.
label
)
_MockEmulator
(
String
id
,
this
.
name
,
this
.
manufacturer
)
:
super
(
id
,
true
);
@override
...
...
@@ -169,9 +169,6 @@ class _MockEmulator extends Emulator {
@override
final
String
manufacturer
;
@override
final
String
label
;
@override
Category
get
category
=>
Category
.
mobile
;
...
...
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