Skip to content

Commit

Permalink
Update Schema display tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed Sep 29, 2023
1 parent 6754db8 commit 27e50a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions matlab/src/matlab/+arrow/+tabular/+internal/displaySchema.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
names(idx) = "<empty>";

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("<strong>%s</strong>", names);
classNames = arrayfun(@(type) string(class(type)), types);
classNameAndIDs = strings([1 numel(typeIDs) * 2]);
Expand Down
29 changes: 15 additions & 14 deletions matlab/test/arrow/tabular/tSchema.m
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,14 @@ function TestDisplaySchemaOneField(testCase)
indent = " ";

if usejava("desktop")
fieldNameLine = indent + strjust(pad("<strong>TestField</strong>", 28), "center");
type = makeLinkString(FullClassName="arrow.type.BooleanType", ...
ClassName="Boolean", BoldFont=true);
name = "<strong>TestField</strong>: ";
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));
Expand All @@ -575,17 +575,18 @@ function TestDisplaySchemaField(testCase)

indent = " ";
if usejava("desktop")
fieldNameLine = indent + strjust(pad("<strong>Field1</strong>", 30), "center");
fieldNameLine = fieldNameLine + indent + strjust(pad("<strong>Field2</strong>", 27), "center");
type1 = makeLinkString(FullClassName="arrow.type.TimestampType", ...
ClassName="Timestamp", BoldFont=true);
field1String = "<strong>Field1</strong>: " + type1;
type2 = makeLinkString(FullClassName="arrow.type.StringType", ...
ClassName="String", BoldFont=true);
field2String = "<strong>Field2</strong>: " + 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));
Expand Down

0 comments on commit 27e50a2

Please sign in to comment.