Skip to content

Commit 8acf697

Browse files
author
benni-tec
committed
Merge branch 'main' into flame-engine#69-dart-sdk
# Conflicts: # packages/tiled/pubspec.yaml # packages/tiled/test/parser_test.dart
2 parents 82a2b34 + 581391c commit 8acf697

33 files changed

+90
-58
lines changed

.github/workflows/cicd.yaml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,38 @@ jobs:
1818
channel: 'stable'
1919
- uses: flame-engine/flame-dartdoc-action@v2
2020

21-
format:
21+
analyze:
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v2
25-
- uses: subosito/flutter-action@v1
24+
- uses: actions/checkout@v3
25+
- uses: subosito/flutter-action@v2
26+
- uses: bluefireteam/melos-action@v3
27+
- name: "Analyze with latest stable"
28+
uses: invertase/[email protected]
2629
with:
27-
channel: 'stable'
28-
- uses: flame-engine/flame-format-action@v1
30+
fatal-infos: true
2931

30-
analyze:
32+
format:
3133
runs-on: ubuntu-latest
3234
steps:
33-
- uses: actions/checkout@v2
34-
- uses: subosito/flutter-action@v1
35+
- uses: actions/checkout@v3
36+
- uses: subosito/flutter-action@v2
3537
with:
36-
channel: 'stable'
37-
- uses: flame-engine/flame-analyze-action@v2
38+
cache: true
39+
- uses: bluefireteam/melos-action@v3
40+
- name: Run format
41+
run: melos format-check
3842
# END LINTING STAGE
3943

4044
# BEGIN TESTING STAGE
4145
test:
42-
needs: [dartdoc, format, analyze]
4346
runs-on: ubuntu-latest
4447
steps:
45-
- uses: actions/checkout@v2
46-
- uses: subosito/flutter-action@v1
48+
- uses: actions/checkout@v3
49+
- uses: subosito/flutter-action@v2
4750
with:
48-
channel: 'stable'
49-
- uses: flame-engine/flame-test-action@v1
51+
cache: true
52+
- uses: bluefireteam/melos-action@v3
53+
- name: Run tests
54+
run: melos test
5055
# END TESTING STAGE

melos.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ scripts:
2929
description: Run `flutter analyze` for all packages.
3030

3131
format:
32-
run: melos exec flutter format . --fix
33-
description: Run `flutter format` for all packages.
32+
run: melos exec dart format . --fix
33+
description: Run `dart format` for all packages.
3434

3535
format-check:
36-
run: melos exec flutter format . --set-exit-if-changed
37-
description: Run `flutter format` checks for all packages.
36+
run: melos exec dart format . --set-exit-if-changed
37+
description: Run `dart format` checks for all packages.
3838

3939
dartdoc:
4040
run: melos exec flutter pub run dartdoc

packages/tiled/LICENSE

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The MIT License (MIT)
1+
MIT License
22

3-
Copyright (c) <year> <copyright holders>
3+
Copyright (c) 2021 Blue Fire
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,14 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in
13-
all copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

packages/tiled/lib/src/chunk.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/common/enums.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
enum MapOrientation { orthogonal, isometric, staggered, hexagonal }
44

packages/tiled/lib/src/common/flips.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
class Flips {
44
final bool horizontally;

packages/tiled/lib/src/common/frame.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/common/gid.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// A [Gid], Global Tile ID is a Tiled concept to represent the tiles inside
44
/// int matrices. This wrapper is used by [Layer] and [Chunk] to provide

packages/tiled/lib/src/common/point.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/common/property.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/common/tiled_image.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/editor_setting/chunk_size.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/editor_setting/editor_setting.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/editor_setting/export.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/layer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:
@@ -328,7 +328,7 @@ abstract class Layer {
328328
decompressed = const ZLibDecoder().decodeBytes(decodedString);
329329
break;
330330
case Compression.gzip:
331-
decompressed = GZipDecoder().decodeBytes(decodedString);
331+
decompressed = const GZipDecoder().decodeBytes(decodedString);
332332
break;
333333
case Compression.zstd:
334334
throw UnsupportedError('zstd is an unsupported compression');

packages/tiled/lib/src/objects/text.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:
@@ -74,7 +74,8 @@ class Text {
7474
fontFamily: parser.getString('fontFamily', defaults: 'sans-serif'),
7575
pixelSize: parser.getInt('pixelSize', defaults: 16),
7676
color: parser.getString('color', defaults: '#000000'),
77-
text: parser.getString('text', defaults: ''),
77+
text: parser.getInnerTextOrNull() ??
78+
parser.getString('text', defaults: ''),
7879
hAlign: parser.getHAlign('hAlign', defaults: HAlign.left),
7980
vAlign: parser.getVAlign('vAlign', defaults: VAlign.top),
8081
bold: parser.getBool('bold', defaults: false),

packages/tiled/lib/src/objects/tiled_object.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/parser.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../tiled.dart';
22

33
class ParsingException implements Exception {
44
final String name;
@@ -11,6 +11,10 @@ class XmlParser extends Parser {
1111
final XmlElement element;
1212
XmlParser(this.element);
1313

14+
@override
15+
String? getInnerTextOrNull() =>
16+
element.innerText.isEmpty ? null : element.innerText;
17+
1418
@override
1519
String? getStringOrNull(String name, {String? defaults}) {
1620
return element.getAttribute(name) ?? defaults;
@@ -46,6 +50,9 @@ class JsonParser extends Parser {
4650
final Map<String, dynamic> json;
4751
JsonParser(this.json);
4852

53+
@override
54+
String? getInnerTextOrNull() => null;
55+
4956
@override
5057
String? getStringOrNull(String name, {String? defaults}) {
5158
return json[name]?.toString() ?? defaults;
@@ -75,6 +82,8 @@ class JsonParser extends Parser {
7582
}
7683

7784
abstract class Parser {
85+
String? getInnerTextOrNull();
86+
7887
String? getStringOrNull(String name, {String? defaults});
7988

8089
List<Parser> getChildren(String name);

packages/tiled/lib/src/template.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/tile_map_parser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../tiled.dart';
22

33
class TileMapParser {
44
static TiledMap parseJson(String json) {

packages/tiled/lib/src/tiled_map.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:
@@ -247,6 +247,7 @@ class TiledMap {
247247
(tileset) =>
248248
[tileset.image, ...tileset.tiles.map((tile) => tile.image)],
249249
)
250+
// ignore: deprecated_member_use
250251
.whereNotNull()
251252
.toList();
252253
}

packages/tiled/lib/src/tileset/grid.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/tileset/terrain.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/tileset/tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/tileset/tile_offset.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/tileset/tileset.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/tileset/wang/wang_color.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/tileset/wang/wang_set.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/tileset/wang/wang_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../../../tiled.dart';
22

33
/// Below is Tiled's documentation about how this structure is represented
44
/// on XML files:

packages/tiled/lib/src/tsx_provider.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
part of tiled;
1+
part of '../tiled.dart';
22

33
/// abstract class to be implemented for an external tileset data provider.
44
abstract class TsxProvider {

packages/tiled/pubspec.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ homepage: https://github.com/flame-engine/tiled.dart
55

66
environment:
77
sdk: ">=2.18.0 <3.0.0"
8+
89
dependencies:
9-
archive: ^3.3.0
10+
archive: ">=3.3.0 <5.0.0"
1011
collection: ^1.16.0
1112
meta: ^1.7.0
1213
xml: ^6.1.0
1314

1415
dev_dependencies:
15-
dartdoc: ^6.0.1
16-
flame_lint: ^1.1.1
16+
dartdoc: ^8.3.1
17+
flame_lint: ^1.1.2
1718
test: ^1.24.8

packages/tiled/test/parser_test.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'dart:io';
22
import 'dart:math' show Rectangle;
33

44
import 'package:test/test.dart';
5+
import 'package:collection/collection.dart';
56
import 'package:tiled/tiled.dart';
67
import 'package:xml/xml.dart';
78

@@ -87,6 +88,10 @@ void main() {
8788
equals('test_value'),
8889
);
8990
expect(
91+
properties
92+
.getValue<String>('multiline string')
93+
?.replaceAll('\r\n', '\n'),
94+
equals('Hello,\nWorld'),
9095
properties.getValue<String>('multiline string'),
9196
equals('Hello,\r\nWorld'),
9297
);
@@ -234,6 +239,15 @@ void main() {
234239
test('has the right class_', () {
235240
expect(og.class_, equals('objectLayer1Class'));
236241
});
242+
243+
test('has the right text object with ID 5', () {
244+
final textObject = (og as ObjectGroup)
245+
.objects
246+
.firstWhereOrNull((element) => element.id == 5);
247+
final text = textObject?.text;
248+
expect(text?.wrap, equals(true));
249+
expect(text?.text, equals('Hello World'));
250+
});
237251
});
238252
});
239253

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ environment:
44
sdk: ">=3.0.0 <4.0.0"
55

66
dev_dependencies:
7-
melos: ^3.0.0
7+
melos: ^6.2.0

0 commit comments

Comments
 (0)