cid#1640468 Dereference after null check
[LibreOffice.git] / sd / qa / unit / SVGExportTests.cxx
blobbcd0b2908f06bd21a70549780575fd18171d43ec
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <sal/config.h>
12 #include <string_view>
13 #include <test/unoapixml_test.hxx>
15 #include <sal/macros.h>
16 #include <unotools/syslocaleoptions.hxx>
17 #include <vcl/svapp.hxx>
18 #include <vcl/settings.hxx>
20 #include <regex>
22 #define SVG_SVG *[name()='svg']
23 #define SVG_G *[name()='g']
24 #define SVG_TEXT *[name()='text']
25 #define SVG_TSPAN *[name()='tspan']
26 #define SVG_DEFS *[name()='defs']
27 #define SVG_IMAGE *[name()='image']
28 #define SVG_USE *[name()='use']
29 #define SVG_PATTERN *[name()='pattern']
30 #define SVG_RECT *[name()='rect']
31 #define SVG_FOREIGNOBJECT *[name()='foreignObject']
32 #define SVG_BODY *[name()='body']
33 #define SVG_VIDEO *[name()='video']
35 using namespace css;
37 namespace
39 bool isValidBitmapId(const OUString& sId)
41 std::regex aRegEx("bitmap\\(\\d+\\)");
42 return std::regex_match(sId.toUtf8().getStr(), aRegEx);
45 BitmapChecksum getBitmapChecksumFromId(std::u16string_view sId)
47 size_t nStart = sId.find(u"(") + 1;
48 size_t nCount = sId.find(u")") - nStart;
49 bool bIsValidRange = nStart > 0 && nStart != std::u16string_view::npos && nCount > 0;
50 CPPUNIT_ASSERT(bIsValidRange);
51 OUString sChecksum( sId.substr( nStart, nCount ) );
52 return sChecksum.toUInt64();
55 bool isValidBackgroundPatternId(const OUString& sId)
57 std::regex aRegEx( R"(bg\-pattern\.id\d+\.\d+)" );
58 return std::regex_match(sId.toUtf8().getStr(), aRegEx);
61 bool isValidTiledBackgroundId(const OUString& sId)
63 std::regex aRegEx( R"(bg\-id\d+\.\d+)" );
64 return std::regex_match(sId.toUtf8().getStr(), aRegEx);
69 class SdSVGFilterTest : public UnoApiXmlTest
71 public:
72 SdSVGFilterTest()
73 : UnoApiXmlTest(u"/sd/qa/unit/data/odp/"_ustr)
77 void testSVGExportTextDecorations()
79 loadFromFile(u"svg-export-text-decorations.odp");
80 save(u"impress_svg_Export"_ustr);
82 xmlDocUniquePtr svgDoc = parseXml(maTempFile);
83 CPPUNIT_ASSERT(svgDoc);
85 svgDoc->name = reinterpret_cast<char *>(xmlStrdup(reinterpret_cast<xmlChar const *>(OUStringToOString(maTempFile.GetURL(), RTL_TEXTENCODING_UTF8).getStr())));
87 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG ), 1);
88 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2] ), "class", u"SlideGroup");
89 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G ), "class", u"Slide");
90 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[1] ), "class", u"TitleText");
91 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT ), "class", u"SVGTextShape");
92 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN ), "class", u"TextPosition");
93 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN[1] ), "text-decoration", u"underline");
95 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT ), "class", u"SVGTextShape");
96 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN ), "class", u"TextPosition");
97 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "text-decoration", u"line-through");
100 void testSVGExportJavascriptURL()
102 loadFromFile(u"textbox-link-javascript.odp");
103 save(u"impress_svg_Export"_ustr);
105 xmlDocUniquePtr svgDoc = parseXml(maTempFile);
106 CPPUNIT_ASSERT(svgDoc);
108 // There should be only one child (no link to javascript url)
109 assertXPathChildren(svgDoc,
110 SAL_STRINGIFY(/ SVG_SVG / SVG_G[2] / SVG_G / SVG_G / SVG_G / SVG_G
111 / SVG_G[3] / SVG_G),
115 void testSVGExportSlideCustomBackground()
117 loadFromFile(u"slide-custom-background.odp");
118 save(u"impress_svg_Export"_ustr);
120 xmlDocUniquePtr svgDoc = parseXml(maTempFile);
121 CPPUNIT_ASSERT(svgDoc);
123 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_DEFS ), "class", u"SlideBackground");
126 void testSVGExportTextFieldsInMasterPage()
128 loadFromFile(u"text-fields.odp");
129 save(u"impress_svg_Export"_ustr);
131 xmlDocUniquePtr svgDoc = parseXml(maTempFile);
132 CPPUNIT_ASSERT(svgDoc);
134 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2] ), "class", u"Master_Slide");
135 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects");
136 // Current Date Field
137 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[4] ), "class", u"TextShape");
138 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[4]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Date");
139 // Current Time Field
140 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[5] ), "class", u"TextShape");
141 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[5]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Time");
142 // Slide Name Field
143 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape");
144 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName");
145 // Slide Number Field
146 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape");
147 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber");
150 void testSVGExportEmbeddedVideo()
152 loadFromFile(u"slide-video-thumbnail.odp");
153 save(u"impress_svg_Export"_ustr);
155 xmlDocUniquePtr svgDoc = parseXml(maTempFile);
156 CPPUNIT_ASSERT(svgDoc);
158 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG ), 1);
159 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2] ), "class", u"SlideGroup");
160 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1] ), "visibility", u"hidden");
161 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1] ), "id", u"container-id1");
162 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1] ), "class", u"Slide");
163 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1] ), "class", u"Page");
164 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1] ), "class", u"TitleText");
166 // First one has no valid video, so we just generate the stock thumbnail as an image.
167 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[2] ), "class", u"com.sun.star.presentation.MediaShape");
168 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[2]/SVG_G[1]/SVG_IMAGE ), 1);
170 // The second one is a valid video, with the thumbnail embedded.
171 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[5] ), "class", u"com.sun.star.drawing.MediaShape");
172 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[5]/SVG_G[1] ), 1);
173 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[5]/SVG_G[1]/SVG_FOREIGNOBJECT ), 1);
174 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[5]/SVG_G[1]/SVG_FOREIGNOBJECT/SVG_BODY ), 1);
175 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[5]/SVG_G[1]/SVG_FOREIGNOBJECT/SVG_BODY/SVG_VIDEO ), "preload", u"auto");
177 const OUString poster = getXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[1]/SVG_G[5]/SVG_G[1]/SVG_FOREIGNOBJECT/SVG_BODY/SVG_VIDEO), "poster");
178 CPPUNIT_ASSERT_MESSAGE("The video poster is invalid", poster.startsWith("data:image/png;base64,"));
181 void testSVGExportSlideBitmapBackground()
183 loadFromFile(u"slide-bitmap-background.odp");
184 save(u"impress_svg_Export"_ustr);
186 xmlDocUniquePtr svgDoc = parseXml(maTempFile);
187 CPPUNIT_ASSERT(svgDoc);
189 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10] ), "class", u"BackgroundBitmaps");
190 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_IMAGE ), 1);
192 OUString sImageId = getXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_IMAGE ), "id");
193 CPPUNIT_ASSERT_MESSAGE(OString("The exported bitmap has not a valid id: " + sImageId.toUtf8()).getStr(), isValidBitmapId(sImageId));
195 BitmapChecksum nChecksum = getBitmapChecksumFromId(sImageId);
196 CPPUNIT_ASSERT_MESSAGE(OString("The exported bitmap has not a valid checksum: " + sImageId.toUtf8()).getStr(), nChecksum != 0);
198 // single image case
199 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_DEFS ), "class", u"SlideBackground");
200 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_DEFS/SVG_G/SVG_G/SVG_USE ), 1);
201 OUString sRef = getXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_DEFS/SVG_G/SVG_G/SVG_USE ), "href");
202 CPPUNIT_ASSERT_MESSAGE("The <use> element has not a valid href attribute: starting '#' not present.", sRef.startsWith("#"));
203 sRef = sRef.copy(1);
204 CPPUNIT_ASSERT_MESSAGE(OString("The <use> element does not point to a valid bitmap id: " + sRef.toUtf8()).getStr(), isValidBitmapId(sRef));
206 BitmapChecksum nUseChecksum = getBitmapChecksumFromId(sRef);
207 CPPUNIT_ASSERT_EQUAL_MESSAGE("The bitmap checksum used in <use> does not match the expected one: ", nChecksum, nUseChecksum);
210 void testSVGExportSlideTileBitmapBackground()
212 loadFromFile(u"slide-tile-background.odp");
213 save(u"impress_svg_Export"_ustr);
215 xmlDocUniquePtr svgDoc = parseXml(maTempFile);
216 CPPUNIT_ASSERT(svgDoc);
218 // check the bitmap
219 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10] ), "class", u"BackgroundBitmaps");
220 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_IMAGE ), 1);
222 // check the pattern and background rectangle
223 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[11] ), "class", u"BackgroundPatterns");
224 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[11]/SVG_PATTERN ), 1);
225 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[11]/SVG_PATTERN/SVG_USE ), 1);
226 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[11]/SVG_G/SVG_RECT ), 1);
229 // check that <pattern><use> is pointing to the correct <image>
230 OUString sImageId = getXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_IMAGE ), "id");
231 CPPUNIT_ASSERT_MESSAGE(OString("The exported bitmap has not a valid id: " + sImageId.toUtf8()).getStr(), isValidBitmapId(sImageId));
233 BitmapChecksum nChecksum = getBitmapChecksumFromId(sImageId);
234 CPPUNIT_ASSERT_MESSAGE(OString("The exported bitmap has not a valid checksum: " + sImageId.toUtf8()).getStr(), nChecksum != 0);
236 OUString sRef = getXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[11]/SVG_PATTERN/SVG_USE ), "href");
237 CPPUNIT_ASSERT_MESSAGE("The <pattern><use> element has not a valid href attribute: starting '#' not present.", sRef.startsWith("#"));
238 sRef = sRef.copy(1);
239 CPPUNIT_ASSERT_EQUAL_MESSAGE("The href attribute for <pattern><use> does not match the <image> id attribute: ", sImageId, sRef);
241 OUString sPatternId = getXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[11]/SVG_PATTERN ), "id");
242 CPPUNIT_ASSERT_MESSAGE(OString("The exported pattern has not a valid id: " + sPatternId.toUtf8()).getStr(), isValidBackgroundPatternId(sPatternId));
244 OUString sFillUrl = getXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[11]/SVG_G/SVG_RECT ), "fill");
245 bool bIsUrlFormat = sFillUrl.startsWith("url(#") && sFillUrl.endsWith(")");
246 CPPUNIT_ASSERT_MESSAGE("The fill attribute for the <rectangle> element has not a url format .", bIsUrlFormat);
247 // remove "url(#" and ")"
248 sFillUrl = sFillUrl.copy(5, sFillUrl.getLength() - 6);
249 CPPUNIT_ASSERT_EQUAL_MESSAGE("The fill url for <rectangle> does not match the <pattern> id attribute: ", sPatternId, sFillUrl);
251 OUString sBackgroundId = getXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[11]/SVG_G ), "id");
252 CPPUNIT_ASSERT_MESSAGE(OString("The exported tiled background has not a valid id: " + sBackgroundId.toUtf8()).getStr(), isValidTiledBackgroundId(sBackgroundId));
254 // check <use> element that point to the tiled background
255 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_DEFS ), "class", u"SlideBackground");
256 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_DEFS/SVG_G/SVG_USE ), 1);
258 sRef = getXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_DEFS/SVG_G/SVG_USE ), "href");
259 CPPUNIT_ASSERT_MESSAGE("The <use> element has not a valid href attribute: starting '#' not present.", sRef.startsWith("#"));
260 sRef = sRef.copy(1);
261 CPPUNIT_ASSERT_EQUAL_MESSAGE("The href attribute for <use> does not match the tiled background id attribute: ", sBackgroundId, sRef);
264 void testSVGPlaceholderLocale()
266 static constexpr OUString aLangISO(u"it-IT"_ustr);
267 SvtSysLocaleOptions aSysLocaleOptions;
268 aSysLocaleOptions.SetLocaleConfigString(aLangISO);
269 aSysLocaleOptions.SetUILocaleConfigString(aLangISO);
271 auto aSavedSettings = Application::GetSettings();
272 Resetter aResetter([&]() { Application::SetSettings(aSavedSettings); });
273 AllSettings aSettings(aSavedSettings);
274 aSettings.SetLanguageTag(aLangISO, true);
275 Application::SetSettings(aSettings);
277 loadFromFile(u"text-fields.odp");
278 save(u"impress_svg_Export"_ustr);
280 xmlDocUniquePtr svgDoc = parseXml(maTempFile);
281 CPPUNIT_ASSERT(svgDoc);
283 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2] ), "class", u"Master_Slide");
284 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects");
286 // Slide Name Field
287 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape");
288 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName");
289 // Slide Number Field
290 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape");
291 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber");
294 CPPUNIT_TEST_SUITE(SdSVGFilterTest);
295 CPPUNIT_TEST(testSVGExportTextDecorations);
296 CPPUNIT_TEST(testSVGExportJavascriptURL);
297 CPPUNIT_TEST(testSVGExportSlideCustomBackground);
298 CPPUNIT_TEST(testSVGExportTextFieldsInMasterPage);
299 CPPUNIT_TEST(testSVGExportEmbeddedVideo);
300 CPPUNIT_TEST(testSVGExportSlideBitmapBackground);
301 CPPUNIT_TEST(testSVGExportSlideTileBitmapBackground);
302 CPPUNIT_TEST(testSVGPlaceholderLocale);
303 CPPUNIT_TEST_SUITE_END();
306 CPPUNIT_TEST_SUITE_REGISTRATION(SdSVGFilterTest);
308 CPPUNIT_PLUGIN_IMPLEMENT();
310 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */