[Tex/LaTex] Fill section entries in table of contents with dots (using scrartcl)

koma-scripttable of contents

I use scrartcl and I want to …

  1. have list of figures and list of tables listed in the table of contents
  2. fill the space between sections and their pagenumbers with dots in the table of contents
  3. leave the rest of the table of contents unchanged.

So this is the desired output, generated using tocstyle (code below):

\documentclass[listof=totoc]{scrartcl}

% Problem: alpha version and warning.
\usepackage{tocstyle}
\newtocstyle[KOMAlike][leaders]{alldotted}{}
\usetocstyle{alldotted}

\begin{document}
\tableofcontents
\vfill\hrule
\listoffigures
\listoftables

\section{Test section}
\subsection{Test subsection}
\end{document}

Question: How can I get the same output without using tocstyle? I would like to avoid tocstyle because it always generates a warning that the package is an alpha version that may change in the future.

I would prefer a solution that is as minimal as possible, avoiding additional packages, manually adding LOF and LOT to the TOC, etc.

I already tried to use tocloft instead, but then other things break:
Result with <code>tocloft</code>

\documentclass[listof=totoc]{scrartcl}

% Problem: LOF and LOT not in TOC; different font style for sections.
\usepackage{tocloft}
\renewcommand{\cftsecdotsep}{\cftdotsep}
\renewcommand{\cftsecleader}{\cftdotfill{\cftsecdotsep}}

\begin{document}
\tableofcontents
\vfill\hrule
\listoffigures
\listoftables

\section{Test section}
\subsection{Test subsection}
\end{document}

Best Answer

Use the option toc=sectionentrywithdots. Though the manual says it is a beta feature, no warnings are generated.

\documentclass[listof=totoc,toc=sectionentrywithdots]{scrartcl}  


\begin{document}
\tableofcontents
\vfill\hrule
\listoffigures
\listoftables

\section{Test section}
\subsection{Test subsection}
\end{document}

enter image description here