Fix preview for file templates with options: add vars with default values
ClosedPublic

Authored by kossebau on Jan 31 2017, 11:52 PM.

Details

Summary

For templates which based display on variables filled by options,
the preview showed empty spots, making the templates look broken.
Adding the vars from the options with the default values fixes this.

Diff Detail

Repository
R33 KDevPlatform
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau updated this revision to Diff 10793.Jan 31 2017, 11:52 PM
kossebau retitled this revision from to Fix preview for file templates with options: add vars with default values.
kossebau updated this object.
kossebau added reviewers: KDevelop, apol.
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptJan 31 2017, 11:52 PM
apol edited edge metadata.Feb 1 2017, 12:00 AM

Before and after screenshots? :/

Hard to show by one single screenshot, there are many small issues across many templates :)
It is all places in templates where output based on options is done, like {{ interfaceid }} or {% if testCase_initAndCleanup %}foo{% endif %}. With all those vars evaluating to null the templates look empty or partially broken.

By example of Qt test suite template, "Implementation" file preview content.

With patch:

/*
 * This file is licensed under the ExampleLicense 3.0
 */

#include "Example.h"

#include <QtTest>

QTEST_MAIN(Example);

void Example::initTestCase()
{
    // Called before the first testfunction is executed
}

void Example::cleanupTestCase()
{
    // Called after the last testfunction was executed
}

void Example::init()
{
    // Called before each testfunction is executed
}

void Example::cleanup()
{
    // Called after every testfunction
}

void Example::doFoo()
{

}

void Example::doBar()
{

}

void Example::doMore()
{

}

Without:

/*
 * This file is licensed under the ExampleLicense 3.0
 */

#include "Example.h"

#include <QtTest>

(Example);

void Example::doFoo()
{

}

void Example::doBar()
{

}

void Example::doMore()
{

}
mwolff accepted this revision.Feb 1 2017, 8:43 AM
mwolff added a reviewer: mwolff.
This revision is now accepted and ready to land.Feb 1 2017, 8:43 AM
This revision was automatically updated to reflect the committed changes.