Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: third_party/ots/test/table_dependencies_test.cc

Issue 775893002: Updating OTS repo from https://github.com/khaledhosny/ots.git (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating with 4800 warning fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/ots/test/side-by-side.cc ('k') | third_party/ots/test/test_malicious_fonts.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/ots/test/table_dependencies_test.cc
diff --git a/third_party/ots/test/table_dependencies_test.cc b/third_party/ots/test/table_dependencies_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bbaaa30bb3cb4e2b1a0239ec642a2d54a8105867
--- /dev/null
+++ b/third_party/ots/test/table_dependencies_test.cc
@@ -0,0 +1,78 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <gtest/gtest.h>
+
+#include "gsub.h"
+#include "ots.h"
+#include "ots-memory-stream.h"
+#include "vhea.h"
+#include "vmtx.h"
+
+#define SET_TABLE(name, capname) \
+ do { file.name = new ots::OpenType##capname; } while (0)
+#define SET_LAYOUT_TABLE(name, capname) \
+ do { \
+ if (!file.name) { \
+ SET_TABLE(name, capname); \
+ } \
+ file.name->data = reinterpret_cast<const uint8_t*>(1); \
+ file.name->length = 1; \
+ } while (0)
+#define DROP_TABLE(name) \
+ do { delete file.name; file.name = NULL; } while (0)
+#define DROP_LAYOUT_TABLE(name) \
+ do { file.name->data = NULL; file.name->length = 0; } while (0)
+
+namespace {
+
+class TableDependenciesTest : public ::testing::Test {
+ protected:
+ virtual void SetUp() {
+ SET_LAYOUT_TABLE(gsub, GSUB);
+ SET_TABLE(vhea, VHEA);
+ SET_TABLE(vmtx, VMTX);
+ }
+
+ virtual void TearDown() {
+ DROP_TABLE(gsub);
+ DROP_TABLE(vhea);
+ DROP_TABLE(vmtx);
+ }
+ ots::OpenTypeFile file;
+};
+} // namespace
+
+TEST_F(TableDependenciesTest, TestVhea) {
+ EXPECT_TRUE(ots::ots_vhea_should_serialise(&file));
+}
+
+TEST_F(TableDependenciesTest, TestVmtx) {
+ EXPECT_TRUE(ots::ots_vmtx_should_serialise(&file));
+}
+
+TEST_F(TableDependenciesTest, TestVheaVmtx) {
+ DROP_TABLE(vmtx);
+ EXPECT_FALSE(ots::ots_vhea_should_serialise(&file));
+}
+
+TEST_F(TableDependenciesTest, TestVmtxVhea) {
+ DROP_TABLE(vhea);
+ EXPECT_FALSE(ots::ots_vmtx_should_serialise(&file));
+}
+
+TEST_F(TableDependenciesTest, TestVheaGsub) {
+ DROP_LAYOUT_TABLE(gsub);
+ EXPECT_FALSE(ots::ots_vhea_should_serialise(&file));
+ DROP_TABLE(gsub);
+ EXPECT_FALSE(ots::ots_vhea_should_serialise(&file));
+}
+
+TEST_F(TableDependenciesTest, TestVmtxGsub) {
+ DROP_LAYOUT_TABLE(gsub);
+ EXPECT_FALSE(ots::ots_vmtx_should_serialise(&file));
+ DROP_TABLE(gsub);
+ EXPECT_FALSE(ots::ots_vmtx_should_serialise(&file));
+}
+
« no previous file with comments | « third_party/ots/test/side-by-side.cc ('k') | third_party/ots/test/test_malicious_fonts.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698