use json_to_table::{json_to_table, Orientation}; use serde_json::json; use tabled::settings::Style; use testing_table::test_table; test_table!( general_json_test_0, json_to_table(&json!( { "widget": { "debug": "on", "window": { "title": "Sample Konfabulator Widget", "name": "main_window", "width": 500, "height": 500 }, "image": { "src": "Images/Sun.png", "name": "sun1", "hOffset": 250, "vOffset": 250, "alignment": "center" }, "text": { "data": "Click Here", "size": 36, "style": "bold", "name": "text1", "hOffset": 250, "vOffset": 100, "alignment": "center", "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" } } } )) .with(Style::extended()), "╔════════╦══════════════════════════════════════════════════════════════════════════╗" "║ widget ║ ╔════════╦═════════════════════════════════════════════════════════════╗ ║" "║ ║ ║ debug ║ on ║ ║" "║ ║ ╠════════╬═════════════════════════════════════════════════════════════╣ ║" "║ ║ ║ image ║ ╔═══════════╦══════════════════╗ ║ ║" "║ ║ ║ ║ ║ alignment ║ center ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬══════════════════╣ ║ ║" "║ ║ ║ ║ ║ hOffset ║ 250 ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬══════════════════╣ ║ ║" "║ ║ ║ ║ ║ name ║ sun1 ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬══════════════════╣ ║ ║" "║ ║ ║ ║ ║ src ║ Images/Sun.png ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬══════════════════╣ ║ ║" "║ ║ ║ ║ ║ vOffset ║ 250 ║ ║ ║" "║ ║ ║ ║ ╚═══════════╩══════════════════╝ ║ ║" "║ ║ ╠════════╬═════════════════════════════════════════════════════════════╣ ║" "║ ║ ║ text ║ ╔═══════════╦═════════════════════════════════════════════╗ ║ ║" "║ ║ ║ ║ ║ alignment ║ center ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬═════════════════════════════════════════════╣ ║ ║" "║ ║ ║ ║ ║ data ║ Click Here ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬═════════════════════════════════════════════╣ ║ ║" "║ ║ ║ ║ ║ hOffset ║ 250 ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬═════════════════════════════════════════════╣ ║ ║" "║ ║ ║ ║ ║ name ║ text1 ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬═════════════════════════════════════════════╣ ║ ║" "║ ║ ║ ║ ║ onMouseUp ║ sun1.opacity = (sun1.opacity / 100) * 90; ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬═════════════════════════════════════════════╣ ║ ║" "║ ║ ║ ║ ║ size ║ 36 ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬═════════════════════════════════════════════╣ ║ ║" "║ ║ ║ ║ ║ style ║ bold ║ ║ ║" "║ ║ ║ ║ ╠═══════════╬═════════════════════════════════════════════╣ ║ ║" "║ ║ ║ ║ ║ vOffset ║ 100 ║ ║ ║" "║ ║ ║ ║ ╚═══════════╩═════════════════════════════════════════════╝ ║ ║" "║ ║ ╠════════╬═════════════════════════════════════════════════════════════╣ ║" "║ ║ ║ window ║ ╔════════╦══════════════════════════════╗ ║ ║" "║ ║ ║ ║ ║ height ║ 500 ║ ║ ║" "║ ║ ║ ║ ╠════════╬══════════════════════════════╣ ║ ║" "║ ║ ║ ║ ║ name ║ main_window ║ ║ ║" "║ ║ ║ ║ ╠════════╬══════════════════════════════╣ ║ ║" "║ ║ ║ ║ ║ title ║ Sample Konfabulator Widget ║ ║ ║" "║ ║ ║ ║ ╠════════╬══════════════════════════════╣ ║ ║" "║ ║ ║ ║ ║ width ║ 500 ║ ║ ║" "║ ║ ║ ║ ╚════════╩══════════════════════════════╝ ║ ║" "║ ║ ╚════════╩═════════════════════════════════════════════════════════════╝ ║" "╚════════╩══════════════════════════════════════════════════════════════════════════╝" ); test_table!( general_json_test_1, json_to_table(&json!( { "widget": { "debug": "on", "window": { "title": "Sample Konfabulator Widget", "name": "main_window", "width": 500, "height": 500 }, "image": { "src": "Images/Sun.png", "name": "sun1", "hOffset": 250, "vOffset": 250, "alignment": "center" }, "text": { "data": "Click Here", "size": 36, "style": "bold", "name": "text1", "hOffset": 250, "vOffset": 100, "alignment": "center", "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" } } } )) .with(Style::extended()) .collapse(), "╔════════╦════════╦═══════════════════════════════════════════════════════╗" "║ widget ║ debug ║ on ║" "║ ╠════════╬═══════════╦═══════════════════════════════════════════╣" "║ ║ image ║ alignment ║ center ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ hOffset ║ 250 ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ name ║ sun1 ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ src ║ Images/Sun.png ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ vOffset ║ 250 ║" "║ ╠════════╬═══════════╬═══════════════════════════════════════════╣" "║ ║ text ║ alignment ║ center ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ data ║ Click Here ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ hOffset ║ 250 ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ name ║ text1 ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ onMouseUp ║ sun1.opacity = (sun1.opacity / 100) * 90; ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ size ║ 36 ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ style ║ bold ║" "║ ║ ╠═══════════╬═══════════════════════════════════════════╣" "║ ║ ║ vOffset ║ 100 ║" "║ ╠════════╬════════╦══╩═══════════════════════════════════════════╣" "║ ║ window ║ height ║ 500 ║" "║ ║ ╠════════╬══════════════════════════════════════════════╣" "║ ║ ║ name ║ main_window ║" "║ ║ ╠════════╬══════════════════════════════════════════════╣" "║ ║ ║ title ║ Sample Konfabulator Widget ║" "║ ║ ╠════════╬══════════════════════════════════════════════╣" "║ ║ ║ width ║ 500 ║" "╚════════╩════════╩════════╩══════════════════════════════════════════════╝" ); test_table!( general_json_test_3, json_to_table(&json!( { "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup" } } } } } )) .with(Style::modern()), "┌──────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐" "│ glossary │ ┌──────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │" "│ │ │ GlossDiv │ ┌───────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ │" "│ │ │ │ │ GlossList │ ┌────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ │ │" "│ │ │ │ │ │ │ GlossEntry │ ┌───────────┬───────────────────────────────────────────────────────────────────────────────────────────────┐ │ │ │ │" "│ │ │ │ │ │ │ │ │ Abbrev │ ISO 8879:1986 │ │ │ │ │" "│ │ │ │ │ │ │ │ ├───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ │" "│ │ │ │ │ │ │ │ │ Acronym │ SGML │ │ │ │ │" "│ │ │ │ │ │ │ │ ├───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ │" "│ │ │ │ │ │ │ │ │ GlossDef │ ┌──────────────┬────────────────────────────────────────────────────────────────────────────┐ │ │ │ │ │" "│ │ │ │ │ │ │ │ │ │ │ GlossSeeAlso │ ┌───────┐ │ │ │ │ │ │" "│ │ │ │ │ │ │ │ │ │ │ │ │ GML │ │ │ │ │ │ │" "│ │ │ │ │ │ │ │ │ │ │ │ ├───────┤ │ │ │ │ │ │" "│ │ │ │ │ │ │ │ │ │ │ │ │ XML │ │ │ │ │ │ │" "│ │ │ │ │ │ │ │ │ │ │ │ └───────┘ │ │ │ │ │ │" "│ │ │ │ │ │ │ │ │ │ ├──────────────┼────────────────────────────────────────────────────────────────────────────┤ │ │ │ │ │" "│ │ │ │ │ │ │ │ │ │ │ para │ A meta-markup language, used to create markup languages such as DocBook. │ │ │ │ │ │" "│ │ │ │ │ │ │ │ │ │ └──────────────┴────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ │" "│ │ │ │ │ │ │ │ ├───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ │" "│ │ │ │ │ │ │ │ │ GlossSee │ markup │ │ │ │ │" "│ │ │ │ │ │ │ │ ├───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ │" "│ │ │ │ │ │ │ │ │ GlossTerm │ Standard Generalized Markup Language │ │ │ │ │" "│ │ │ │ │ │ │ │ ├───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ │" "│ │ │ │ │ │ │ │ │ ID │ SGML │ │ │ │ │" "│ │ │ │ │ │ │ │ ├───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ │" "│ │ │ │ │ │ │ │ │ SortAs │ SGML │ │ │ │ │" "│ │ │ │ │ │ │ │ └───────────┴───────────────────────────────────────────────────────────────────────────────────────────────┘ │ │ │ │" "│ │ │ │ │ │ └────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │ │ │" "│ │ │ │ ├───────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ │" "│ │ │ │ │ title │ S │ │ │" "│ │ │ │ └───────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │ │" "│ │ ├──────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │" "│ │ │ title │ example glossary │ │" "│ │ └──────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │" "└──────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘" ); test_table!( general_json_test_4, json_to_table(&json!( { "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup" } } } } } )) .with(Style::modern()) .collapse(), "┌──────────┬──────────┬───────────┬────────────┬───────────┬─────────────────────────────────────────────────────────────────────────────────────────┐" "│ glossary │ GlossDiv │ GlossList │ GlossEntry │ Abbrev │ ISO 8879:1986 │" "│ │ │ │ ├───────────┼─────────────────────────────────────────────────────────────────────────────────────────┤" "│ │ │ │ │ Acronym │ SGML │" "│ │ │ │ ├───────────┼──────────────┬──────────────────────────────────────────────────────────────────────────┤" "│ │ │ │ │ GlossDef │ GlossSeeAlso │ GML │" "│ │ │ │ │ │ ├──────────────────────────────────────────────────────────────────────────┤" "│ │ │ │ │ │ │ XML │" "│ │ │ │ │ ├──────────────┼──────────────────────────────────────────────────────────────────────────┤" "│ │ │ │ │ │ para │ A meta-markup language, used to create markup languages such as DocBook. │" "│ │ │ │ ├───────────┼──────────────┴──────────────────────────────────────────────────────────────────────────┤" "│ │ │ │ │ GlossSee │ markup │" "│ │ │ │ ├───────────┼─────────────────────────────────────────────────────────────────────────────────────────┤" "│ │ │ │ │ GlossTerm │ Standard Generalized Markup Language │" "│ │ │ │ ├───────────┼─────────────────────────────────────────────────────────────────────────────────────────┤" "│ │ │ │ │ ID │ SGML │" "│ │ │ │ ├───────────┼─────────────────────────────────────────────────────────────────────────────────────────┤" "│ │ │ │ │ SortAs │ SGML │" "│ │ ├───────────┼────────────┴───────────┴─────────────────────────────────────────────────────────────────────────────────────────┤" "│ │ │ title │ S │" "│ ├──────────┼───────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤" "│ │ title │ example glossary │" "└──────────┴──────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘" ); test_table!( general_json_test_5, json_to_table(&json!( { "menu": { "header": "SVG Viewer", "items": [ {"id": "Open"}, {"id": "OpenNew", "label": "Open New"}, null, {"id": "ZoomIn", "label": "Zoom In"}, {"id": "ZoomOut", "label": "Zoom Out"}, {"id": "OriginalView", "label": "Original View"}, null, {"id": "Quality"}, {"id": "Pause"}, {"id": "Mute"}, null, {"id": "Find", "label": "Find..."}, {"id": "FindAgain", "label": "Find Again"}, {"id": "Copy"}, {"id": "CopyAgain", "label": "Copy Again"}, {"id": "CopySVG", "label": "Copy SVG"}, {"id": "ViewSVG", "label": "View SVG"}, {"id": "ViewSource", "label": "View Source"}, {"id": "SaveAs", "label": "Save As"}, null, {"id": "Help"}, {"id": "About", "label": "About Adobe CVG Viewer..."} ] } } )) .with(Style::modern()), "┌──────┬──────────────────────────────────────────────────────────┐" "│ menu │ ┌────────┬─────────────────────────────────────────────┐ │" "│ │ │ header │ SVG Viewer │ │" "│ │ ├────────┼─────────────────────────────────────────────┤ │" "│ │ │ items │ ┌─────────────────────────────────────────┐ │ │" "│ │ │ │ │ ┌────┬────────┐ │ │ │" "│ │ │ │ │ │ id │ Open │ │ │ │" "│ │ │ │ │ └────┴────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬────────────┐ │ │ │" "│ │ │ │ │ │ id │ OpenNew │ │ │ │" "│ │ │ │ │ ├───────┼────────────┤ │ │ │" "│ │ │ │ │ │ label │ Open New │ │ │ │" "│ │ │ │ │ └───────┴────────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬───────────┐ │ │ │" "│ │ │ │ │ │ id │ ZoomIn │ │ │ │" "│ │ │ │ │ ├───────┼───────────┤ │ │ │" "│ │ │ │ │ │ label │ Zoom In │ │ │ │" "│ │ │ │ │ └───────┴───────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬────────────┐ │ │ │" "│ │ │ │ │ │ id │ ZoomOut │ │ │ │" "│ │ │ │ │ ├───────┼────────────┤ │ │ │" "│ │ │ │ │ │ label │ Zoom Out │ │ │ │" "│ │ │ │ │ └───────┴────────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬─────────────────┐ │ │ │" "│ │ │ │ │ │ id │ OriginalView │ │ │ │" "│ │ │ │ │ ├───────┼─────────────────┤ │ │ │" "│ │ │ │ │ │ label │ Original View │ │ │ │" "│ │ │ │ │ └───────┴─────────────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌────┬───────────┐ │ │ │" "│ │ │ │ │ │ id │ Quality │ │ │ │" "│ │ │ │ │ └────┴───────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌────┬─────────┐ │ │ │" "│ │ │ │ │ │ id │ Pause │ │ │ │" "│ │ │ │ │ └────┴─────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌────┬────────┐ │ │ │" "│ │ │ │ │ │ id │ Mute │ │ │ │" "│ │ │ │ │ └────┴────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬───────────┐ │ │ │" "│ │ │ │ │ │ id │ Find │ │ │ │" "│ │ │ │ │ ├───────┼───────────┤ │ │ │" "│ │ │ │ │ │ label │ Find... │ │ │ │" "│ │ │ │ │ └───────┴───────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬──────────────┐ │ │ │" "│ │ │ │ │ │ id │ FindAgain │ │ │ │" "│ │ │ │ │ ├───────┼──────────────┤ │ │ │" "│ │ │ │ │ │ label │ Find Again │ │ │ │" "│ │ │ │ │ └───────┴──────────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌────┬────────┐ │ │ │" "│ │ │ │ │ │ id │ Copy │ │ │ │" "│ │ │ │ │ └────┴────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬──────────────┐ │ │ │" "│ │ │ │ │ │ id │ CopyAgain │ │ │ │" "│ │ │ │ │ ├───────┼──────────────┤ │ │ │" "│ │ │ │ │ │ label │ Copy Again │ │ │ │" "│ │ │ │ │ └───────┴──────────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬────────────┐ │ │ │" "│ │ │ │ │ │ id │ CopySVG │ │ │ │" "│ │ │ │ │ ├───────┼────────────┤ │ │ │" "│ │ │ │ │ │ label │ Copy SVG │ │ │ │" "│ │ │ │ │ └───────┴────────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬────────────┐ │ │ │" "│ │ │ │ │ │ id │ ViewSVG │ │ │ │" "│ │ │ │ │ ├───────┼────────────┤ │ │ │" "│ │ │ │ │ │ label │ View SVG │ │ │ │" "│ │ │ │ │ └───────┴────────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬───────────────┐ │ │ │" "│ │ │ │ │ │ id │ ViewSource │ │ │ │" "│ │ │ │ │ ├───────┼───────────────┤ │ │ │" "│ │ │ │ │ │ label │ View Source │ │ │ │" "│ │ │ │ │ └───────┴───────────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬───────────┐ │ │ │" "│ │ │ │ │ │ id │ SaveAs │ │ │ │" "│ │ │ │ │ ├───────┼───────────┤ │ │ │" "│ │ │ │ │ │ label │ Save As │ │ │ │" "│ │ │ │ │ └───────┴───────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌────┬────────┐ │ │ │" "│ │ │ │ │ │ id │ Help │ │ │ │" "│ │ │ │ │ └────┴────────┘ │ │ │" "│ │ │ │ ├─────────────────────────────────────────┤ │ │" "│ │ │ │ │ ┌───────┬─────────────────────────────┐ │ │ │" "│ │ │ │ │ │ id │ About │ │ │ │" "│ │ │ │ │ ├───────┼─────────────────────────────┤ │ │ │" "│ │ │ │ │ │ label │ About Adobe CVG Viewer... │ │ │ │" "│ │ │ │ │ └───────┴─────────────────────────────┘ │ │ │" "│ │ │ │ └─────────────────────────────────────────┘ │ │" "│ │ └────────┴─────────────────────────────────────────────┘ │" "└──────┴──────────────────────────────────────────────────────────┘" ); test_table!( general_json_test_6, json_to_table(&json!( { "menu": { "header": "SVG Viewer", "items": [ {"id": "Open"}, {"id": "OpenNew", "label": "Open New"}, null, {"id": "ZoomIn", "label": "Zoom In"}, {"id": "ZoomOut", "label": "Zoom Out"}, {"id": "OriginalView", "label": "Original View"}, null, {"id": "Quality"}, {"id": "Pause"}, {"id": "Mute"}, null, {"id": "Find", "label": "Find..."}, {"id": "FindAgain", "label": "Find Again"}, {"id": "Copy"}, {"id": "CopyAgain", "label": "Copy Again"}, {"id": "CopySVG", "label": "Copy SVG"}, {"id": "ViewSVG", "label": "View SVG"}, {"id": "ViewSource", "label": "View Source"}, {"id": "SaveAs", "label": "Save As"}, null, {"id": "Help"}, {"id": "About", "label": "About Adobe CVG Viewer..."} ] } } )) .with(Style::modern()) .collapse(), "┌──────┬────────┬───────────────────────────────────┐" "│ menu │ header │ SVG Viewer │" "│ ├────────┼────┬──────────────────────────────┤" "│ │ items │ id │ Open │" "│ │ ├────┴──┬───────────────────────────┤" "│ │ │ id │ OpenNew │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ Open New │" "│ │ ├───────┴───────────────────────────┤" "│ │ │ │" "│ │ ├───────┬───────────────────────────┤" "│ │ │ id │ ZoomIn │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ Zoom In │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ id │ ZoomOut │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ Zoom Out │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ id │ OriginalView │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ Original View │" "│ │ ├───────┴───────────────────────────┤" "│ │ │ │" "│ │ ├────┬──────────────────────────────┤" "│ │ │ id │ Quality │" "│ │ ├────┼──────────────────────────────┤" "│ │ │ id │ Pause │" "│ │ ├────┼──────────────────────────────┤" "│ │ │ id │ Mute │" "│ │ ├────┴──────────────────────────────┤" "│ │ │ │" "│ │ ├───────┬───────────────────────────┤" "│ │ │ id │ Find │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ Find... │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ id │ FindAgain │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ Find Again │" "│ │ ├────┬──┴───────────────────────────┤" "│ │ │ id │ Copy │" "│ │ ├────┴──┬───────────────────────────┤" "│ │ │ id │ CopyAgain │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ Copy Again │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ id │ CopySVG │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ Copy SVG │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ id │ ViewSVG │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ View SVG │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ id │ ViewSource │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ View Source │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ id │ SaveAs │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ Save As │" "│ │ ├───────┴───────────────────────────┤" "│ │ │ │" "│ │ ├────┬──────────────────────────────┤" "│ │ │ id │ Help │" "│ │ ├────┴──┬───────────────────────────┤" "│ │ │ id │ About │" "│ │ ├───────┼───────────────────────────┤" "│ │ │ label │ About Adobe CVG Viewer... │" "└──────┴────────┴───────┴───────────────────────────┘" ); test_table!( many_splits_bettween_map_entries_test, json_to_table(&json!( { "menu": { "heade1": { "heade2": { "heade3": "SVG Viewer" } } }, "menu2": { "heade4": { "heade5": { "heade6": { "header": { "header": { "header": { "header": "SVG Viewer" } } } } } } }, "menu3": { "he": { "asdd": { "x": { "1": { "header": { "header": { "header": "SVG Viewer" } } } } } } }, "menu4": { "he": { "asdd": { "xxxx": { "": { "3333": { "2": { "header": "SVG Viewer" } } } } } } }, } )) .with(Style::modern()) .collapse(), "┌───────┬────────┬────────┬────────┬────────────────────────────────────────────────┐" "│ menu │ heade1 │ heade2 │ heade3 │ SVG Viewer │" "├───────┼────────┼────────┼────────┼────────┬────────┬────────┬────────┬────────────┤" "│ menu2 │ heade4 │ heade5 │ heade6 │ header │ header │ header │ header │ SVG Viewer │" "├───────┼────┬───┴──┬───┬─┴─┬──────┴─┬──────┴─┬──────┴─┬──────┴────────┴────────────┤" "│ menu3 │ he │ asdd │ x │ 1 │ header │ header │ header │ SVG Viewer │" "├───────┼────┼──────┼───┴──┬┴─┬──────┼───┬────┴───┬────┴────────────────────────────┤" "│ menu4 │ he │ asdd │ xxxx │ │ 3333 │ 2 │ header │ SVG Viewer │" "└───────┴────┴──────┴──────┴──┴──────┴───┴────────┴─────────────────────────────────┘" ); test_table!( aray_split_test_0, json_to_table(&json!( { "menu2": [ { "heade1": { "heade3": "SVG Viewe1" } }, { "heade5": { "heade7": "SVG Viewe9" } } ], "menu3": [ { "heade2": { "heade4": "SVG Viewe2" } }, { "heade6": { "heade8": "SVG View10" } } ], } )) .with(Style::modern()) .collapse(), "┌───────┬────────┬────────┬────────────┐" "│ menu2 │ heade1 │ heade3 │ SVG Viewe1 │" "│ ├────────┼────────┼────────────┤" "│ │ heade5 │ heade7 │ SVG Viewe9 │" "├───────┼────────┼────────┼────────────┤" "│ menu3 │ heade2 │ heade4 │ SVG Viewe2 │" "│ ├────────┼────────┼────────────┤" "│ │ heade6 │ heade8 │ SVG View10 │" "└───────┴────────┴────────┴────────────┘" ); test_table!( aray_split_test_1, json_to_table(&json!( { "menu2": [ { "heade1": { "heade3": "SVG Viewe1" } }, { "heade5": { "heade7": "SVG Viewe9" } }, ], } )) .with(Style::modern()) .collapse(), "┌───────┬────────┬────────┬────────────┐" "│ menu2 │ heade1 │ heade3 │ SVG Viewe1 │" "│ ├────────┼────────┼────────────┤" "│ │ heade5 │ heade7 │ SVG Viewe9 │" "└───────┴────────┴────────┴────────────┘" ); test_table!( aray_split_test_2, json_to_table(&json!( { "menu2": [ { "header": { "header": "SVG Viewer" } }, { "header": { "header": "SVG Viewer" } } ], "menu3": [ { "hea": { "header": "SVG Viewer" } }, { "header": { "header": "SVG Viewer" } } ], } )) .with(Style::modern()) .collapse(), "┌───────┬────────┬────────┬────────────┐" "│ menu2 │ header │ header │ SVG Viewer │" "│ ├────────┼────────┼────────────┤" "│ │ header │ header │ SVG Viewer │" "├───────┼─────┬──┴─────┬──┴────────────┤" "│ menu3 │ hea │ header │ SVG Viewer │" "│ ├─────┴──┬─────┴──┬────────────┤" "│ │ header │ header │ SVG Viewer │" "└───────┴────────┴────────┴────────────┘" ); test_table!( aray_split_test_3, json_to_table(&json!( { "host": { "long_os_version": "", "uptime": 0.0 }, "men": { "available": 123123.22 }, } )) .with(Style::modern()) .collapse(), "┌──────┬─────────────────┬─────┐" "│ host │ long_os_version │ │" "│ ├─────────────────┼─────┤" "│ │ uptime │ 0.0 │" "├──────┼───────────┬─────┴─────┤" "│ men │ available │ 123123.22 │" "└──────┴───────────┴───────────┘" ); test_table!( aray_split_test_4, json_to_table(&json!( { "key1": [ { "name": "groups" }, { "root": ["root"] }, { "git": ["git"] }, ] } )) .with(Style::modern()) .collapse(), "┌──────┬──────┬────────┐" "│ key1 │ name │ groups │" "│ ├──────┼────────┤" "│ │ root │ root │" "│ ├─────┬┴────────┤" "│ │ git │ git │" "└──────┴─────┴─────────┘" ); test_table!( array_split_with_inner_array_test, json_to_table(&json!( { "menu": [ [ { "key1": 123, "key2": "asd" } ], [ { "key": 123, "ke": "asd" } ] , ], } )) .with(Style::modern()) .collapse(), "┌──────┬──────┬─────┐" "│ menu │ key1 │ 123 │" "│ ├──────┼─────┤" "│ │ key2 │ asd │" "│ ├─────┬┴─────┤" "│ │ ke │ asd │" "│ ├─────┼──────┤" "│ │ key │ 123 │" "└──────┴─────┴──────┘" ); test_table!( array_split_with_inner_array_2_test, json_to_table(&json!( [ [ [ { "key1": 123 } ], [ "asd", "asd" ] ], [ [ { "k": 123 } ], [ "v", "z" ] ], ] )) .with(Style::modern()) .collapse(), "┌──────┬─────┐" "│ key1 │ 123 │" "├──────┴─────┤" "│ asd │" "├────────────┤" "│ asd │" "├───┬────────┤" "│ k │ 123 │" "├───┴────────┤" "│ v │" "├────────────┤" "│ z │" "└────────────┘" ); test_table!( test_map_empty_entity_collapsed_0, json_to_table(&json!( { "field1" : {}, "field2": "Value", "field3" : {}, "field4": 3, "field5" : {} } )) .with(Style::modern()) .collapse(), "┌────────┬───────┐" "│ field1 │ │" "├────────┼───────┤" "│ field2 │ Value │" "├────────┼───────┤" "│ field3 │ │" "├────────┼───────┤" "│ field4 │ 3 │" "├────────┼───────┤" "│ field5 │ │" "└────────┴───────┘" ); test_table!( test_map_empty_entity_collapsed_1, json_to_table(&json!( { "field1" : [], "field2": "Value", "field3" : [], "field4": 3, "field5" : [] } )) .with(Style::modern()) .collapse(), "┌────────┬───────┐" "│ field1 │ │" "├────────┼───────┤" "│ field2 │ Value │" "├────────┼───────┤" "│ field3 │ │" "├────────┼───────┤" "│ field4 │ 3 │" "├────────┼───────┤" "│ field5 │ │" "└────────┴───────┘" ); test_table!( test_map_empty_entity_collapsed_2, json_to_table(&json!( { "key0": {}, "field1" : { "key1": "value1", "key2": [] }, "field2": "Value", "field3" : [], "field4": [ {}, "123", {}, "sadas", {} ], "field5" : [] } )) .with(Style::modern()) .collapse(), "┌────────┬──────┬────────┐" "│ field1 │ key1 │ value1 │" "│ ├──────┼────────┤" "│ │ key2 │ │" "├────────┼──────┴────────┤" "│ field2 │ Value │" "├────────┼───────────────┤" "│ field3 │ │" "├────────┼───────────────┤" "│ field4 │ │" "│ ├───────────────┤" "│ │ 123 │" "│ ├───────────────┤" "│ │ │" "│ ├───────────────┤" "│ │ sadas │" "│ ├───────────────┤" "│ │ │" "├────────┼───────────────┤" "│ field5 │ │" "├────────┼───────────────┤" "│ key0 │ │" "└────────┴───────────────┘" ); test_table!( test_list_empty_entity_collapsed_0, json_to_table(&json!( [{}, "field1", {}, "field2", {}] )) .with(Style::modern()) .collapse(), "┌────────┐" "│ │" "├────────┤" "│ field1 │" "├────────┤" "│ │" "├────────┤" "│ field2 │" "├────────┤" "│ │" "└────────┘" ); test_table!( test_list_empty_entity_collapsed_1, json_to_table(&json!( [{}, {}, {}] )) .with(Style::modern()) .collapse(), "┌──┐" "│ │" "├──┤" "│ │" "├──┤" "│ │" "└──┘" ); test_table!( test_list_empty_entity_collapsed_2, json_to_table(&json!( [[], [], []] )) .with(Style::modern()) .collapse(), "┌──┐" "│ │" "├──┤" "│ │" "├──┤" "│ │" "└──┘" ); test_table!( test_map_empty_entity_collapsed_1_horizontal, json_to_table(&json!( { "field1" : [], "field2": "Value", "field3" : [], "field4": 3, "field5" : [] } )) .with(Style::modern()) .array_orientation(Orientation::Row) .collapse(), "┌────────┬───────┐" "│ field1 │ │" "├────────┼───────┤" "│ field2 │ Value │" "├────────┼───────┤" "│ field3 │ │" "├────────┼───────┤" "│ field4 │ 3 │" "├────────┼───────┤" "│ field5 │ │" "└────────┴───────┘" ); test_table!( test_map_empty_entity_collapsed_2_horizontal, json_to_table(&json!( { "key0": {}, "field1" : { "key1": "value1", "key2": [] }, "field2": "Value", "field3" : [], "field4": [ {}, "123", {}, "sadas", {} ], "field5" : [] } )) .with(Style::modern()) .array_orientation(Orientation::Row) .collapse(), "┌────────┬──────┬───────────────┐" "│ field1 │ key1 │ value1 │" "│ ├──────┼───────────────┤" "│ │ key2 │ │" "├────────┼──────┴───────────────┤" "│ field2 │ Value │" "├────────┼──────────────────────┤" "│ field3 │ │" "├────────┼──┬─────┬──┬───────┬──┤" "│ field4 │ │ 123 │ │ sadas │ │" "├────────┼──┴─────┴──┴───────┴──┤" "│ field5 │ │" "├────────┼──────────────────────┤" "│ key0 │ │" "└────────┴──────────────────────┘" ); test_table!( test_list_empty_entity_collapsed_0_horizontal, json_to_table(&json!( [{}, "field1", {}, "field2", {}] )) .with(Style::modern()) .array_orientation(Orientation::Row) .collapse(), "┌──┬────────┬──┬────────┬──┐" "│ │ field1 │ │ field2 │ │" "└──┴────────┴──┴────────┴──┘" ); test_table!( test_list_empty_entity_collapsed_1_horizontal, json_to_table(&json!( [{}, {}, {}] )) .with(Style::modern()) .array_orientation(Orientation::Row) .collapse(), "┌──┬──┬──┐" "│ │ │ │" "└──┴──┴──┘" ); test_table!( test_list_empty_entity_collapsed_2_horizontal, json_to_table(&json!( [[], [], []] )) .with(Style::modern()) .array_orientation(Orientation::Row) .collapse(), "┌──┬──┬──┐" "│ │ │ │" "└──┴──┴──┘" ); test_table!( test_map_empty_entity_collapsed_1_horizontal_map, json_to_table(&json!( { "field1" : [], "field2": "Value", "field3" : [], "field4": 3, "field5" : [] } )) .with(Style::modern()) .object_orientation(Orientation::Row) .collapse(), "┌────────┬────────┬────────┬────────┬────────┐" "│ field1 │ field2 │ field3 │ field4 │ field5 │" "├────────┼────────┼────────┼────────┼────────┤" "│ │ Value │ │ 3 │ │" "└────────┴────────┴────────┴────────┴────────┘" ); test_table!( test_map_empty_entity_collapsed_2_horizontal_map, json_to_table(&json!( { "key0": {}, "field1" : { "key1": "value1", "key2": [] }, "field2": "Value", "field3" : [], "field4": [ {}, "123", {}, "sadas", {} ], "field5" : [] } )) .with(Style::modern()) .object_orientation(Orientation::Row) .collapse(), "┌───────────────┬────────┬────────┬────────┬────────┬──────┐" "│ field1 │ field2 │ field3 │ field4 │ field5 │ key0 │" "├────────┬──────┼────────┼────────┼────────┼────────┼──────┤" "│ key1 │ key2 │ Value │ │ │ │ │" "├────────┼──────┤ │ ├────────┤ │ │" "│ value1 │ │ │ │ 123 │ │ │" "│ │ │ │ ├────────┤ │ │" "│ │ │ │ │ │ │ │" "│ │ │ │ ├────────┤ │ │" "│ │ │ │ │ sadas │ │ │" "│ │ │ │ ├────────┤ │ │" "│ │ │ │ │ │ │ │" "└────────┴──────┴────────┴────────┴────────┴────────┴──────┘" ); test_table!( test_list_empty_entity_collapsed_0_horizontal_map, json_to_table(&json!( [{}, "field1", {}, "field2", {}] )) .with(Style::modern()) .object_orientation(Orientation::Row) .collapse(), "┌────────┐" "│ │" "├────────┤" "│ field1 │" "├────────┤" "│ │" "├────────┤" "│ field2 │" "├────────┤" "│ │" "└────────┘" ); test_table!( test_list_empty_entity_collapsed_1_horizontal_map, json_to_table(&json!( [{}, {}, {}] )) .with(Style::modern()) .object_orientation(Orientation::Row) .collapse(), "┌──┐" "│ │" "├──┤" "│ │" "├──┤" "│ │" "└──┘" ); test_table!( test_list_empty_entity_collapsed_2_horizontal_map, json_to_table(&json!( [[], [], []] )) .with(Style::modern()) .object_orientation(Orientation::Row) .collapse(), "┌──┐" "│ │" "├──┤" "│ │" "├──┤" "│ │" "└──┘" ); test_table!( test_map_empty_entity_plain_0, json_to_table(&json!( { "field1" : {}, "field2": "Value", "field3" : {}, "field4": 3, "field5" : {} } )) .with(Style::modern()), "┌────────┬─────────┐" "│ field1 │ │" "├────────┼─────────┤" "│ field2 │ Value │" "├────────┼─────────┤" "│ field3 │ │" "├────────┼─────────┤" "│ field4 │ 3 │" "├────────┼─────────┤" "│ field5 │ │" "└────────┴─────────┘" ); test_table!( test_list_empty_entity_plain_0, json_to_table(&json!( [{}, "field1", {}, "field2", {}] )) .with(Style::modern()), "┌──────────┐" "│ │" "├──────────┤" "│ field1 │" "├──────────┤" "│ │" "├──────────┤" "│ field2 │" "├──────────┤" "│ │" "└──────────┘" ); test_table!( test_list_empty_entity_plain_1, json_to_table(&json!( [[], "field1", [], "field2", []] )) .with(Style::modern()), "┌──────────┐" "│ │" "├──────────┤" "│ field1 │" "├──────────┤" "│ │" "├──────────┤" "│ field2 │" "├──────────┤" "│ │" "└──────────┘" ); test_table!( test_list_empty_entity_plain_2, json_to_table(&json!( [{}, {}, {}] )) .with(Style::modern()), "┌──┐" "│ │" "├──┤" "│ │" "├──┤" "│ │" "└──┘" ); test_table!( test_multiline_key_height_bigger_then_value, json_to_table(&json!( { "config": { "key1": 123, "multi_\n_line_\n_key": false, "key2": {"a long long long key": false} }, } )) .with(Style::modern()) .collapse(), "┌────────┬────────┬──────────────────────────────┐" "│ config │ key1 │ 123 │" "│ ├────────┼──────────────────────┬───────┤" "│ │ key2 │ a long long long key │ false │" "│ ├────────┼──────────────────────┴───────┤" "│ │ multi_ │ false │" "│ │ _line_ │ │" "│ │ _key │ │" "└────────┴────────┴──────────────────────────────┘" ); test_table!( test_multiline_key_height_less_then_value, json_to_table(&json!( { "config": { "key1": 123, "multi_\n_line_\n_key": "1\n2\n3\n4\n5\n6\n7\n", "key2": {"a long long long key": false} }, } )) .with(Style::modern()) .collapse(), "┌────────┬────────┬──────────────────────────────┐" "│ config │ key1 │ 123 │" "│ ├────────┼──────────────────────┬───────┤" "│ │ key2 │ a long long long key │ false │" "│ ├────────┼──────────────────────┴───────┤" "│ │ multi_ │ 1 │" "│ │ _line_ │ 2 │" "│ │ _key │ 3 │" "│ │ │ 4 │" "│ │ │ 5 │" "│ │ │ 6 │" "│ │ │ 7 │" "│ │ │ │" "└────────┴────────┴──────────────────────────────┘" );