-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
226 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
## 1.0.0 | ||
## 0.0.1 | ||
|
||
- Initial version. |
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 |
---|---|---|
@@ -1 +1 @@ | ||
A sample command-line application providing basic argument parsing with an entrypoint in `bin/`. | ||
# rfw2txt |
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,59 @@ | ||
import core.widgets; | ||
import core.material; | ||
|
||
widget Counter = Container( | ||
color: 0xFF66AACC, | ||
child: Center( | ||
child: Button( | ||
child: Padding( | ||
padding: [ 20.0 ], | ||
child: Text(text: data.counter, style: { | ||
fontSize: 56.0, | ||
color: 0xFF000000, | ||
}), | ||
), | ||
onPressed: event "increment" { }, | ||
), | ||
), | ||
); | ||
|
||
widget Button { down: false } = GestureDetector( | ||
onTap: args.onPressed, | ||
onTapDown: set state.down = true, | ||
onTapUp: set state.down = false, | ||
onTapCancel: set state.down = false, | ||
child: Container( | ||
duration: 50, | ||
margin: switch state.down { | ||
false: [ 0.0, 0.0, 2.0, 2.0 ], | ||
true: [ 2.0, 2.0, 0.0, 0.0 ], | ||
}, | ||
padding: [ 12.0, 8.0 ], | ||
decoration: { | ||
type: "shape", | ||
shape: { | ||
type: "stadium", | ||
side: { width: 1.0 }, | ||
}, | ||
gradient: { | ||
type: "linear", | ||
begin: { x: -0.5, y: -0.25 }, | ||
end: { x: 0.0, y: 0.5 }, | ||
colors: [ 0xFFFFFF99, 0xFFEEDD00 ], | ||
stops: [ 0.0, 1.0 ], | ||
tileMode: "mirror", | ||
}, | ||
shadows: switch state.down { | ||
false: [ { blurRadius: 4.0, spreadRadius: 0.5, offset: { x: 1.0, y: 1.0, } } ], | ||
default: [], | ||
}, | ||
}, | ||
child: DefaultTextStyle( | ||
style: { | ||
color: 0xFF000000, | ||
fontSize: 32.0, | ||
}, | ||
child: args.child, | ||
), | ||
), | ||
); |
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 |
---|---|---|
@@ -1,8 +1,50 @@ | ||
import 'package:test/expect.dart'; | ||
import 'package:test/scaffolding.dart'; | ||
@TestOn('vm') | ||
import 'dart:convert'; | ||
import 'dart:io'; | ||
|
||
import 'package:rfw/formats.dart'; | ||
import 'package:test/test.dart'; | ||
import 'package:collection/collection.dart'; | ||
|
||
void main() { | ||
test('rfw2txt', () { | ||
expect(1, 2); | ||
test('rfw2txt without output path', () async { | ||
Process process = await Process.start( | ||
'dart', ['run', 'bin/rfw2txt.dart', "test/test.rfw"]); | ||
await process.stdout.transform(utf8.decoder).forEach(print); | ||
await process.stderr.transform(utf8.decoder).forEach(print); | ||
File matchFile = File('test/test.rfw'); | ||
File outputTxtFile = File('test.rfwtxt'); | ||
File outputFile = File('output.rfw'); | ||
outputFile.writeAsBytesSync( | ||
encodeLibraryBlob(parseLibraryFile(outputTxtFile.readAsStringSync()))); | ||
// use rfw encoder to convert output test.rfwtxt to test.rfw, then check the file is equal to test/test.rfw | ||
expect(outputFile.existsSync(), true); | ||
expect( | ||
ListEquality() | ||
.equals(matchFile.readAsBytesSync(), matchFile.readAsBytesSync()), | ||
true); | ||
|
||
outputFile.delete(); | ||
outputTxtFile.delete(); | ||
}); | ||
|
||
test('rfw2txt with output path', () async { | ||
Process process = await Process.start('dart', | ||
['run', 'bin/rfw2txt.dart', "test/test.rfw", "-o", "test.rfwtxt"]); | ||
await process.stdout.transform(utf8.decoder).forEach(print); | ||
await process.stderr.transform(utf8.decoder).forEach(print); | ||
File matchFile = File('test/test.rfw'); | ||
File outputTxtFile = File('test.rfwtxt'); | ||
File outputFile = File('output.rfw'); | ||
outputFile.writeAsBytesSync( | ||
encodeLibraryBlob(parseLibraryFile(outputTxtFile.readAsStringSync()))); | ||
expect(outputFile.existsSync(), true); | ||
expect( | ||
ListEquality() | ||
.equals(matchFile.readAsBytesSync(), matchFile.readAsBytesSync()), | ||
true); | ||
|
||
outputFile.delete(); | ||
outputTxtFile.delete(); | ||
}); | ||
} |
Binary file not shown.