mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00

因为单元测试需要直接测试源代码,而主程序代码中include的单元使用了相对路径 单元测试的CMakeLists和主程序的CMakeLists路径不同,编译单元测试时会提示找不到文件 因此设置搜索路径,并修改各单元引用头文件的路径。在单元测试的CMakeLists中添加需要依赖 Log: 添加针对源代码的单元测试,添加触发自动测试代码 Change-Id: I0e0bc92c28d6cee42fc52064fc360c58f7c02826
19 lines
380 B
C++
19 lines
380 B
C++
#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();
|
||
}
|