style: format code

This commit is contained in:
black-desk
2023-07-21 14:47:40 +08:00
parent 5fed3ed9f0
commit 857db2625a
15 changed files with 135 additions and 91 deletions

View File

@ -19,4 +19,4 @@ int main(int argc, char **argv)
__sanitizer_set_report_path("asan_am.log");
QCoreApplication::exec();
return ret;
}
}

View File

@ -18,26 +18,24 @@ public:
auto curDir = QDir::current();
QString path{curDir.absolutePath() + "/data/desktopExample.desktop"};
ParseError err;
auto file = DesktopFile::searchDesktopFile(path,err);
auto file = DesktopFile::searchDesktopFile(path, err);
if (!file.has_value()) {
qWarning() << "search " << path << "failed:" << err;
return;
}
m_file.reset(new DesktopFile{std::move(file).value()});
}
void SetUp() override
{
}
void SetUp() override {}
void TearDown() override {}
QSharedPointer<DesktopFile> file() { return m_file; }
private:
static inline QSharedPointer<DesktopFile> m_file;
};
TEST_F(TestDesktopEntry, desktopFile)
{
const auto& fileptr = file();
const auto &fileptr = file();
ASSERT_FALSE(fileptr.isNull());
const auto &exampleFile = file();
auto curDir = QDir::current();
@ -49,7 +47,8 @@ TEST_F(TestDesktopEntry, desktopFile)
TEST_F(TestDesktopEntry, prase)
{
const auto &exampleFile = file();
ASSERT_FALSE(exampleFile.isNull());;
ASSERT_FALSE(exampleFile.isNull());
;
DesktopEntry entry;
QFile in{exampleFile->filePath()};
ASSERT_TRUE(in.open(QFile::ExistingOnly | QFile::ReadOnly | QFile::Text));

View File

@ -9,7 +9,8 @@
class TestJobManager : public testing::Test
{
public:
JobManager1Service& service() { return m_jobManager; }
JobManager1Service &service() { return m_jobManager; }
private:
JobManager1Service m_jobManager;
};
@ -33,9 +34,12 @@ TEST_F(TestJobManager, addJob)
qDebug() << "job was really removed";
});
manager.addJob(sourcePath, [](auto value) -> QVariant {
EXPECT_TRUE(value.toString() == "Application");
return QVariant::fromValue(true);
}, args);
QThread::sleep(1); // force wait
manager.addJob(
sourcePath,
[](auto value) -> QVariant {
EXPECT_TRUE(value.toString() == "Application");
return QVariant::fromValue(true);
},
args);
QThread::sleep(1); // force wait
}