-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add _cameraPower option. * rn lint fix. * add unknown to _cameraPower. * delete comment for A1 * [kmm] add _cameraPower option. * [kmp]delete SLEEP from _cameraPower. * [RN, flutter] add _cameraPower option for X. * upgrade upload-artifact version for github-action. * fixed RN build error by new XCode. * remove unnecessary code.
- Loading branch information
Showing
27 changed files
with
515 additions
and
4 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
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
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
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
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,36 @@ | ||
/// _cameraPower is the power status of camera. | ||
/// | ||
/// For RICOH THETA X v2.61.0 or later | ||
enum CameraPowerEnum { | ||
/// Undefined value | ||
unknown('UNKNOWN'), | ||
|
||
/// Power ON | ||
on('ON'), | ||
|
||
/// Power OFF | ||
off('OFF'), | ||
|
||
/// Power on, power saving mode. Camera is closed. | ||
/// Unavailable parameter when plugin is running. In this case, invalidParameterValue error will be returned. | ||
powerSaving('POWER_SAVING'), | ||
|
||
/// Power on, silent mode. LCD/LED is turned off. | ||
/// Unavailable parameter when plugin is running. In this case, invalidParameterValue error will be returned. | ||
silentMode('SILENT_MODE'); | ||
|
||
final String rawValue; | ||
|
||
const CameraPowerEnum(this.rawValue); | ||
|
||
@override | ||
String toString() { | ||
return rawValue; | ||
} | ||
|
||
static CameraPowerEnum? getValue(String rawValue) { | ||
return CameraPowerEnum.values.cast<CameraPowerEnum?>().firstWhere( | ||
(element) => element?.rawValue == rawValue, | ||
orElse: () => null); | ||
} | ||
} |
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
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
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
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,58 @@ | ||
import 'package:flutter/services.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:theta_client_flutter/theta_client_flutter.dart'; | ||
import 'package:theta_client_flutter/theta_client_flutter_method_channel.dart'; | ||
|
||
void main() { | ||
MethodChannelThetaClientFlutter platform = MethodChannelThetaClientFlutter(); | ||
const MethodChannel channel = MethodChannel('theta_client_flutter'); | ||
|
||
TestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
setUp(() { | ||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger | ||
.setMockMethodCallHandler(channel, null); | ||
}); | ||
|
||
tearDown(() { | ||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger | ||
.setMockMethodCallHandler(channel, null); | ||
}); | ||
|
||
test('CameraPowerEnum const', () async { | ||
List<List<dynamic>> data = [ | ||
[CameraPowerEnum.unknown, 'UNKNOWN'], | ||
[CameraPowerEnum.on, 'ON'], | ||
[CameraPowerEnum.off, 'OFF'], | ||
[CameraPowerEnum.powerSaving, 'POWER_SAVING'], | ||
[CameraPowerEnum.silentMode, 'SILENT_MODE'] | ||
]; | ||
expect(data.length, CameraPowerEnum.values.length, reason: 'enum count'); | ||
for (int i = 0; i < data.length; i++) { | ||
expect(data[i][0].toString(), data[i][1], reason: data[i][1]); | ||
} | ||
}); | ||
|
||
test('getOptions', () async { | ||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger | ||
.setMockMethodCallHandler(channel, (MethodCall methodCall) async { | ||
Map<String, dynamic> optionMap = {}; | ||
optionMap['CameraPower'] = 'SILENT_MODE'; | ||
return Future.value(optionMap); | ||
}); | ||
Options options = await platform.getOptions([OptionNameEnum.cameraPower]); | ||
expect(options.cameraPower?.rawValue, 'SILENT_MODE', reason: 'quality'); | ||
}); | ||
|
||
test('setOptions', () async { | ||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger | ||
.setMockMethodCallHandler(channel, (MethodCall methodCall) async { | ||
var arguments = methodCall.arguments as Map<dynamic, dynamic>; | ||
expect(arguments['CameraPower'], 'POWER_SAVING', reason: 'quality'); | ||
return Future.value(); | ||
}); | ||
final options = Options(); | ||
options.cameraPower = CameraPowerEnum.powerSaving; | ||
await platform.setOptions(options); | ||
}); | ||
} |
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
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
Oops, something went wrong.