Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KScreen
Commits
67962a1c
Commit
67962a1c
authored
Mar 24, 2021
by
David Redondo
🏎
Browse files
Remove changing of dirPath
It was only useful for the test which we can handle with manually setting XDG_DATA_HOME.
parent
758371ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
common/globals.cpp
View file @
67962a1c
...
...
@@ -20,19 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace
Globals
{
QString
s_dirPath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
%
QStringLiteral
(
"/kscreen/"
);
QString
dirPath
()
{
return
s_dirPath
;
}
void
setDirPath
(
const
QString
&
path
)
{
s_dirPath
=
path
;
if
(
!
s_dirPath
.
endsWith
(
QLatin1Char
(
'/'
)))
{
s_dirPath
+=
QLatin1Char
(
'/'
);
}
return
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
%
QStringLiteral
(
"/kscreen/"
);
}
}
common/globals.h
View file @
67962a1c
...
...
@@ -21,7 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace
Globals
{
void
setDirPath
(
const
QString
&
path
);
QString
dirPath
();
}
...
...
tests/kded/configtest.cpp
View file @
67962a1c
...
...
@@ -34,7 +34,6 @@ class TestConfig : public QObject
Q_OBJECT
private
Q_SLOTS
:
void
init
();
void
initTestCase
();
void
testSimpleConfig
();
...
...
@@ -51,6 +50,7 @@ private Q_SLOTS:
void
testFixedConfig
();
private:
QTemporaryDir
m_temporaryDir
;
std
::
unique_ptr
<
Config
>
createConfig
(
bool
output1Connected
,
bool
output2Conected
);
};
...
...
@@ -102,13 +102,10 @@ std::unique_ptr<Config> TestConfig::createConfig(bool output1Connected, bool out
return
configWrapper
;
}
void
TestConfig
::
init
()
{
Globals
::
setDirPath
(
QStringLiteral
(
TEST_DATA
"serializerdata/"
));
}
void
TestConfig
::
initTestCase
()
{
qputenv
(
"XDG_DATA_HOME"
,
m_temporaryDir
.
path
().
toUtf8
());
QFile
::
link
(
QStringLiteral
(
TEST_DATA
"serializerdata"
),
Config
::
configsDirPath
().
chopped
(
1
));
qputenv
(
"KSCREEN_LOGGING"
,
"false"
);
}
...
...
@@ -417,7 +414,6 @@ void TestConfig::testMoveConfig()
// Make sure we don't write into TEST_DATA
QStandardPaths
::
setTestModeEnabled
(
true
);
Globals
::
setDirPath
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
%
QStringLiteral
(
"/kscreen/"
));
// TODO: this needs setup of the control directory
// Basic assumptions for the remainder of our tests, this is the situation where the lid is opened
...
...
@@ -501,9 +497,6 @@ void TestConfig::testFixedConfig()
auto
config
=
configWrapper
->
data
();
QVERIFY
(
config
);
// Make sure we don't write into TEST_DATA
QStandardPaths
::
setTestModeEnabled
(
true
);
Globals
::
setDirPath
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
%
QStringLiteral
(
"/kscreen/"
));
// TODO: this needs setup of the control directory
const
QString
fixedCfgPath
=
Config
::
configsDirPath
()
%
Config
::
s_fixedConfigFileName
;
...
...
@@ -513,6 +506,8 @@ void TestConfig::testFixedConfig()
// Check if both files exist
QFile
fixedCfg
(
fixedCfgPath
);
QVERIFY
(
fixedCfg
.
exists
());
// Cleanup
fixedCfg
.
remove
();
}
QTEST_MAIN
(
TestConfig
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment