From 27e50a28efaf1ac10dd7e252d9af8ea00589cafe Mon Sep 17 00:00:00 2001 From: Sarah Gilmore Date: Fri, 29 Sep 2023 15:13:19 -0400 Subject: [PATCH] Update Schema display tests --- .../+arrow/+tabular/+internal/displaySchema.m | 4 +-- matlab/test/arrow/tabular/tSchema.m | 29 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/matlab/src/matlab/+arrow/+tabular/+internal/displaySchema.m b/matlab/src/matlab/+arrow/+tabular/+internal/displaySchema.m index 228d43e3db7d2..54f6bc05f2a89 100644 --- a/matlab/src/matlab/+arrow/+tabular/+internal/displaySchema.m +++ b/matlab/src/matlab/+arrow/+tabular/+internal/displaySchema.m @@ -26,8 +26,8 @@ names(idx) = ""; if usejava("desktop") - % When in desktop mode, the Command Window can render - % bold font and hyperlinks. + % When in desktop mode, the Command Window can interpret HTML tags + % to display bold font and hyperlinks. names = compose("%s", names); classNames = arrayfun(@(type) string(class(type)), types); classNameAndIDs = strings([1 numel(typeIDs) * 2]); diff --git a/matlab/test/arrow/tabular/tSchema.m b/matlab/test/arrow/tabular/tSchema.m index 21f8be0eb7087..bb95c1823b9fc 100644 --- a/matlab/test/arrow/tabular/tSchema.m +++ b/matlab/test/arrow/tabular/tSchema.m @@ -550,14 +550,14 @@ function TestDisplaySchemaOneField(testCase) indent = " "; if usejava("desktop") - fieldNameLine = indent + strjust(pad("TestField", 28), "center"); + type = makeLinkString(FullClassName="arrow.type.BooleanType", ... + ClassName="Boolean", BoldFont=true); + name = "TestField: "; + fieldLine = indent + name + type + newline; else - fieldNameLine = indent + strjust(pad("TestField", 11), "center"); + fieldLine = indent + "TestField: Boolean" + newline; end - dividerLine = indent + string(repmat('_', [1 11])) + newline; - fieldTypeLine = indent + "BooleanType" + newline; - expectedDisplay = join([header, fieldNameLine, dividerLine, fieldTypeLine], newline); - + expectedDisplay = join([header, fieldLine], newline); expectedDisplay = char(expectedDisplay + newline); actualDisplay = evalc('disp(schema)'); testCase.verifyEqual(actualDisplay, char(expectedDisplay)); @@ -575,17 +575,18 @@ function TestDisplaySchemaField(testCase) indent = " "; if usejava("desktop") - fieldNameLine = indent + strjust(pad("Field1", 30), "center"); - fieldNameLine = fieldNameLine + indent + strjust(pad("Field2", 27), "center"); + type1 = makeLinkString(FullClassName="arrow.type.TimestampType", ... + ClassName="Timestamp", BoldFont=true); + field1String = "Field1: " + type1; + type2 = makeLinkString(FullClassName="arrow.type.StringType", ... + ClassName="String", BoldFont=true); + field2String = "Field2: " + type2; + fieldLine = indent + field1String + " | " + field2String + newline; else - fieldNameLine = indent + strjust(pad("Field1", 13), "center"); - fieldNameLine = fieldNameLine + indent + strjust(pad("Field2", 10), "center") + newline; + fieldLine = indent + "Field1: Timestamp | Field2: String" + newline; end - dividerLine = indent + repmat('_', [1 13]) + indent + repmat('_', [1 10]) + newline; - fieldTypeLine = indent + "TimestampType" + indent + "StringType" + newline; - expectedDisplay = join([header, fieldNameLine, dividerLine, fieldTypeLine], newline); - + expectedDisplay = join([header, fieldLine], newline); expectedDisplay = char(expectedDisplay + newline); actualDisplay = evalc('disp(schema)'); testCase.verifyEqual(actualDisplay, char(expectedDisplay));