Skip to content

Commit 1cc90f7

Browse files
Merge pull request #140 from trikset/wpa
Wpa
2 parents 9d8dc5d + eb6b9e5 commit 1cc90f7

31 files changed

+827
-543
lines changed

tests/tests.pro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
TEMPLATE = subdirs
1616

1717
SUBDIRS = \
18+
minimalCppApp \
1819
selftest \
1920
thirdparty \
21+
trikKernelTests \
2022
trikScriptRunnerTests \
21-
minimalCppApp \
2223

2324
thirdparty.file = thirdparty/gmock-1.6.0/gmock.pro
2425

26+
trikKernelTests.depends = thirdparty
2527
trikScriptRunnerTests.depends = thirdparty
2628
selftest.depends = thirdparty
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/* Copyright 2015 CyberTech Labs Ltd.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License. */
14+
15+
#include "synchronizedVarTest.h"
16+
17+
#include <trikKernel/synchronizedVar.h>
18+
19+
#include <QtCore/QList>
20+
21+
using namespace tests;
22+
using namespace trikKernel;
23+
24+
struct Point
25+
{
26+
int x;
27+
int y;
28+
};
29+
30+
TEST_F(SynchronizedVarTest, structTest)
31+
{
32+
SynchronizedVar<Point> var;
33+
var->x = 10;
34+
var->y = 10;
35+
var.sync();
36+
var->x = 20;
37+
var->y = 20;
38+
EXPECT_EQ(10, var.get().x);
39+
var.sync();
40+
EXPECT_EQ(20, var.get().x);
41+
var->x = 30;
42+
var->y = 30;
43+
EXPECT_EQ(20, var.get().x);
44+
}
45+
46+
TEST_F(SynchronizedVarTest, listTest)
47+
{
48+
SynchronizedVar<QList<Point>> list;
49+
EXPECT_TRUE(list.get().isEmpty());
50+
51+
const Point point{10, 10};
52+
list->append(point);
53+
54+
EXPECT_TRUE(list.get().isEmpty());
55+
56+
list.sync();
57+
58+
ASSERT_FALSE(list.get().isEmpty());
59+
EXPECT_EQ(10, list.get().at(0).x);
60+
}
61+
62+
TEST_F(SynchronizedVarTest, resetTest)
63+
{
64+
SynchronizedVar<QList<Point>> list;
65+
list->append({10, 10});
66+
67+
list.sync();
68+
69+
EXPECT_FALSE(list.get().isEmpty());
70+
71+
list.reset();
72+
73+
EXPECT_TRUE(list.get().isEmpty());
74+
list.sync();
75+
EXPECT_TRUE(list.get().isEmpty());
76+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* Copyright 2015 CyberTech Labs Ltd.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License. */
14+
15+
#pragma once
16+
17+
#include <gtest/gtest.h>
18+
19+
namespace tests {
20+
21+
/// Test fixture for SynchronizedVar class.
22+
class SynchronizedVarTest : public testing::Test
23+
{
24+
};
25+
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2014 - 2015 CyberTech Labs Ltd.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
include(../../global.pri)
16+
17+
include(../common.pri)
18+
19+
HEADERS += \
20+
$$PWD/synchronizedVarTest.h \
21+
22+
SOURCES += \
23+
$$PWD/synchronizedVarTest.cpp \
24+
25+
implementationIncludes(trikKernel)
26+
links(trikKernel)

translations/fr/trikGui_fr.ts

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,25 @@
5050
<context>
5151
<name>trikGui::Controller</name>
5252
<message>
53-
<location filename="../../trikGui/controller.cpp" line="155"/>
53+
<location filename="../../trikGui/controller.cpp" line="165"/>
5454
<source>direct command</source>
5555
<translation type="unfinished"></translation>
5656
</message>
5757
</context>
5858
<context>
5959
<name>trikGui::FileManagerWidget</name>
6060
<message>
61-
<location filename="../../trikGui/fileManagerWidget.cpp" line="94"/>
61+
<location filename="../../trikGui/fileManagerWidget.cpp" line="101"/>
6262
<source>File Manager</source>
6363
<translation type="unfinished"></translation>
6464
</message>
6565
<message>
66-
<location filename="../../trikGui/fileManagerWidget.cpp" line="118"/>
66+
<location filename="../../trikGui/fileManagerWidget.cpp" line="125"/>
6767
<source>Confirm deletion</source>
6868
<translation type="unfinished"></translation>
6969
</message>
7070
<message>
71-
<location filename="../../trikGui/fileManagerWidget.cpp" line="119"/>
71+
<location filename="../../trikGui/fileManagerWidget.cpp" line="126"/>
7272
<source>Are you sure you want to delete file?</source>
7373
<translation type="unfinished"></translation>
7474
</message>
@@ -216,12 +216,12 @@
216216
<context>
217217
<name>trikGui::StartWidget</name>
218218
<message>
219-
<location filename="../../trikGui/startWidget.cpp" line="50"/>
219+
<location filename="../../trikGui/startWidget.cpp" line="49"/>
220220
<source>TRIK</source>
221221
<translation type="unfinished"></translation>
222222
</message>
223223
<message>
224-
<location filename="../../trikGui/startWidget.cpp" line="55"/>
224+
<location filename="../../trikGui/startWidget.cpp" line="54"/>
225225
<source>Settings</source>
226226
<translation type="unfinished"></translation>
227227
</message>
@@ -318,52 +318,57 @@
318318
<context>
319319
<name>trikGui::WiFiClientWidget</name>
320320
<message>
321-
<location filename="../../trikGui/wiFiClientWidget.cpp" line="61"/>
321+
<location filename="../../trikGui/wiFiClientWidget.cpp" line="56"/>
322322
<source>IP:</source>
323323
<translation type="unfinished"></translation>
324324
</message>
325325
<message>
326-
<location filename="../../trikGui/wiFiClientWidget.cpp" line="64"/>
326+
<location filename="../../trikGui/wiFiClientWidget.cpp" line="59"/>
327327
<source>Name:</source>
328328
<translation type="unfinished"></translation>
329329
</message>
330330
<message>
331-
<location filename="../../trikGui/wiFiClientWidget.cpp" line="69"/>
331+
<location filename="../../trikGui/wiFiClientWidget.cpp" line="64"/>
332332
<source>Available networks:</source>
333333
<translation type="unfinished"></translation>
334334
</message>
335335
<message>
336-
<location filename="../../trikGui/wiFiClientWidget.cpp" line="154"/>
336+
<location filename="../../trikGui/wiFiClientWidget.cpp" line="169"/>
337337
<source>connecting...</source>
338338
<translation type="unfinished"></translation>
339339
</message>
340340
<message>
341-
<location filename="../../trikGui/wiFiClientWidget.cpp" line="159"/>
341+
<location filename="../../trikGui/wiFiClientWidget.cpp" line="174"/>
342342
<source>no connection</source>
343343
<translation type="unfinished"></translation>
344344
</message>
345+
<message>
346+
<location filename="../../trikGui/wiFiClientWidget.cpp" line="179"/>
347+
<source>error</source>
348+
<translation type="unfinished"></translation>
349+
</message>
345350
</context>
346351
<context>
347352
<name>trikGui::WiFiInitWidget</name>
348353
<message>
349-
<location filename="../../trikGui/wiFiInitWidget.cpp" line="31"/>
354+
<location filename="../../trikGui/wiFiInitWidget.cpp" line="30"/>
350355
<source>Network initialization
351356
in process</source>
352357
<translation type="unfinished"></translation>
353358
</message>
354359
<message>
355-
<location filename="../../trikGui/wiFiInitWidget.cpp" line="33"/>
360+
<location filename="../../trikGui/wiFiInitWidget.cpp" line="32"/>
356361
<source>Please wait</source>
357362
<translation type="unfinished"></translation>
358363
</message>
359364
<message>
360-
<location filename="../../trikGui/wiFiInitWidget.cpp" line="34"/>
365+
<location filename="../../trikGui/wiFiInitWidget.cpp" line="33"/>
361366
<source>Press Escape
362367
for break</source>
363368
<translation type="unfinished"></translation>
364369
</message>
365370
<message>
366-
<location filename="../../trikGui/wiFiInitWidget.cpp" line="115"/>
371+
<location filename="../../trikGui/wiFiInitWidget.cpp" line="114"/>
367372
<source>Network initialization
368373
failed</source>
369374
<translation type="unfinished"></translation>
@@ -372,23 +377,23 @@ failed</source>
372377
<context>
373378
<name>trikGui::WiFiModeWidget</name>
374379
<message>
375-
<location filename="../../trikGui/wiFiModeWidget.cpp" line="35"/>
380+
<location filename="../../trikGui/wiFiModeWidget.cpp" line="32"/>
376381
<source>Choose mode:</source>
377382
<translation type="unfinished"></translation>
378383
</message>
379384
<message>
380-
<location filename="../../trikGui/wiFiModeWidget.cpp" line="37"/>
381-
<location filename="../../trikGui/wiFiModeWidget.cpp" line="64"/>
385+
<location filename="../../trikGui/wiFiModeWidget.cpp" line="34"/>
386+
<location filename="../../trikGui/wiFiModeWidget.cpp" line="61"/>
382387
<source>Wi-Fi client</source>
383388
<translation type="unfinished"></translation>
384389
</message>
385390
<message>
386-
<location filename="../../trikGui/wiFiModeWidget.cpp" line="38"/>
391+
<location filename="../../trikGui/wiFiModeWidget.cpp" line="35"/>
387392
<source>Wi-Fi access point</source>
388393
<translation type="unfinished"></translation>
389394
</message>
390395
<message>
391-
<location filename="../../trikGui/wiFiModeWidget.cpp" line="52"/>
396+
<location filename="../../trikGui/wiFiModeWidget.cpp" line="49"/>
392397
<source>Network Config</source>
393398
<translation type="unfinished"></translation>
394399
</message>

translations/ru/trikGui_ru.qm

71 Bytes
Binary file not shown.

translations/ru/trikGui_ru.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!DOCTYPE TS>
3-
<TS version="2.0" language="ru_RU">
3+
<TS version="2.1" language="ru_RU">
44
<context>
55
<name>QObject</name>
66
<message>
@@ -329,6 +329,10 @@
329329
<source>Name:</source>
330330
<translation>Имя:</translation>
331331
</message>
332+
<message>
333+
<source>error</source>
334+
<translation>ошибка</translation>
335+
</message>
332336
</context>
333337
<context>
334338
<name>trikGui::WiFiInitWidget</name>

trikControl/src/vectorSensorWorker.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void VectorSensorWorker::onNewEvent(trikHal::EventFileInterface::EventType event
5656
}
5757
}
5858

59+
/// @todo: vector copying is not atomic, so we may receive evSyn right in the middle of "return mReading".
5960
QVector<int> VectorSensorWorker::read()
6061
{
6162
if (mState.isReady()) {

trikGui/backgroundWidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ BackgroundWidget::BackgroundWidget(
3434
, mWiFiIndicator(mController)
3535
, mMailboxIndicator("://resources/mailboxConnected.png", mController.mailbox()->isConnected())
3636
, mCommunicatorIndicator("://resources/communicatorConnected.png", mController.communicatorConnectionStatus())
37-
, mStartWidget(mController, configPath)
37+
, mStartWidget(mController)
3838
, mRunningWidget(mController)
3939
{
4040
setWindowState(Qt::WindowFullScreen);

trikGui/startWidget.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ using namespace trikGui;
4141
using trikControl::MotorInterface;
4242
using trikControl::SensorInterface;
4343

44-
StartWidget::StartWidget(Controller &controller, const QString &configPath, QWidget *parent)
44+
StartWidget::StartWidget(Controller &controller, QWidget *parent)
4545
: MainWidget(parent)
4646
, mController(controller)
47-
, mConfigPath(configPath)
4847
, mFileManagerRoot(MainWidget::FileManagerRootType::scriptsDir)
4948
{
5049
mTitleLabel.setText(tr("TRIK"));
@@ -114,7 +113,7 @@ void StartWidget::launch()
114113
emit newWidget(fileManagerWidget);
115114
result = fileManagerWidget.exec();
116115
} else if (currentItemText == WiFiModeWidget::menuEntry()) {
117-
WiFiModeWidget wiFiModeWidget(mConfigPath, mController.wiFi());
116+
WiFiModeWidget wiFiModeWidget(mController.wiFi());
118117
emit newWidget(wiFiModeWidget);
119118
result = wiFiModeWidget.exec();
120119
} else if (currentItemText == MotorsWidget::menuEntry(MotorInterface::Type::powerMotor)) {

0 commit comments

Comments
 (0)