Skip to content

Commit 0410198

Browse files
authored
translations: Update from weblate, cleanup (GH-2226)
2 parents fa694d7 + eab3d98 commit 0410198

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+75912
-18247
lines changed

src/core/virtual_path.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,17 @@ VirtualCoordVector::size_type PathCoordVector::update(VirtualCoordVector::size_t
8989
{
9090
Q_ASSERT(virtual_coords.size() == flags.size());
9191

92+
clear();
93+
9294
if (flags[part_start].isHolePoint())
9395
{
9496
auto pos = virtual_coords[0];
9597
qWarning("PathCoordVector at %g %g (mm) has an invalid hole at index %d.",
9698
pos.x(), -pos.y(), part_start);
99+
return part_start;
97100
}
98101

99-
clear();
100-
if (empty() || (part_start > 0 && flags[part_start-1].isHolePoint()))
101-
{
102-
emplace_back(virtual_coords[part_start], part_start, 0.0, 0.0);
103-
}
102+
emplace_back(virtual_coords[part_start], part_start, 0.0, 0.0);
104103

105104
for (auto index = part_start + 1; index <= part_end; ++index)
106105
{

test/path_object_t.cpp

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222

2323
#include <QtTest>
2424

25-
#include "global.h"
2625
#include "core/map.h"
2726
#include "core/objects/object.h"
2827
#include "core/symbols/line_symbol.h"
2928

3029
using namespace OpenOrienteering;
3130

31+
Q_DECLARE_METATYPE(MapCoord*)
32+
3233

3334
namespace QTest
3435
{
@@ -1150,6 +1151,63 @@ void PathObjectTest::atypicalPathTest()
11501151

11511152

11521153

1154+
void PathObjectTest::recalculatePartsTest_data()
1155+
{
1156+
static MapCoord coords[] = {
1157+
{ 0.0, 0.0 }, { 1.0, 0.0 }, { 1.0, 1.0 }, { 0.0, 1.0 }, { 0.0, 0.0, MapCoord::HolePoint },
1158+
{ 2.0, 2.0 }, { 2.0, 3.0 }, { 3.0, 3.0, MapCoord::HolePoint },
1159+
{ 4.0, 4.0, MapCoord::HolePoint },
1160+
{ 6.0, 6.0 }, { 6.0, 5.0 },
1161+
};
1162+
QTest::addColumn<MapCoord*>("first");
1163+
QTest::addColumn<MapCoord*>("last"); // STL sense
1164+
QTest::addColumn<int>("expected_size");
1165+
1166+
QTest::newRow("0.") << coords+0 << coords+0 << 0;
1167+
QTest::newRow("1.") << coords+0 << coords+1 << 1; // maybe not desired
1168+
QTest::newRow("2.") << coords+0 << coords+2 << 1; // maybe not desired for areas
1169+
QTest::newRow("3.") << coords+0 << coords+3 << 1;
1170+
QTest::newRow("4.") << coords+0 << coords+4 << 1;
1171+
QTest::newRow("5.") << coords+0 << coords+5 << 1;
1172+
QTest::newRow("5;1.") << coords+0 << coords+6 << 2; // maybe not desired
1173+
QTest::newRow("5;2.") << coords+0 << coords+7 << 2; // maybe not desired for areas
1174+
QTest::newRow("5;3.") << coords+0 << coords+8 << 2;
1175+
QTest::newRow("5;3;1.") << coords+0 << coords+9 << 3; // maybe not desired
1176+
QTest::newRow("5;3;1;1.") << coords+0 << coords+10 << 4; // maybe not desired
1177+
}
1178+
1179+
void PathObjectTest::recalculatePartsTest()
1180+
{
1181+
QFETCH(MapCoord*, first);
1182+
QFETCH(MapCoord*, last);
1183+
QFETCH(int, expected_size);
1184+
1185+
// The constructor calls PathObject::recalculateParts().
1186+
PathObject path { nullptr, MapCoordVector(first, last), nullptr };
1187+
{
1188+
auto& initial_parts = path.parts();
1189+
QCOMPARE(initial_parts.size(), expected_size);
1190+
1191+
for (auto& initial_part : initial_parts)
1192+
{
1193+
QVERIFY(initial_part.first_index <= initial_part.last_index);
1194+
}
1195+
}
1196+
1197+
path.updatePathCoords();
1198+
{
1199+
auto& updated_parts = path.parts();
1200+
QCOMPARE(updated_parts.size(), expected_size);
1201+
1202+
for (auto& updated_part : updated_parts)
1203+
{
1204+
QVERIFY(updated_part.first_index <= updated_part.last_index);
1205+
}
1206+
}
1207+
}
1208+
1209+
1210+
11531211
/*
11541212
* We don't need a real GUI window.
11551213
*/

test/path_object_t.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ private slots:
7575
/** Tests PathCoord and SplitPathCoord for a non-trivial zero-length path. */
7676
void atypicalPathTest();
7777

78+
/** Tests recalculation of path parts from input coords. */
79+
void recalculatePartsTest();
80+
void recalculatePartsTest_data();
7881
};
7982

8083
#endif

translations/CMakeLists.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ find_package(Qt5LinguistTools REQUIRED)
2323

2424
# Translation files which are updated by lupdate.
2525
set(Mapper_translations
26+
OpenOrienteering_bg.ts
2627
OpenOrienteering_cs.ts
2728
OpenOrienteering_da.ts
2829
OpenOrienteering_de.ts
2930
OpenOrienteering_en.ts
3031
OpenOrienteering_eo.ts
3132
OpenOrienteering_es.ts
33+
OpenOrienteering_et.ts
3234
OpenOrienteering_fi.ts
3335
OpenOrienteering_fr.ts
3436
OpenOrienteering_he.ts
@@ -41,21 +43,21 @@ set(Mapper_translations
4143
OpenOrienteering_nb.ts
4244
OpenOrienteering_nl.ts
4345
OpenOrienteering_pl.ts
46+
OpenOrienteering_pt.ts
4447
OpenOrienteering_pt_BR.ts
45-
OpenOrienteering_pt_PT.ts
4648
OpenOrienteering_ru.ts
4749
OpenOrienteering_sv.ts
50+
OpenOrienteering_tr.ts
4851
OpenOrienteering_uk.ts
4952
OpenOrienteering_zh_CN.ts
53+
OpenOrienteering_zh_Hant.ts
5054
)
5155
# Make translation list available for Qt translation lookup
5256
set(Mapper_translations ${Mapper_translations} PARENT_SCOPE)
5357

5458
# Translation files which are updated but not deployed.
5559
set(Mapper_translations_template
56-
OpenOrienteering_et.ts
5760
OpenOrienteering_eu.ts
58-
OpenOrienteering_tr.ts
5961
OpenOrienteering_template.ts
6062
)
6163

@@ -71,7 +73,11 @@ set(map_symbols_translations
7173
map_symbols_hr.ts
7274
map_symbols_hu.ts
7375
map_symbols_it.ts
76+
map_symbols_lv.ts
7477
map_symbols_nb.ts
78+
map_symbols_nl.ts
79+
map_symbols_pl.ts
80+
map_symbols_pt.ts
7581
map_symbols_ru.ts
7682
map_symbols_sv.ts
7783
map_symbols_tr.ts
@@ -83,9 +89,10 @@ set(map_symbols_translations ${map_symbols_translations} PARENT_SCOPE)
8389

8490
# Translation files which are updated but not deployed.
8591
set(map_symbols_translations_template
86-
map_symbols_lv.ts
87-
map_symbols_nl.ts
88-
map_symbols_pl.ts
92+
map_symbols_bg.ts
93+
map_symbols_et.ts
94+
map_symbols_id.ts
95+
map_symbols_zh_Hant.ts
8996
map_symbols_template.ts
9097
)
9198
# Make translation list available for SymbolSetTool

0 commit comments

Comments
 (0)