dde-dock/unittest/main.cpp
chenjun 2ef1176873 fix: 添加针对源代码的单元测试,添加触发自动测试代码
因为单元测试需要直接测试源代码,而主程序代码中include的单元使用了相对路径
单元测试的CMakeLists和主程序的CMakeLists路径不同,编译单元测试时会提示找不到文件
因此设置搜索路径,并修改各单元引用头文件的路径。在单元测试的CMakeLists中添加需要依赖

Log: 添加针对源代码的单元测试,添加触发自动测试代码
Change-Id: I0e0bc92c28d6cee42fc52064fc360c58f7c02826
2020-12-22 10:10:20 +08:00

19 lines
380 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <gtest/gtest.h>
#include <QApplication>
#include <QDebug>
#include <DLog>
int main(int argc, char **argv)
{
// gerrit编译时没有显示器需要指定环境变量
qputenv("QT_QPA_PLATFORM", "offscreen");
QApplication app(argc, argv);
qApp->setProperty("CANSHOW", true);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}