[Tex/LaTex] tikz node align text to bottom of rectangle

tikz-pgf

How can I align the text of a node to the bottom of the rectangle shape without hard coding values? (centered horizontally but justified to the bottom)

\tikz[]{
\node[shape=rectangle, inner sep=8pt, minimum height=1.2cm, fill=black, text=white, font=\huge, text depth=-0.6cm] {test};
}\tikz[]{
\node[shape=rectangle, inner sep=8pt, minimum height=1.2cm, fill=black, text=white, font=\huge, text depth=0cm] {test};
}\tikz[]{
\node[shape=rectangle, inner sep=8pt, minimum height=1.2cm, fill=black, text=white, text depth=-0.6cm] {test};
}\tikz[]{
\node[shape=rectangle, inner sep=8pt, minimum height=1.2cm, fill=black, text=white, text depth=0cm] {test};
}


Obviously text depth can be hard coded but I would like it to automatically work for any given font and rectangle height.

If the text size is smaller than the minimum height you could try to use text height instead of minimum height:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\tikz[]{
\node[shape=rectangle, inner sep=0pt, fill=black, text=white,
font=\huge, text height=1.2cm] {test};
}

\tikz[]{
\node[shape=rectangle, inner sep=0pt, fill=black, text=white,
font=\huge, text height=1.2cm] {test yjp};
}

\tikz[]{
\node[shape=rectangle, inner sep=0pt, fill=black, text=white,
font=\huge, text height=1.2cm,text depth=0cm] {test yjp};
}

\end{document}