Files

44 lines
1.3 KiB
C++
Raw Permalink 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.
// WP-P4-09 Plan A(task-129):vde_pmi 模块最小测试。
// 覆盖:规范头 include、auto_generate_pmi 空模型、PMI 数据模型(内核)挂接、
// export_3d_pdf 空模型拒绝(不写文件)。
#include "vde_pmi/pmi_export.h"
#include <gtest/gtest.h>
#include <string>
namespace {
TEST(PmiExportModule, AutoGenerateOnEmptyBodyIsZero) {
vde::brep::BrepModel body;
vde::brep::PMIModel pmi;
const int generated = vde::drafting::auto_generate_pmi(body, pmi);
EXPECT_EQ(generated, 0);
EXPECT_EQ(pmi.count(), 0u);
EXPECT_TRUE(pmi.annotations().empty());
}
TEST(PmiExportModule, KernelDataModelStillAvailable) {
vde::brep::PMIModel pmi;
vde::brep::PMIAnnotation ann;
ann.type = vde::brep::PMIType::Note;
ann.label = "NOTE_MODULE_TEST";
const int id = pmi.attach_pmi(ann);
EXPECT_GE(id, 0);
EXPECT_EQ(pmi.count(), 1u);
const auto* got = pmi.get_annotation(id);
ASSERT_NE(got, nullptr);
EXPECT_EQ(got->label, "NOTE_MODULE_TEST");
pmi.create_default_views();
EXPECT_FALSE(pmi.views().empty());
}
TEST(PmiExportModule, Export3dPdfRejectsEmptyBody) {
vde::brep::BrepModel body;
const bool ok = vde::drafting::export_3d_pdf(
body, {}, "pmi_export_module_should_not_exist.pdf");
EXPECT_FALSE(ok);
}
} // namespace